Revision 46737 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/featuretype/DefaultFeatureAttributePanel.java
DefaultFeatureAttributePanel.java | ||
---|---|---|
76 | 76 |
import org.gvsig.tools.dataTypes.DataType; |
77 | 77 |
import org.gvsig.tools.dataTypes.DataType.NumberPrecisionAndScale; |
78 | 78 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
79 |
import org.gvsig.tools.dynform.spi.DynFormSPILocator; |
|
80 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
81 | 79 |
import org.gvsig.tools.dynobject.DynField; |
82 | 80 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
83 | 81 |
import org.gvsig.tools.i18n.I18nManager; |
... | ... | |
127 | 125 |
private final JButton btnFormulaBokkmarks; |
128 | 126 |
private ExpressionPickerController pickerFormula; |
129 | 127 |
private boolean editable; |
130 |
private FeatureStoreElement featureStoreElement; |
|
131 | 128 |
private ForeingKey foreingKey; |
132 | 129 |
|
133 | 130 |
public ForeingKeyController( |
... | ... | |
179 | 176 |
this.btnFormula.setText(""); |
180 | 177 |
this.btnFormulaBokkmarks.setText(""); |
181 | 178 |
this.btnFormulaHistory.setText(""); |
182 |
this.featureStoreElement = dataSwingManager.createFeatureStoreElement(); |
|
183 | 179 |
this.pickerFormula = ExpressionEvaluatorSwingLocator.getManager() |
184 | 180 |
.createExpressionPickerController(txtFormula, btnFormula, btnFormulaBokkmarks, btnFormulaHistory); |
185 |
this.pickerFormula.getConfig().addElement(this.featureStoreElement); |
|
186 |
|
|
187 |
// this.chkIsForeingKey.addChangeListener(new ChangeListener() { |
|
188 |
// @Override |
|
189 |
// public void stateChanged(ChangeEvent e) { |
|
190 |
// if (chkIsForeingKey.isSelected()) { |
|
191 |
// setEnabled(editable); |
|
192 |
// } else { |
|
193 |
// setEnabled(false); |
|
194 |
// } |
|
195 |
// } |
|
196 |
// }); |
|
197 | 181 |
} |
198 | 182 |
|
199 | 183 |
private void doPopulateComboCode() { |
... | ... | |
206 | 190 |
if( !(store instanceof FeatureStore) ) { |
207 | 191 |
return; |
208 | 192 |
} |
209 |
this.featureStoreElement.setFeatureStore((FeatureStore) store); |
|
210 | 193 |
FeatureType featureType; |
211 | 194 |
try { |
212 | 195 |
featureType = ((FeatureStore)store).getDefaultFeatureType(); |
213 | 196 |
} catch (DataException ex) { |
214 | 197 |
return; |
215 | 198 |
} |
199 |
|
|
200 |
DataSwingManager dataSwingManager = DALSwingLocator.getSwingManager(); |
|
201 |
dataSwingManager.resetExpressionBuilder(this.pickerFormula.getConfig()); |
|
202 |
dataSwingManager.addToExpressionBuilder(this.pickerFormula.getConfig(), (FeatureStore) store, "foreigntable"); |
|
203 |
|
|
216 | 204 |
Search search = (Search) ToolsLocator.getComplementsManager().get( |
217 | 205 |
Search.COMPLEMENT_MANE, featureType |
218 | 206 |
); |
... | ... | |
443 | 431 |
private CalculatorController<Integer> pickerPrecision; |
444 | 432 |
private CalculatorController<Integer> pickerScale; |
445 | 433 |
private PickerController<IProjection> pickerCRS; |
446 |
private ExpressionPickerController pickerVirtualField; |
|
434 |
private ExpressionPickerController pickerVirtualFieldGetter; |
|
435 |
private ExpressionPickerController pickerVirtualFieldSetter; |
|
447 | 436 |
private ExpressionPickerController pickerDefaultFormat; |
448 | 437 |
private CalculatorController<Integer> pickerOrder; |
449 | 438 |
private AvailableValuesController availableValuesController; |
... | ... | |
560 | 549 |
swingManager.translate(this.lblSize); |
561 | 550 |
swingManager.translate(this.lblDisplaySize); |
562 | 551 |
swingManager.translate(this.chkVirtualField); |
552 |
swingManager.translate(this.lblVirtualField); |
|
553 |
swingManager.translate(this.lblVirtualFieldSep); |
|
554 |
swingManager.translate(this.lblVirtualFieldGetter); |
|
555 |
swingManager.translate(this.lblVirtualFieldSetter); |
|
563 | 556 |
swingManager.translate(this.tabAditionalFields); |
564 | 557 |
swingManager.translate(this.tabLayout); |
565 | 558 |
swingManager.translate(this.lblGroup); |
... | ... | |
695 | 688 |
this.txtMinValue.setEnabled(false); |
696 | 689 |
this.txtMaxValue.setEnabled(false); |
697 | 690 |
|
698 |
this.btnVirtualField.setText(""); |
|
691 |
this.btnVirtualFieldGetter.setText("");
|
|
699 | 692 |
this.featureStoreElement = dataSwingManager.createFeatureStoreElement(); |
700 |
this.pickerVirtualField = evaluatorSwingManager.createExpressionPickerController( |
|
701 |
txtVirtualField, btnVirtualField, btnVirtualFieldBookmarks, btnVirtualFieldHistory
|
|
693 |
this.pickerVirtualFieldGetter = evaluatorSwingManager.createExpressionPickerController(
|
|
694 |
txtVirtualFieldGetter, btnVirtualFieldGetter, btnVirtualFieldBookmarksGetter, btnVirtualFieldHistoryGetter
|
|
702 | 695 |
); |
703 |
this.pickerVirtualField.getConfig().addElement(this.featureStoreElement); |
|
696 |
this.pickerVirtualFieldGetter.getConfig().addElement(this.featureStoreElement); |
|
697 |
this.pickerVirtualFieldSetter = evaluatorSwingManager.createExpressionPickerController( |
|
698 |
txtVirtualFieldSetter, btnVirtualFieldSetter, btnVirtualFieldBookmarksSetter, btnVirtualFieldHistorySetter |
|
699 |
); |
|
700 |
this.pickerVirtualFieldSetter.getConfig().addElement(this.featureStoreElement); |
|
701 |
|
|
704 | 702 |
this.chkVirtualField.addChangeListener((ChangeEvent e) -> { |
705 | 703 |
if (chkVirtualField.isSelected()) { |
706 |
pickerVirtualField.setEditable(mode==MODE_EDIT_ALL || mode==MODE_EDIT_ONLY_METADATA); |
|
704 |
pickerVirtualFieldGetter.setEditable(mode==MODE_EDIT_ALL || mode==MODE_EDIT_ONLY_METADATA); |
|
705 |
pickerVirtualFieldSetter.setEditable(false); |
|
707 | 706 |
} else { |
708 |
pickerVirtualField.setEditable(false); |
|
707 |
pickerVirtualFieldGetter.setEditable(false); |
|
708 |
pickerVirtualFieldSetter.setEditable(false); |
|
709 | 709 |
} |
710 | 710 |
}); |
711 | 711 |
|
... | ... | |
899 | 899 |
); |
900 | 900 |
|
901 | 901 |
if (this.chkVirtualField.isSelected() ) { //&& this.pickerVirtualField.isEnabled()) { |
902 |
Expression expression = this.pickerVirtualField.get(); |
|
902 |
Expression expression = this.pickerVirtualFieldGetter.get();
|
|
903 | 903 |
if (expression == null) { |
904 | 904 |
descriptor.setFeatureAttributeEmulator((String) null); |
905 | 905 |
} else { |
... | ... | |
1021 | 1021 |
|
1022 | 1022 |
this.chkVirtualField.setSelected(false); |
1023 | 1023 |
this.chkVirtualField.setEnabled(this.mode==MODE_EDIT_ALL || this.mode==MODE_EDIT_ONLY_METADATA); |
1024 |
this.pickerVirtualField.setEditable(false); |
|
1025 |
this.pickerVirtualField.set(null); |
|
1024 |
this.pickerVirtualFieldGetter.setEditable(false);
|
|
1025 |
this.pickerVirtualFieldGetter.set(null);
|
|
1026 | 1026 |
|
1027 | 1027 |
ListElement.setSelected(cboGeometryType, null); |
1028 | 1028 |
ListElement.setSelected(cboGeometrySubtype, null); |
... | ... | |
1061 | 1061 |
if (sampleFeature != null) { |
1062 | 1062 |
FeatureSymbolTable featureSymbolTable = DALLocator.getDataManager().createFeatureSymbolTable(); |
1063 | 1063 |
featureSymbolTable.setFeature(sampleFeature); |
1064 |
this.pickerVirtualField.getConfig().setPreviewSymbolTable(featureSymbolTable.createParent()); |
|
1064 |
this.pickerVirtualFieldGetter.getConfig().setPreviewSymbolTable(featureSymbolTable.createParent());
|
|
1065 | 1065 |
this.pickerValuesFilter.getConfig().setPreviewSymbolTable(featureSymbolTable.createParent()); |
1066 | 1066 |
} |
1067 | 1067 |
} |
... | ... | |
1110 | 1110 |
this.chkIsIndexed.setSelected(descriptor.isIndexed()); |
1111 | 1111 |
this.chkIsPrimaryKey.setSelected(descriptor.isPrimaryKey()); |
1112 | 1112 |
|
1113 |
this.pickerVirtualField.setEnabled(true); |
|
1113 |
this.pickerVirtualFieldGetter.setEnabled(true);
|
|
1114 | 1114 |
FeatureAttributeEmulator attrEmulator = descriptor.getFeatureAttributeEmulator(); |
1115 | 1115 |
if (attrEmulator instanceof FeatureAttributeEmulatorExpression) { |
1116 | 1116 |
Expression expression = ((FeatureAttributeEmulatorExpression) attrEmulator).getExpression(); |
1117 | 1117 |
this.chkVirtualField.setEnabled(this.mode==MODE_EDIT_ALL); |
1118 | 1118 |
this.chkVirtualField.setSelected(true); |
1119 |
this.pickerVirtualField.set(expression); |
|
1119 |
this.pickerVirtualFieldGetter.set(expression);
|
|
1120 | 1120 |
} else if (descriptor.isComputed()) { |
1121 | 1121 |
this.chkVirtualField.setEnabled(false); |
1122 | 1122 |
this.chkVirtualField.setSelected(true); |
1123 |
this.pickerVirtualField.set(null); |
|
1123 |
this.pickerVirtualFieldGetter.set(null);
|
|
1124 | 1124 |
} else { |
1125 | 1125 |
this.chkVirtualField.setEnabled(this.mode==MODE_EDIT_ALL); |
1126 | 1126 |
this.chkVirtualField.setSelected(false); |
1127 |
this.pickerVirtualField.set(null); |
|
1127 |
this.pickerVirtualFieldGetter.set(null);
|
|
1128 | 1128 |
} |
1129 |
this.pickerVirtualField.setEnabled(true); |
|
1129 |
this.pickerVirtualFieldGetter.setEnabled(true);
|
|
1130 | 1130 |
|
1131 | 1131 |
Expression expression = descriptor.getAvailableValuesFilter(); |
1132 | 1132 |
this.pickerValuesFilter.set(expression); |
... | ... | |
1326 | 1326 |
} |
1327 | 1327 |
|
1328 | 1328 |
this.chkVirtualField.setEnabled(true); |
1329 |
this.pickerVirtualField.setEditable(true); |
|
1329 |
this.pickerVirtualFieldGetter.setEditable(true);
|
|
1330 | 1330 |
|
1331 | 1331 |
this.cboDateFormat.setEnabled(true); |
1332 | 1332 |
this.cboFieldType.setEnabled(true); |
... | ... | |
1352 | 1352 |
this.txtFieldName.setEditable(true); |
1353 | 1353 |
this.pickerScale.setEditable(true); |
1354 | 1354 |
this.pickerSize.setEditable(true); |
1355 |
this.pickerVirtualField.setEditable(true); |
|
1355 |
this.pickerVirtualFieldGetter.setEditable(true);
|
|
1356 | 1356 |
this.cboFieldType.setEnabled(true); |
1357 | 1357 |
this.btnFieldType.setEnabled(true); |
1358 | 1358 |
this.cboGeometryType.setEnabled(true); |
... | ... | |
1363 | 1363 |
this.pickerPrecision.setEditable(false); |
1364 | 1364 |
this.pickerScale.setEditable(false); |
1365 | 1365 |
this.pickerSize.setEditable(false); |
1366 |
this.pickerVirtualField.setEditable(false); |
|
1366 |
this.pickerVirtualFieldGetter.setEditable(false);
|
|
1367 | 1367 |
this.cboFieldType.setEnabled(false); |
1368 | 1368 |
this.btnFieldType.setEnabled(false); |
1369 | 1369 |
this.cboGeometryType.setEnabled(false); |
... | ... | |
1426 | 1426 |
this.chkIsPrimaryKey.setEnabled(false); |
1427 | 1427 |
|
1428 | 1428 |
this.chkVirtualField.setEnabled(false); |
1429 |
this.pickerVirtualField.setEditable(false); |
|
1429 |
this.pickerVirtualFieldGetter.setEditable(false);
|
|
1430 | 1430 |
|
1431 | 1431 |
this.cboDateFormat.setEnabled(false); |
1432 | 1432 |
this.cboFieldType.setEnabled(false); |
Also available in: Unified diff