/[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

revision 52 by mojays, Fri Apr 17 13:57:14 2009 UTC revision 55 by mojays, Fri Apr 17 14:26:14 2009 UTC
# Line 24  import org.opengis.filter.Filter; Line 24  import org.opengis.filter.Filter;
24    
25  import schmitzm.geotools.gui.FeatureCollectionTableModel;  import schmitzm.geotools.gui.FeatureCollectionTableModel;
26  import skrueger.AttributeMetaData;  import skrueger.AttributeMetaData;
27    import skrueger.i8n.I8NUtil;
28    import skrueger.i8n.Translation;
29    
30    
31  /**  /**
32   * This class extends the   * This class extends the the {@link FeatureCollectionTableModel} with the
33     * functionalities of the {@link AttributeMetaData} of {@linkplain StyledMapInterface styled objects}.
34     * <ul>
35     *   <li>column names are translated according to {@link AttributeMetaData#getTitle()}</li>
36     *   <li>columns are hidden according to {@link AttributeMetaData#isVisible()()}</li>
37     * </ul>
38   * @author <a href="mailto:[email protected]">Martin Schmitz</a> (University of Bonn/Germany)   * @author <a href="mailto:[email protected]">Martin Schmitz</a> (University of Bonn/Germany)
39   *   *
40   */   */
# Line 47  public class StyledFeatureCollectionTabl Line 54  public class StyledFeatureCollectionTabl
54        
55    protected void setFeatureSource(FeatureSource fs, Map<Integer,AttributeMetaData> amd) throws Exception {    protected void setFeatureSource(FeatureSource fs, Map<Integer,AttributeMetaData> amd) throws Exception {
56      FeatureCollection fc = null;      FeatureCollection fc = null;
57      this.visibleAMD      = new TreeMap<Integer, AttributeMetaData>();      this.visibleAMD      = null;
58      if ( fs != null ) {      if ( fs != null ) {
59        Query query = new DefaultQuery();        Query query = new DefaultQuery();
60        if ( amd != null ) {        if ( amd != null ) {
# Line 98  public class StyledFeatureCollectionTabl Line 105  public class StyledFeatureCollectionTabl
105    public void reorganize() {    public void reorganize() {
106      super.reorganize();      super.reorganize();
107      // translate the column names      // translate the column names
108      Iterator<Integer> keys = visibleAMD.keySet().iterator();      if ( visibleAMD != null ) {
109      for (int i=0; keys.hasNext(); i++)        Iterator<Integer> keys = visibleAMD.keySet().iterator();
110        colNames[i] = visibleAMD.get( keys.next() ).getTitle().toString();        for (int i=0; i<colNames.length && keys.hasNext(); i++) {
111            Translation title = visibleAMD.get( keys.next() ).getTitle();
112            if ( !I8NUtil.isEmpty(title) )
113              colNames[i] = title.toString();
114          }
115        }
116    }    }
   
117  }  }

Legend:
Removed from v.52  
changed lines
  Added in v.55

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26