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

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

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

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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26