Revision 46978 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 | ||
---|---|---|
630 | 630 |
this.clean(); |
631 | 631 |
return; |
632 | 632 |
} |
633 |
Expression exp = this.pickerExpression.get(); |
|
634 |
if( ExpressionUtils.isPhraseEmpty(exp) ) { |
|
635 |
descriptor.setFeatureAttributeEmulator((Expression)null); |
|
636 |
} else { |
|
637 |
descriptor.setFeatureAttributeEmulator(exp); |
|
638 |
} |
|
633 |
// Expression exp = this.pickerExpression.get();
|
|
634 |
// if( ExpressionUtils.isPhraseEmpty(exp) ) {
|
|
635 |
// descriptor.setFeatureAttributeEmulator((Expression)null);
|
|
636 |
// } else {
|
|
637 |
// descriptor.setFeatureAttributeEmulator(exp);
|
|
638 |
// }
|
|
639 | 639 |
Tags tags = descriptor.getTags(); |
640 | 640 |
if( !tags.has(DAL_RELATED_TABLE) ) { |
641 | 641 |
String tableName = this.getTableName(); |
... | ... | |
660 | 660 |
} |
661 | 661 |
} |
662 | 662 |
|
663 |
public Expression getExpression() { |
|
664 |
Expression exp = this.pickerExpression.get(); |
|
665 |
if( ExpressionUtils.isPhraseEmpty(exp) ) { |
|
666 |
return null; |
|
667 |
} else { |
|
668 |
return exp; |
|
669 |
} |
|
670 |
} |
|
671 |
|
|
663 | 672 |
public int getRelationType() { |
664 | 673 |
Object n = this.cboRelationType.getSelectedItem(); |
665 | 674 |
if( n == null ) { |
... | ... | |
1063 | 1072 |
|
1064 | 1073 |
this.chkVirtualField.addChangeListener((ChangeEvent e) -> { |
1065 | 1074 |
if (chkVirtualField.isSelected()) { |
1066 |
pickerVirtualFieldGetter.setEditable(mode==MODE_EDIT_ALL || mode==MODE_EDIT_ONLY_METADATA); |
|
1075 |
pickerVirtualFieldGetter.setEditable(mode==MODE_EDIT_ALL || mode==MODE_EDIT_ONLY_METADATA || mode==MODE_VIRTUAL_FIELD);
|
|
1067 | 1076 |
pickerVirtualFieldSetter.setEditable(false); |
1068 | 1077 |
} else { |
1069 | 1078 |
pickerVirtualFieldGetter.setEditable(false); |
... | ... | |
1225 | 1234 |
switch(this.getMode() ) { |
1226 | 1235 |
case MODE_EDIT_ONLY_METADATA: |
1227 | 1236 |
case MODE_EDIT_ALL: |
1237 |
case MODE_VIRTUAL_FIELD: |
|
1228 | 1238 |
enabled = true; |
1229 | 1239 |
break; |
1230 | 1240 |
case MODE_SHOW_ONLY: |
... | ... | |
1446 | 1456 |
} |
1447 | 1457 |
case MODE_EDIT_ALL: |
1448 | 1458 |
case MODE_SHOW_ONLY: |
1459 |
case MODE_VIRTUAL_FIELD: |
|
1449 | 1460 |
descriptor.setDefaultValue(defaultValue); |
1450 | 1461 |
} |
1451 | 1462 |
|
... | ... | |
1584 | 1595 |
} else if( rdbRelationToMany.isSelected() ) { |
1585 | 1596 |
descriptor.setRelationType(this.toManyController.getRelationType()); |
1586 | 1597 |
descriptor.getForeingKey().setForeingKey(false); |
1598 |
descriptor.setFeatureAttributeEmulator(this.toManyController.getExpression()); |
|
1587 | 1599 |
} else if( rdbRelationNone.isSelected() ) { |
1588 | 1600 |
descriptor.setRelationType(DynField.RELATION_TYPE_NONE); |
1589 | 1601 |
descriptor.getForeingKey().setForeingKey(false); |
... | ... | |
1613 | 1625 |
this.chkIsIndexed.setSelected(false); |
1614 | 1626 |
this.chkIsPrimaryKey.setSelected(false); |
1615 | 1627 |
|
1616 |
this.chkVirtualField.setSelected(false); |
|
1617 |
this.chkVirtualField.setEnabled(this.mode==MODE_EDIT_ALL || this.mode==MODE_EDIT_ONLY_METADATA); |
|
1628 |
switch (this.mode){ |
|
1629 |
case MODE_EDIT_ALL: |
|
1630 |
case MODE_EDIT_ONLY_METADATA: |
|
1631 |
this.chkVirtualField.setSelected(false); |
|
1632 |
this.chkVirtualField.setEnabled(true); |
|
1633 |
break; |
|
1634 |
case MODE_SHOW_ONLY: |
|
1635 |
this.chkVirtualField.setSelected(false); |
|
1636 |
this.chkVirtualField.setEnabled(false); |
|
1637 |
break; |
|
1638 |
case MODE_VIRTUAL_FIELD: |
|
1639 |
this.chkVirtualField.setSelected(true); |
|
1640 |
this.chkVirtualField.setEnabled(false); |
|
1641 |
break; |
|
1642 |
} |
|
1618 | 1643 |
this.pickerVirtualFieldGetter.setEditable(false); |
1619 | 1644 |
this.pickerVirtualFieldGetter.set(null); |
1620 | 1645 |
|
... | ... | |
1828 | 1853 |
DataType dataType = this.getDataType(); |
1829 | 1854 |
|
1830 | 1855 |
if( dataType.supportSize() ) { |
1831 |
this.pickerSize.setEditable(this.mode == MODE_EDIT_ALL); |
|
1856 |
this.pickerSize.setEditable(this.mode == MODE_EDIT_ALL || this.isVirtualField());
|
|
1832 | 1857 |
} else { |
1833 | 1858 |
this.pickerSize.setEditable(false); |
1834 | 1859 |
this.pickerSize.set(null); |
1835 | 1860 |
} |
1836 |
this.pickerDisplaySize.setEditable(this.mode == MODE_EDIT_ALL); |
|
1861 |
this.pickerDisplaySize.setEditable(this.mode == MODE_EDIT_ALL || this.isVirtualField());
|
|
1837 | 1862 |
if( dataType.supportPrecision() ) { |
1838 | 1863 |
if( dataType.isPredefinedPrecision() ) { |
1839 | 1864 |
this.pickerPrecision.setEditable(false); |
1840 | 1865 |
} else { |
1841 |
this.pickerPrecision.setEditable(this.mode == MODE_EDIT_ALL); |
|
1866 |
this.pickerPrecision.setEditable(this.mode == MODE_EDIT_ALL || this.isVirtualField());
|
|
1842 | 1867 |
} |
1843 | 1868 |
} else { |
1844 | 1869 |
this.pickerPrecision.setEditable(false); |
1845 | 1870 |
this.pickerPrecision.set(null); |
1846 | 1871 |
} |
1847 | 1872 |
if( dataType.supportScale()) { |
1848 |
this.pickerScale.setEditable(this.mode == MODE_EDIT_ALL); |
|
1873 |
this.pickerScale.setEditable(this.mode == MODE_EDIT_ALL || this.isVirtualField());
|
|
1849 | 1874 |
} else { |
1850 | 1875 |
this.pickerScale.setEditable(false); |
1851 | 1876 |
this.pickerScale.set(null); |
1852 | 1877 |
} |
1853 | 1878 |
switch (dataType.getType()) { |
1854 | 1879 |
case DataTypes.GEOMETRY: |
1855 |
this.cboGeometryType.setEnabled(this.mode == MODE_EDIT_ALL); |
|
1856 |
this.cboGeometrySubtype.setEnabled(this.mode == MODE_EDIT_ALL); |
|
1857 |
this.pickerCRS.setEditable(this.mode == MODE_EDIT_ALL); |
|
1880 |
this.cboGeometryType.setEnabled(this.mode == MODE_EDIT_ALL || this.isVirtualField());
|
|
1881 |
this.cboGeometrySubtype.setEnabled(this.mode == MODE_EDIT_ALL || this.isVirtualField());
|
|
1882 |
this.pickerCRS.setEditable(this.mode == MODE_EDIT_ALL || this.isVirtualField());
|
|
1858 | 1883 |
this.cboDateFormat.setEnabled(false); |
1859 | 1884 |
this.pickerIntervalStart.setEditable(false); |
1860 | 1885 |
this.pickerIntervalEnd.setEditable(false); |
... | ... | |
1869 | 1894 |
this.cboGeometryType.setEnabled(false); |
1870 | 1895 |
this.cboGeometrySubtype.setEnabled(false); |
1871 | 1896 |
this.pickerCRS.setEditable(false); |
1872 |
this.cboDateFormat.setEnabled(this.mode == MODE_EDIT_ALL || this.mode == MODE_EDIT_ONLY_METADATA); |
|
1873 |
this.pickerIntervalStart.setEnabled(this.mode == MODE_EDIT_ALL || this.mode == MODE_EDIT_ONLY_METADATA); |
|
1874 |
this.pickerIntervalEnd.setEnabled(this.mode == MODE_EDIT_ALL || this.mode == MODE_EDIT_ONLY_METADATA); |
|
1897 |
this.cboDateFormat.setEnabled(this.mode == MODE_EDIT_ALL || this.mode == MODE_EDIT_ONLY_METADATA || this.isVirtualField());
|
|
1898 |
this.pickerIntervalStart.setEnabled(this.mode == MODE_EDIT_ALL || this.mode == MODE_EDIT_ONLY_METADATA || this.isVirtualField());
|
|
1899 |
this.pickerIntervalEnd.setEnabled(this.mode == MODE_EDIT_ALL || this.mode == MODE_EDIT_ONLY_METADATA || this.isVirtualField());
|
|
1875 | 1900 |
this.tabAditionalFields.setEnabledAt(1, false); |
1876 | 1901 |
this.tabAditionalFields.setEnabledAt(2, true); |
1877 | 1902 |
break; |
... | ... | |
2080 | 2105 |
this.availableValuesController.setEditable(false); |
2081 | 2106 |
this.tagsController.setEnabled(false); |
2082 | 2107 |
break; |
2108 |
case MODE_VIRTUAL_FIELD: |
|
2109 |
this.txtDefaultValue.setEditable(!this.chkIsAutomatic.isSelected()); |
|
2110 |
this.chkDefaultValue.setEnabled(this.txtDefaultValue.isEditable()); |
|
2111 |
this.txtDefaultFormat.setEditable(true); |
|
2112 |
this.txtFieldName.setEditable(true); |
|
2113 |
this.pickerIntervalEnd.setEditable(true); |
|
2114 |
this.pickerIntervalStart.setEditable(true); |
|
2115 |
this.pickerSize.setEditable(dataType.supportSize()); |
|
2116 |
this.pickerDisplaySize.setEditable(true); |
|
2117 |
if( dataType.isPredefinedPrecision() ) { |
|
2118 |
this.pickerPrecision.setEditable(false); |
|
2119 |
this.pickerPrecision.set(dataType.getMaxPrecision()); |
|
2120 |
} else { |
|
2121 |
this.pickerPrecision.setEditable(dataType.supportPrecision()); |
|
2122 |
} |
|
2123 |
this.pickerScale.setEditable(dataType.supportScale()); |
|
2124 |
this.cboDataProfile.setEnabled(true); |
|
2125 |
|
|
2126 |
this.chkAllowNulls.setEnabled(true); |
|
2127 |
this.chkIsAutomatic.setEnabled(true); |
|
2128 |
this.chkIsReadOnly.setEnabled(true); |
|
2129 |
this.chkIsIndexed.setEnabled(true); |
|
2130 |
if( this.isVirtualField() ) { |
|
2131 |
this.chkIsPrimaryKey.setEnabled(false); |
|
2132 |
} else { |
|
2133 |
this.chkIsPrimaryKey.setEnabled(true); |
|
2134 |
} |
|
2135 |
|
|
2136 |
this.chkVirtualField.setEnabled(false); |
|
2137 |
this.chkVirtualField.setSelected(true); |
|
2138 |
this.pickerVirtualFieldGetter.setEditable(true); |
|
2139 |
|
|
2140 |
this.cboDateFormat.setEnabled(true); |
|
2141 |
this.cboFieldType.setEnabled(!this.chkIsAutomatic.isSelected()); |
|
2142 |
this.btnFieldType.setEnabled(!this.chkIsAutomatic.isSelected()); |
|
2143 |
this.cboGeometryType.setEnabled(true); |
|
2144 |
this.cboGeometrySubtype.setEnabled(true); |
|
2145 |
this.pickerCRS.setEditable(true); |
|
2146 |
|
|
2147 |
this.cboGroup.setEnabled(true); |
|
2148 |
this.pickerOrder.setEditable(true); |
|
2149 |
this.chkHidden.setEnabled(true); |
|
2150 |
this.txtLabel.setEditable(true); |
|
2151 |
this.txtDescription.setEditable(true); |
|
2152 |
this.txtMinValue.setEditable(false); |
|
2153 |
this.txtMaxValue.setEditable(false); |
|
2154 |
this.pickerValuesFilter.setEditable(true); |
|
2155 |
this.availableValuesController.setEditable(true); |
|
2156 |
this.tagsController.setEnabled(true); |
|
2157 |
this.pickerLocale.setEnabled(true); |
|
2158 |
break; |
|
2083 | 2159 |
} |
2084 | 2160 |
this.txtDisplaySize.setBackground(UIManager.getColor(ToolsSwingManager.COLOR_TEXTFIELD_BACKGROUND)); |
2085 | 2161 |
if(this.pickerPrecision.get() != null && this.pickerDisplaySize.get() != null){ |
... | ... | |
2094 | 2170 |
switch(this.mode) { |
2095 | 2171 |
case MODE_EDIT_ALL: |
2096 | 2172 |
case MODE_EDIT_ONLY_METADATA: |
2173 |
case MODE_VIRTUAL_FIELD: |
|
2097 | 2174 |
if( this.isVirtualField() ) { |
2098 | 2175 |
this.toOneController.setEditable(false); |
2099 | 2176 |
this.rdbRelationToOne.setEnabled(false); |
... | ... | |
2109 | 2186 |
if( this.rdbRelationToMany.isSelected() ) { |
2110 | 2187 |
this.pickerVirtualFieldGetter.setEnabled(false); |
2111 | 2188 |
// this.pickerVirtualFieldGetter.set(null); |
2189 |
} else { |
|
2190 |
this.pickerVirtualFieldGetter.setEnabled(true); |
|
2112 | 2191 |
} |
2113 | 2192 |
break; |
2114 | 2193 |
case MODE_SHOW_ONLY: |
Also available in: Unified diff