[Schmitzm-commits] r1477 - trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 2 20:30:06 CET 2011


Author: alfonx
Date: 2011-02-02 20:30:05 +0100 (Wed, 02 Feb 2011)
New Revision: 1477

Modified:
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java
Log:
			if (featureTypeBuilder.getDefaultGeometry() == null
					&& aDesc instanceof GeometryDescriptor)
				// remove gt-legacy: && aDesc instanceof GeometryAttributeType)
				featureTypeBuilder.setDefaultGeometry(aDesc.getLocalName());

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java	2011-01-30 12:31:46 UTC (rev 1476)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java	2011-02-02 19:30:05 UTC (rev 1477)
@@ -41,14 +41,10 @@
 import javax.swing.JTextField;
 import javax.swing.table.TableModel;
 
-import org.geotools.feature.AttributeTypeFactory;
-import org.geotools.feature.DefaultAttributeType;
-import org.geotools.feature.FeatureTypeBuilder;
-import org.geotools.feature.GeometryAttributeType;
 import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
-import org.geotools.feature.type.GeometricAttributeType;
 import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.feature.type.AttributeDescriptor;
+import org.opengis.feature.type.GeometryDescriptor;
 
 import com.vividsolutions.jts.geom.LineString;
 import com.vividsolutions.jts.geom.Point;
@@ -124,6 +120,7 @@
 	/**
 	 * Liefert die Spaltennamen der Tabelle.
 	 */
+	@Override
 	public String[] createColumnNames() {
 		return new String[] {
 				GeotoolsGUIUtil.RESOURCE
@@ -164,20 +161,24 @@
 						new DefaultCellEditor(new JComboBox(ATTR_TYPES_DESC)));
 		table.getColumnModel().getColumn(2)
 				.setCellEditor(new DefaultCellEditor(new JCheckBox() {
+					@Override
 					public int getHorizontalAlignment() {
 						return this.CENTER;
 					}
 
+					@Override
 					public int getVerticalAlignment() {
 						return this.CENTER;
 					}
 				}));
 		table.getColumnModel().getColumn(3)
 				.setCellEditor(new DefaultCellEditor(new JCheckBox() {
+					@Override
 					public int getHorizontalAlignment() {
 						return this.CENTER;
 					}
 
+					@Override
 					public int getVerticalAlignment() {
 						return this.CENTER;
 					}
@@ -238,7 +239,8 @@
 			AttributeDescriptor aDesc = aDef.createAttributeType();
 			featureTypeBuilder.add(aDesc);
 			if (featureTypeBuilder.getDefaultGeometry() == null
-					&& aDesc instanceof GeometryAttributeType)
+					&& aDesc instanceof GeometryDescriptor)
+				// remove gt-legacy: && aDesc instanceof GeometryAttributeType)
 				featureTypeBuilder.setDefaultGeometry(aDesc.getLocalName());
 		}
 		return this.featureTypeBuilder.buildFeatureType();
@@ -249,6 +251,7 @@
 	 * 
 	 * @return {@code true} fuer jede Zelle
 	 */
+	@Override
 	public boolean isCellEditable(int rowIndex, int columnIndex) {
 		return true;
 	}
@@ -288,6 +291,7 @@
 	 * @param columnIndex
 	 *            Spalten-Index (beginnend bei 0)
 	 */
+	@Override
 	public void setValueAt(Object value, int rowIndex, int columnIndex) {
 		AttributeDefinition aDef = attrDefinitions.elementAt(rowIndex);
 		switch (columnIndex) {
@@ -329,8 +333,7 @@
 	public void performAddRow() {
 		AttributeDefinition newAttrDef = new AttributeDefinition();
 		String presetName = GeotoolsGUIUtil.RESOURCE.getString(
-				"FeatureTypeBuilderTableModel.NewAttr",
-				getRowCount());
+				"FeatureTypeBuilderTableModel.NewAttr", getRowCount());
 		newAttrDef.name.setValue(presetName);
 		attrDefinitions.add(newAttrDef);
 		fireTableDataChanged();
@@ -435,7 +438,7 @@
 			}
 
 			Class type = (Class) this.type.getValue();
-			boolean nillable = (Boolean) this.nillable.getValue();
+			boolean nillable = this.nillable.getValue();
 			Object defaultValue = this.defaultValue.getValue();
 			if ("".equals(defaultValue))
 				defaultValue = null;
@@ -446,8 +449,7 @@
 				defaultValue = FeatureUtil.getDefaultAttributeValue(type);
 
 			AttributeDescriptor aType = AttributeTypeFactory.newAttributeType(
-					(String) name.getValue(), type, nillable, null,
-					defaultValue, null);
+					name.getValue(), type, nillable, null, defaultValue, null);
 
 			AutoValueGenerator<?> valueGenerator = null;
 			if (autoValue.getValue()) {
@@ -456,10 +458,9 @@
 							(Number) defaultValue);
 				else
 					throw new UnsupportedOperationException(
-							GeotoolsGUIUtil.RESOURCE
-									.getString(
-											"JMapEditorToolBar.NewLayer.Err.AutoVal",
-											type.getSimpleName()));
+							GeotoolsGUIUtil.RESOURCE.getString(
+									"JMapEditorToolBar.NewLayer.Err.AutoVal",
+									type.getSimpleName()));
 				FeatureUtil.registerAutoValueGenerator(aType, valueGenerator);
 			} else
 				FeatureUtil.unregisterAutoValueGenerator(aType);



More information about the Schmitzm-commits mailing list