/[schmitzm]/trunk/src/skrueger/AttributeMetadataInterface.java
ViewVC logotype

Diff of /trunk/src/skrueger/AttributeMetadataInterface.java

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

branches/1.0-gt2-2.6/src/skrueger/AttributeMetaData.java revision 320 by mojays, Wed Aug 26 13:49:19 2009 UTC trunk/src/skrueger/AttributeMetadata.java revision 769 by alfonx, Sun Mar 21 11:02:34 2010 UTC
# Line 1  Line 1 
 /*******************************************************************************  
  * Copyright (c) 2009 Martin O. J. Schmitz.  
  *  
  * This file is part of the SCHMITZM library - a collection of utility  
  * classes based on Java 1.6, focusing (not only) on Java Swing  
  * and the Geotools library.  
  *  
  * The SCHMITZM project is hosted at:  
  * http://wald.intevation.org/projects/schmitzm/  
  *  
  * This program is free software; you can redistribute it and/or  
  * modify it under the terms of the GNU Lesser General Public License  
  * as published by the Free Software Foundation; either version 3  
  * of the License, or (at your option) any later version.  
  *  
  * This program is distributed in the hope that it will be useful,  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.  
  *  
  * You should have received a copy of the GNU Lesser General Public License (license.txt)  
  * along with this program; if not, write to the Free Software  
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.  
  * or try this link: http://www.gnu.org/licenses/lgpl.html  
  *  
  * Contributors:  
  *     Martin O. J. Schmitz - initial API and implementation  
  *     Stefan A. Krüger - additional utility classes  
  ******************************************************************************/  
1  package skrueger;  package skrueger;
2    
3  import org.apache.log4j.Logger;  import java.util.HashSet;
4    
5    import org.opengis.feature.type.Name;
6    
7    import skrueger.geotools.Copyable;
8  import skrueger.i8n.Translation;  import skrueger.i8n.Translation;
9    
10  /**  public interface AttributeMetadata extends Copyable<AttributeMetadata>,
11   * This class holds meta information about an attribute/column. This                  Comparable<AttributeMetadata> {
12   * information is used by {@link StyledLayerInterface}.  
13   *          /**
14   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>           * @return a translatable title for this attribute..
15   */           */
16  public class AttributeMetaData {          public Translation getTitle();
17          static private final Logger LOGGER = Logger  
18                          .getLogger(AttributeMetaData.class);          /**
19          protected Translation title = new Translation();           * Set a translatable title for this attribute..
20          protected Translation desc = new Translation();           */
21          protected boolean visible = false;          public void setTitle(Translation title);
22          protected String unit = "";  
23          protected int colIdx;          /**
24             * @return a translatable description for this attribute
25          /**           */
26           * Creates an {@link AttributeMetaData} object with the following information          public Translation getDesc();
27           * @param colIdx The column index of this attribute in the underlying table/dbf/etc...  
28           * @param visible Shall this attribute be displayed or hidden from the user?          /**
29           * @param title {@link Translation} for Name           * Set a translatable description for this attribute.
30           * @param desc {@link Translation} for an attribute description           */
31           * @param unit {@link String} of the unit that the information is in          public void setDesc(Translation desc);
32           */  
33          public AttributeMetaData(final int colIdx, final Boolean visible,          /**
34                          final Translation title, final Translation desc, final String unit) {           * The local name. E.g. the name of the DBF column as a {@link String}.
35                     */
36                  this.colIdx = colIdx;          public String getLocalName();
37                  this.title = title;  
38                  this.desc = desc;          /**
39                  if (colIdx == 0){           * A short form for #setName(new NameImpl(localName))
40                          // The first attribute is THE_GEOM and shall never be visible!           */
41                          this.visible = false;          public void setLocalName(String localName);
42                  }else  
43                          this.visible = visible;          /**
44                  this.unit = unit;           * The fully qualified {@link Name} of the attribute, e.g.
45          }           * <code>org.bla.plo:blub</code>. The second part equals the
46             * {@link #getLocalName()} value. The first may be <code>null</code> or
47          /**           * represent the layer name.
48           * Creates a new visible {@link AttributeMetaData} with default (no) values.             */
49           */          public Name getName();
50          public AttributeMetaData(final Integer col, final String defaultName) {  
51                  this(col, true, new Translation(defaultName), new Translation(), "");          /**
52          }           * set the fully qualified {@link Name} of this attribute.
53             */
54          public Boolean isVisible() {          public void setName(Name name);
55                  return visible;  
56          }          /**
57             * A list og objects that represent NODATA-values for this attribute. The
58          public void setVisible(final Boolean visible) {           * objects are supporsed to be correctly casted already. That means that the
59                  this.visible = visible;           * NODATA objects listed here have must have the same type as the values of
60          }           * this object.
61             */
62          /** @return the index of this attribute in the underlying table/dbf **/          public HashSet<Object> getNodataValues();
63          public int getColIdx() {  
64                  return colIdx;          /**
65          }           * Takes any value object and checks it against the NODATA values. If the
66             * value equals a NODATA value, <code>null</code> is returned. Otherwise the
67          public Translation getTitle() {           * same object is returned.
68                  return title;           *
69          }           * Note: This method is called often.
70             */
71          public void setTitle(final Translation title) {          public Object fiterNodata(Object value);
72                  this.title = title;  
73          }          /**
74             * @return a non-translatable unit {@link String} for this attribute values.
75          public Translation getDesc() {           */
76                  return desc;          public String getUnit();
77          }  
78            /**
79          public void setDesc(final Translation desc) {           * Set a unit {@link String} for this attribute values.
80                  this.desc = desc;           */
81          }          public void setUnit(String unit);
82    
83          public String getUnit() {          /**
84                  return unit;           * @return A value defining the position of this attribute whenever the
85          }           *         attributes are listed to an end-user. The higher the weight, the
86             *         lower the position. (heavy goes down, light goes up)
87          public void setUnit(final String unit) {           */
88                  this.unit = unit;          public double getWeight();
89          }  
90            /**
91             * set a value defining the position of this attribute whenever the
92             * attributes are listed to an end-user. The higher the weight, the lower
93             * the position. (heavy goes down, light goes up)
94             */
95            public void setWeight(double weight);
96    
97            /**
98             * @return <code>false</code> if this attribute should not be selectable or
99             *         shown to the end-user.
100             */
101            public boolean isVisible();
102    
103            /**
104             * Set <code>false</code> if this attribute should not be shown to the
105             * end-user.
106             */
107            public void setVisible(boolean visible);
108    
109            String getNoDataValuesFormatted();
110    
111  }  }

Legend:
Removed from v.320  
changed lines
  Added in v.769

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26