/[schmitzm]/branches/2.2.x/src/skrueger/AttributeMetadataInterface.java
ViewVC logotype

Diff of /branches/2.2.x/src/skrueger/AttributeMetadataInterface.java

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

trunk/src/skrueger/AttributeMetaData.java revision 2 by mojays, Tue Feb 24 22:43:52 2009 UTC trunk/src/skrueger/AttributeMetadataInterface.java revision 776 by alfonx, Sun Mar 28 10:06:00 2010 UTC
# Line 1  Line 1 
1  package skrueger;  package skrueger;
2    
3  import org.apache.log4j.Logger;  import java.util.HashSet;
4    
5  import skrueger.geotools.StyledMapInterface;  import org.geotools.feature.NameImpl;
6  import skrueger.i8n.Translation;  import org.opengis.feature.type.Name;
7    
8  /**  import skrueger.geotools.Copyable;
9   * This class holds meta information about an attribute/column. This  import skrueger.i8n.Translation;
10   * information is used by {@link StyledMapInterface}.  
11   *  public interface AttributeMetadataInterface extends Copyable<AttributeMetadataInterface>,
12   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>                  Comparable<AttributeMetadataInterface> {
13   */  
14  public class AttributeMetaData {          /**
15          static private final Logger LOGGER = Logger           * @return a translatable title for this attribute..
16                          .getLogger(AttributeMetaData.class);           */
17          protected Translation title = new Translation();          public Translation getTitle();
18          protected Translation desc = new Translation();  
19          protected boolean visible = false;          /**
20          protected String unit = "";           * Set a translatable title for this attribute..
21          protected int colIdx;           */
22            public void setTitle(Translation title);
23          /**          
24           * Creates an {@link AttributeMetaData} object with the following information          /**
25           * @param colIdx The column index of this attribute in the underlying table/dbf/etc...           * Set an untranslated title for this attribute or pass a {@link Translation} encryped as a {@link String}
26           * @param visible Shall this attribute be displayed or hidden from the user?           */
27           * @param title {@link Translation} for Name          public void setTitle(String title);
28           * @param desc {@link Translation} for an attribute description  
29           * @param unit {@link String} of the unit that the information is in          /**
30           */           * @return a translatable description for this attribute
31          public AttributeMetaData(final int colIdx, final Boolean visible,           */
32                          final Translation title, final Translation desc, final String unit) {          public Translation getDesc();
33            
34                  this.colIdx = colIdx;          /**
35                  this.title = title;           * Set a translatable description for this attribute.
36                  this.desc = desc;           */
37                  if (colIdx == 0){          public void setDesc(Translation desc);
38                          // The first attribut is THE_GEOM and shall never be visible!  
39                          this.visible = false;          /**
40                  }else           * Set an untranslated description for this attribute or pass a {@link Translation} encryped as a {@link String}  
41                          this.visible = visible;           */
42                  this.unit = unit;          public void setDesc(String desc);
43          }  
44    
45          /**          /**
46           * Creates a {@link AttributeMetaData} with default (no) values.           * The local name. E.g. the name of the DBF column as a {@link String}.
47           */           */
48          public AttributeMetaData(final Integer col, final String defaultName) {          public String getLocalName();
49                  this(col, true, new Translation(defaultName), new Translation(""), "");  
50          }          /**
51             * A short form for #setName(new NameImpl(localName))
52          public Boolean isVisible() {           */
53                  return visible;          public void setLocalName(String localName);
54          }  
55            /**
56          public void setVisible(final Boolean visible) {           * The fully qualified {@link Name} of the attribute, e.g.
57                  this.visible = visible;           * <code>org.bla.plo:blub</code>. The second part equals the
58          }           * {@link #getLocalName()} value. The first may be <code>null</code> or
59             * represent the layer name.
60          /** @return the index of this attribute in the underlying table/dbf **/           */
61          public int getColIdx() {          public NameImpl getName();
62                  return colIdx;  
63          }          /**
64             * set the fully qualified {@link Name} of this attribute.
65          public Translation getTitle() {           */
66                  return title;          public void setName(NameImpl name);
67          }  
68            /**
69          public void setTitle(final Translation title) {           * A list og objects that represent NODATA-values for this attribute. The
70                  this.title = title;           * objects are supporsed to be correctly casted already. That means that the
71          }           * NODATA objects listed here have must have the same type as the values of
72             * this object.
73          public Translation getDesc() {           */
74                  return desc;          public HashSet<Object> getNodataValues();
75          }  
76            /**
77          public void setDesc(final Translation desc) {           * Takes any value object and checks it against the NODATA values. If the
78                  this.desc = desc;           * value equals a NODATA value, <code>null</code> is returned. Otherwise the
79          }           * same object is returned.
80             *
81          public String getUnit() {           * Note: This method is called often.
82                  return unit;           */
83          }          public Object fiterNodata(Object value);
84    
85          public void setUnit(final String unit) {          /**
86                  this.unit = unit;           * @return a non-translatable unit {@link String} for this attribute values.
87          }           */
88  }          public String getUnit();
89    
90            /**
91             * Set a unit {@link String} for this attribute values.
92             */
93            public void setUnit(String unit);
94    
95            /**
96             * @return A value defining the position of this attribute whenever the
97             *         attributes are listed to an end-user. The higher the weight, the
98             *         lower the position. (heavy goes down, light goes up)
99             */
100            public double getWeight();
101    
102            /**
103             * set a value defining the position of this attribute whenever the
104             * attributes are listed to an end-user. The higher the weight, the lower
105             * the position. (heavy goes down, light goes up)
106             */
107            public void setWeight(double weight);
108    
109            /**
110             * @return <code>false</code> if this attribute should not be selectable or
111             *         shown to the end-user.
112             */
113            public boolean isVisible();
114    
115            /**
116             * Set <code>false</code> if this attribute should not be shown to the
117             * end-user.
118             */
119            public void setVisible(boolean visible);
120    
121            String getNoDataValuesFormatted();
122    
123    }

Legend:
Removed from v.2  
changed lines
  Added in v.776

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26