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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26