[Schmitzm-commits] r1265 - trunk/src/skrueger/geotools
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Nov 12 20:17:47 CET 2010
Author: alfonx
Date: 2010-11-12 20:17:47 +0100 (Fri, 12 Nov 2010)
New Revision: 1265
Modified:
trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
Log:
Fixed an exception that appeared when column settings where changed while the table with these columns was visible. Now the attribute table will not change until it is closed and reopened.
Modified: trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
===================================================================
--- trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java 2010-11-11 21:11:08 UTC (rev 1264)
+++ trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java 2010-11-12 19:17:47 UTC (rev 1265)
@@ -68,7 +68,10 @@
FeatureCollectionTableModel {
final static private Logger LOGGER = Logger
.getLogger(StyledFeatureCollectionTableModel.class);
- /** Contains the complete {@link AttributeMetadataImpl}-Map of the styled layer. */
+ /**
+ * Contains the complete {@link AttributeMetadataImpl}-Map of the styled
+ * layer.
+ */
protected AttributeMetadataMap<? extends AttributeMetadataInterface> amdMap = null;
/** Holds the current filter on the table */
protected Filter filter = null;
@@ -80,7 +83,10 @@
*/
protected String[] colTooltips = null;
- /** A cache for the #sortedValuesVisibleOnly() **/
+ /**
+ * A cache for the #sortedValuesVisibleOnly(). WHen the amd is changed
+ * externally, this object will stay the same
+ **/
protected List<? extends AttributeMetadataInterface> amdMapVisibleOnly = null;
/**
@@ -103,21 +109,22 @@
@Override
public Object getValueAt(int row, int col) {
Object rawValue = super.getValueAt(row, col);
- return amdMap.sortedValuesVisibleOnly().get(col).fiterNodata(rawValue);
+ return amdMapVisibleOnly.get(col).fiterNodata(rawValue);
}
-
+
/**
* Sets a new data source for the table.
*
* @param fs
* the feature source
* @param amdm
- * {@link AttributeMetadataImpl}-Map to define the visible attributes
- * and translation
+ * {@link AttributeMetadataImpl}-Map to define the visible
+ * attributes and translation
*/
protected void setFeatureSource(
FeatureSource<SimpleFeatureType, SimpleFeature> fs,
- AttributeMetadataMap<? extends AttributeMetadataInterface> amdm, Filter filter) throws Exception {
+ AttributeMetadataMap<? extends AttributeMetadataInterface> amdm,
+ Filter filter) throws Exception {
if (filter == null)
filter = Filter.INCLUDE;
@@ -171,8 +178,8 @@
* @param fs
* the feature source
* @param amd
- * {@link AttributeMetadataImpl}-Map to define the visible attributes
- * and translation
+ * {@link AttributeMetadataImpl}-Map to define the visible
+ * attributes and translation
*/
public void setStyledFeatures(StyledFeaturesInterface<?> styledFeatures) {
try {
@@ -210,12 +217,12 @@
// Pruefen, welche Attribute angezeigt werden
attrTypes.clear();
for (AttributeMetadataInterface amd : amdMapVisibleOnly) {
- Name name = amd.getName();
- AttributeDescriptor type = schema.getDescriptor(name);
- // if type can not be determined by complete name,
- // try only the local name
- if ( type == null )
- type = schema.getDescriptor(name.getLocalPart());
+ Name name = amd.getName();
+ AttributeDescriptor type = schema.getDescriptor(name);
+ // if type can not be determined by complete name,
+ // try only the local name
+ if (type == null)
+ type = schema.getDescriptor(name.getLocalPart());
if (attrFilter == null || attrFilter.accept(type))
attrTypes.add(type);
}
@@ -226,12 +233,12 @@
colClass = new Class[attrTypes.size()];
attrIdxForCol = new int[attrTypes.size()];
for (int i = 0; i < colNames.length; i++) {
- Name name = amdMapVisibleOnly.get(i).getName();
- AttributeDescriptor descriptor = schema.getDescriptor(name);
- // if type can not be determined by complete name,
- // try only the local name
- if ( descriptor == null )
- descriptor = schema.getDescriptor(name.getLocalPart());
+ Name name = amdMapVisibleOnly.get(i).getName();
+ AttributeDescriptor descriptor = schema.getDescriptor(name);
+ // if type can not be determined by complete name,
+ // try only the local name
+ if (descriptor == null)
+ descriptor = schema.getDescriptor(name.getLocalPart());
// Not so nice in 26: find the index of an attribute...
int idx = schema.getAttributeDescriptors().indexOf(descriptor);
More information about the Schmitzm-commits
mailing list