/[schmitzm]/trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/2.0-RC2/src/skrueger/geotools/StyledFeatureCollectionTableModel.java revision 681 by alfonx, Tue Feb 9 22:08:26 2010 UTC trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java revision 862 by alfonx, Sat May 22 01:24:46 2010 UTC
# Line 25  Line 25 
25   *   *
26   * Contributors:   * Contributors:
27   *     Martin O. J. Schmitz - initial API and implementation   *     Martin O. J. Schmitz - initial API and implementation
28   *     Stefan A. Krüger - additional utility classes   *     Stefan A. Tzeggai - additional utility classes
29   ******************************************************************************/   ******************************************************************************/
30  package skrueger.geotools;  package skrueger.geotools;
31    
# Line 45  import org.opengis.filter.Filter; Line 45  import org.opengis.filter.Filter;
45    
46  import schmitzm.geotools.feature.FeatureUtil;  import schmitzm.geotools.feature.FeatureUtil;
47  import schmitzm.geotools.gui.FeatureCollectionTableModel;  import schmitzm.geotools.gui.FeatureCollectionTableModel;
48  import skrueger.AttributeMetadata;  import skrueger.AttributeMetadataImpl;
49    import skrueger.AttributeMetadataInterface;
50    
51  import com.vividsolutions.jts.geom.Envelope;  import com.vividsolutions.jts.geom.Envelope;
52    
53  /**  /**
54   * This class extends the the {@link FeatureCollectionTableModel} with the   * This class extends the the {@link FeatureCollectionTableModel} with the
55   * functionalities of the {@link AttributeMetadata}.   * functionalities of the {@link AttributeMetadataImpl}.
56   * <ul>   * <ul>
57   * <li>column names are translated according to   * <li>column names are translated according to
58   * {@link AttributeMetadata#getTitle()}</li>   * {@link AttributeMetadataImpl#getTitle()}</li>
59   * <li>columns are hidden according to {@link AttributeMetaData#isVisible()()}</li>   * <li>columns are hidden according to {@link AttributeMetaData#isVisible()()}</li>
60   * <li>Any filter defined in the {@link StyledFeaturesInterface} will be   * <li>Any filter defined in the {@link StyledFeaturesInterface} will be
61   * applied.</li>   * applied.</li>
62   * </ul>   * </ul>
63   *   *
64   * @author Stefan A. Krüger   * @author Stefan A. Tzeggai
65   */   */
66  public class StyledFeatureCollectionTableModel extends  public class StyledFeatureCollectionTableModel extends
67                  FeatureCollectionTableModel {                  FeatureCollectionTableModel {
68          final static private Logger LOGGER = Logger          final static private Logger LOGGER = Logger
69                          .getLogger(StyledFeatureCollectionTableModel.class);                          .getLogger(StyledFeatureCollectionTableModel.class);
70          /** Contains the complete {@link AttributeMetadata}-Map of the styled layer. */          /** Contains the complete {@link AttributeMetadataImpl}-Map of the styled layer. */
71          protected AttributeMetadataMap amdMap = null;          protected AttributeMetadataMap<? extends AttributeMetadataInterface> amdMap = null;
72          /** Holds the current filter on the table */          /** Holds the current filter on the table */
73          protected Filter filter = null;          protected Filter filter = null;
74          /** Holds the Bounds for all features. Only set once during the constructor **/          /** Holds the Bounds for all features. Only set once during the constructor **/
# Line 79  public class StyledFeatureCollectionTabl Line 80  public class StyledFeatureCollectionTabl
80          protected String[] colTooltips = null;          protected String[] colTooltips = null;
81    
82          /** A cache for the #sortedValuesVisibleOnly() **/          /** A cache for the #sortedValuesVisibleOnly() **/
83          protected List<AttributeMetadata> amdMapVisibleOnly = null;          protected List<? extends AttributeMetadataInterface> amdMapVisibleOnly = null;
84    
85          /**          /**
86           * Creates a new table model for a styled layer.           * Creates a new table model for a styled layer.
# Line 96  public class StyledFeatureCollectionTabl Line 97  public class StyledFeatureCollectionTabl
97    
98          /**          /**
99           * This overwritten method filters the values for NODATA-values defined in           * This overwritten method filters the values for NODATA-values defined in
100           * the {@link AttributeMetadata}           * the {@link AttributeMetadataImpl}
101           */           */
102          @Override          @Override
103          public Object getValueAt(int row, int col) {          public Object getValueAt(int row, int col) {
# Line 110  public class StyledFeatureCollectionTabl Line 111  public class StyledFeatureCollectionTabl
111           * @param fs           * @param fs
112           *            the feature source           *            the feature source
113           * @param amdm           * @param amdm
114           *            {@link AttributeMetadata}-Map to define the visible attributes           *            {@link AttributeMetadataImpl}-Map to define the visible attributes
115           *            and translation           *            and translation
116           */           */
117          protected void setFeatureSource(          protected void setFeatureSource(
118                          FeatureSource<SimpleFeatureType, SimpleFeature> fs,                          FeatureSource<SimpleFeatureType, SimpleFeature> fs,
119                          AttributeMetadataMap amdm, Filter filter) throws Exception {                          AttributeMetadataMap<? extends AttributeMetadataInterface> amdm, Filter filter) throws Exception {
120    
121                  if (filter == null)                  if (filter == null)
122                          filter = Filter.INCLUDE;                          filter = Filter.INCLUDE;
# Line 140  public class StyledFeatureCollectionTabl Line 141  public class StyledFeatureCollectionTabl
141                                                  .getLocalName());                                                  .getLocalName());
142    
143                                  // Add other visible attributes as ordered by weights                                  // Add other visible attributes as ordered by weights
144                                  for (AttributeMetadata a : amdMapVisibleOnly) {                                  for (AttributeMetadataInterface a : amdMapVisibleOnly) {
145                                          visibleAttrNames.add(a.getLocalName());                                          visibleAttrNames.add(a.getLocalName());
146                                  }                                  }
147    
# Line 169  public class StyledFeatureCollectionTabl Line 170  public class StyledFeatureCollectionTabl
170           * @param fs           * @param fs
171           *            the feature source           *            the feature source
172           * @param amd           * @param amd
173           *            {@link AttributeMetadata}-Map to define the visible attributes           *            {@link AttributeMetadataImpl}-Map to define the visible attributes
174           *            and translation           *            and translation
175           */           */
176          public void setStyledFeatures(StyledFeaturesInterface<?> styledFeatures) {          public void setStyledFeatures(StyledFeaturesInterface<?> styledFeatures) {
# Line 207  public class StyledFeatureCollectionTabl Line 208  public class StyledFeatureCollectionTabl
208                          SimpleFeatureType schema = featureArray[0].getFeatureType();                          SimpleFeatureType schema = featureArray[0].getFeatureType();
209                          // Pruefen, welche Attribute angezeigt werden                          // Pruefen, welche Attribute angezeigt werden
210                          attrTypes.clear();                          attrTypes.clear();
211                          for (AttributeMetadata amd : amdMapVisibleOnly) {                          for (AttributeMetadataInterface amd : amdMapVisibleOnly) {
212                                  AttributeDescriptor type = schema.getDescriptor(amd.getName());                                  AttributeDescriptor type = schema.getDescriptor(amd.getName());
213                                  if (attrFilter == null || attrFilter.accept(type))                                  if (attrFilter == null || attrFilter.accept(type))
214                                          attrTypes.add(type);                                          attrTypes.add(type);
# Line 229  public class StyledFeatureCollectionTabl Line 230  public class StyledFeatureCollectionTabl
230                                  String attName = schema.getAttributeDescriptors().get(idx)                                  String attName = schema.getAttributeDescriptors().get(idx)
231                                                  .getLocalName();                                                  .getLocalName();
232                                  colNames[i] = amdMap.get(attName).getTitle().toString();                                  colNames[i] = amdMap.get(attName).getTitle().toString();
233                                  AttributeMetadata amd = amdMap.get(attName);                                  AttributeMetadataInterface amd = amdMap.get(attName);
234                                  colTooltips[i] = "<html>" + amd.getDesc().toString() + "<br>"                                  colTooltips[i] = "<html>" + amd.getDesc().toString() + "<br>"
235                                                  + amd.getName() + "</html>";                                                  + amd.getName() + "</html>";
236                                  colClass[i] = schema.getAttributeDescriptors().get(idx)                                  colClass[i] = schema.getAttributeDescriptors().get(idx)

Legend:
Removed from v.681  
changed lines
  Added in v.862

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26