[Schmitzm-commits] r585 - branches/1.0-gt2-2.6/src/skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 26 15:33:27 CET 2009


Author: alfonx
Date: 2009-11-26 15:33:27 +0100 (Thu, 26 Nov 2009)
New Revision: 585

Modified:
   branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
Log:
* For a while the class asked for ALL properties if only the_geom was requested because it threw an NPE otherwise. This now works again and the un-commented code is in again. The only the visible properties + the_geom is requested.


Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollectionTableModel.java	2009-11-26 14:27:50 UTC (rev 584)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollectionTableModel.java	2009-11-26 14:33:27 UTC (rev 585)
@@ -120,7 +120,7 @@
 			if (amdm != null) {
 				Vector<String> visibleAttrNames = new Vector<String>();
 
-				// Add the column with the geometry (usually "the_geom")
+				// Add the column with the geometry (usually "the_geom") always
 				visibleAttrNames.add(schema.getGeometryDescriptor()
 						.getLocalName());
 
@@ -129,37 +129,16 @@
 					visibleAttrNames.add(a.getLocalName());
 				}
 
-				// for (AttributeDescriptor aDesc :
-				// schema.getAttributeDescriptors()) {
-				//					
-				// // Always add the geometry
-				// if (schema.getGeometryDescriptor()
-				// .getName().equals(aDesc.getName())) {
-				// visibleAttrNames.add(schema.getGeometryDescriptor()
-				// .getLocalName());
-				// continue;
-				// }
-				//					
-				// if (amd.get(aDesc.getName()).isVisible())
-				// visibleAttrNames.add(aDesc.getName().getLocalPart());
-				// }
-				//
-				// // create a query for the visible attributes
-				String[] properties = visibleAttrNames.toArray(new String[] {});
-				//
-				// LOGGER.debug("Query contains the following attributes: "
-				// + visibleAttrNames);
-
-				/**
-				 * I got NPEs when properties contained only [the_geom] ?!??!!??
-				 * TODO Try again one day... Not today... 20.11.2009, SK
-				 */
-				if (properties.length > 1) {
+//			Tested with 2.6.x trunk from 2009-11-26 and it now works. So we only request the properties we need!			
+// 				/**
+//				 * I got NPEs when properties contained only [the_geom] ?!??!!??
+//				 */
+//				if (properties.length > 1) {
 					query = new DefaultQuery(schema.getTypeName(), filter,
 							properties);
-				} else {
-					query = new DefaultQuery(schema.getTypeName(), filter);
-				}
+//				} else {
+//					query = new DefaultQuery(schema.getTypeName(), filter);
+//				}
 			}
 			fc = fs.getFeatures(query);
 		}



More information about the Schmitzm-commits mailing list