Revision 44435
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java | ||
---|---|---|
553 | 553 |
.toArray(new FeatureAttributeDescriptor[super.size()]); |
554 | 554 |
} |
555 | 555 |
|
556 |
@Override |
|
557 |
public boolean hasPrimaryKey() { |
|
558 |
if( pk!=null ) { |
|
559 |
return pk.length>0; |
|
560 |
} |
|
561 |
for (FeatureAttributeDescriptor attr : this) { |
|
562 |
if( attr.isPrimaryKey() ) { |
|
563 |
return true; |
|
564 |
} |
|
565 |
} |
|
566 |
return false; |
|
567 |
} |
|
568 |
|
|
569 |
@Override |
|
570 |
public boolean supportReferences() { |
|
571 |
return this.hasOID() || this.hasPrimaryKey(); |
|
572 |
} |
|
573 |
|
|
574 |
@Override |
|
556 | 575 |
public FeatureAttributeDescriptor[] getPrimaryKey() { |
557 | 576 |
if (pk == null) { |
558 | 577 |
List pks = new ArrayList(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java | ||
---|---|---|
783 | 783 |
|
784 | 784 |
} |
785 | 785 |
|
786 |
@Override |
|
787 |
public boolean isAvailable() { |
|
788 |
return this.featureReferenceSelection.isAvailable(); |
|
789 |
} |
|
786 | 790 |
|
787 | 791 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java | ||
---|---|---|
3098 | 3098 |
} |
3099 | 3099 |
return sampleFeature; |
3100 | 3100 |
} |
3101 |
|
|
3101 |
|
|
3102 |
@Override |
|
3103 |
public boolean supportReferences() { |
|
3104 |
try { |
|
3105 |
return this.getDefaultFeatureType().supportReferences(); |
|
3106 |
} catch (Exception ex) { |
|
3107 |
return false; |
|
3108 |
} |
|
3109 |
} |
|
3110 |
|
|
3111 |
|
|
3102 | 3112 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java | ||
---|---|---|
38 | 38 |
import org.gvsig.fmap.dal.feature.FeatureReferenceSelection; |
39 | 39 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
40 | 40 |
import org.gvsig.fmap.dal.feature.FeatureStoreNotification; |
41 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
41 | 42 |
import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack; |
42 | 43 |
import org.gvsig.tools.ToolsLocator; |
43 | 44 |
import org.gvsig.tools.dispose.impl.AbstractDisposable; |
... | ... | |
65 | 66 |
public static final String DYNCLASS_PERSISTENT_NAME = |
66 | 67 |
"DefaultFeatureReferenceSelection"; |
67 | 68 |
|
69 |
private Boolean available = null; |
|
70 |
|
|
68 | 71 |
protected SelectionData selectionData = null; |
69 | 72 |
|
70 | 73 |
private FeatureStore featureStore; |
... | ... | |
612 | 615 |
// featureStore and helper are already swallow cloned by our parent |
613 | 616 |
return clone; |
614 | 617 |
} |
618 |
|
|
619 |
@Override |
|
620 |
public boolean isAvailable() { |
|
621 |
if( this.available==null ) { |
|
622 |
try { |
|
623 |
FeatureType type = this.featureStore.getDefaultFeatureType(); |
|
624 |
this.available = type.supportReferences(); |
|
625 |
} catch (DataException ex) { |
|
626 |
this.available = false; |
|
627 |
} |
|
628 |
} |
|
629 |
return this.available; |
|
630 |
} |
|
631 |
|
|
632 |
|
|
615 | 633 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretable/table/DefaultFeatureTableModel.java | ||
---|---|---|
557 | 557 |
} |
558 | 558 |
|
559 | 559 |
public boolean isSelectionLocked() { |
560 |
if( !this.getFeatureType().supportReferences() ) { |
|
561 |
return true; |
|
562 |
} |
|
560 | 563 |
return selectionLocked; |
561 | 564 |
} |
562 | 565 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureType.java | ||
---|---|---|
281 | 281 |
*/ |
282 | 282 |
public FeatureAttributeDescriptor[] getPrimaryKey(); |
283 | 283 |
|
284 |
public boolean hasPrimaryKey(); |
|
285 |
|
|
286 |
public boolean supportReferences(); |
|
287 |
|
|
284 | 288 |
/** |
285 | 289 |
* Returns the default geometry FeatureAttributeDescriptor. Return null if |
286 | 290 |
* it's not set |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureStore.java | ||
---|---|---|
1208 | 1208 |
public long getPendingChangesCount(); |
1209 | 1209 |
|
1210 | 1210 |
public Feature getSampleFeature(); |
1211 |
|
|
1212 |
/** |
|
1213 |
* Return true when the default feature type of the store |
|
1214 |
* support references. |
|
1215 |
* |
|
1216 |
* @return true when support references. |
|
1217 |
*/ |
|
1218 |
public boolean supportReferences(); |
|
1211 | 1219 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureSelection.java | ||
---|---|---|
86 | 86 |
* @return if it is selected |
87 | 87 |
*/ |
88 | 88 |
boolean isSelected(Feature feature); |
89 |
|
|
90 |
boolean isAvailable(); |
|
89 | 91 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureReferenceSelection.java | ||
---|---|---|
107 | 107 |
* @return the iterator of selected feature references |
108 | 108 |
*/ |
109 | 109 |
Iterator referenceIterator(); |
110 |
|
|
111 |
public boolean isAvailable(); |
|
110 | 112 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/test/java/org/gvsig/fmap/dal/feature/DummyFetureStore.java | ||
---|---|---|
781 | 781 |
public FeatureQuery createFeatureQuery(Expression filter, String sortBy, boolean asc) { |
782 | 782 |
return null; |
783 | 783 |
} |
784 |
|
|
785 |
@Override |
|
786 |
public boolean supportReferences() { |
|
787 |
return true; |
|
788 |
} |
|
784 | 789 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/test/java/org/gvsig/fmap/dal/feature/DummyFeatureType.java | ||
---|---|---|
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
@Override |
126 |
public boolean hasPrimaryKey() { |
|
127 |
return false; |
|
128 |
} |
|
129 |
|
|
130 |
@Override |
|
131 |
public boolean supportReferences() { |
|
132 |
return false; |
|
133 |
} |
|
134 |
|
|
135 |
@Override |
|
126 | 136 |
public FeatureAttributeDescriptor getDefaultGeometryAttribute() { |
127 | 137 |
return null; |
128 | 138 |
} |
Also available in: Unified diff