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

revision 304 by alfonx, Wed Aug 19 12:03:12 2009 UTC revision 770 by alfonx, Sun Mar 21 11:36:11 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 skrueger.geotools.StyledLayerInterface;  import org.geotools.feature.NameImpl;
6    import org.opengis.feature.type.Name;
7    
8    import skrueger.geotools.Copyable;
9  import skrueger.i8n.Translation;  import skrueger.i8n.Translation;
10    
11  /**  public interface AttributeMetadata extends Copyable<AttributeMetadata>,
12   * This class holds meta information about an attribute/column. This                  Comparable<AttributeMetadata> {
13   * information is used by {@link StyledLayerInterface}.  
14   *          /**
15   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>           * @return a translatable title for this attribute..
16   */           */
17  public class AttributeMetaData {          public Translation getTitle();
18          static private final Logger LOGGER = Logger  
19                          .getLogger(AttributeMetaData.class);          /**
20          protected Translation title = new Translation();           * Set a translatable title for this attribute..
21          protected Translation desc = new Translation();           */
22          protected boolean visible = false;          public void setTitle(Translation title);
23          protected String unit = "";  
24          protected int colIdx;          /**
25             * @return a translatable description for this attribute
26          /**           */
27           * Creates an {@link AttributeMetaData} object with the following information          public Translation getDesc();
28           * @param colIdx The column index of this attribute in the underlying table/dbf/etc...  
29           * @param visible Shall this attribute be displayed or hidden from the user?          /**
30           * @param title {@link Translation} for Name           * Set a translatable description for this attribute.
31           * @param desc {@link Translation} for an attribute description           */
32           * @param unit {@link String} of the unit that the information is in          public void setDesc(Translation desc);
33           */  
34          public AttributeMetaData(final int colIdx, final Boolean visible,          /**
35                          final Translation title, final Translation desc, final String unit) {           * The local name. E.g. the name of the DBF column as a {@link String}.
36                     */
37                  this.colIdx = colIdx;          public String getLocalName();
38                  this.title = title;  
39                  this.desc = desc;          /**
40                  if (colIdx == 0){           * A short form for #setName(new NameImpl(localName))
41                          // The first attribute is THE_GEOM and shall never be visible!           */
42                          this.visible = false;          public void setLocalName(String localName);
43                  }else  
44                          this.visible = visible;          /**
45                  this.unit = unit;           * The fully qualified {@link Name} of the attribute, e.g.
46          }           * <code>org.bla.plo:blub</code>. The second part equals the
47             * {@link #getLocalName()} value. The first may be <code>null</code> or
48          /**           * represent the layer name.
49           * Creates a new visible {@link AttributeMetaData} with default (no) values.             */
50           */          public NameImpl getName();
51          public AttributeMetaData(final Integer col, final String defaultName) {  
52                  this(col, true, new Translation(defaultName), new Translation(), "");          /**
53          }           * set the fully qualified {@link Name} of this attribute.
54             */
55          public Boolean isVisible() {          public void setName(NameImpl name);
56                  return visible;  
57          }          /**
58             * A list og objects that represent NODATA-values for this attribute. The
59          public void setVisible(final Boolean visible) {           * objects are supporsed to be correctly casted already. That means that the
60                  this.visible = visible;           * NODATA objects listed here have must have the same type as the values of
61          }           * this object.
62             */
63          /** @return the index of this attribute in the underlying table/dbf **/          public HashSet<Object> getNodataValues();
64          public int getColIdx() {  
65                  return colIdx;          /**
66          }           * 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          public Translation getTitle() {           * same object is returned.
69                  return title;           *
70          }           * Note: This method is called often.
71             */
72          public void setTitle(final Translation title) {          public Object fiterNodata(Object value);
73                  this.title = title;  
74          }          /**
75             * @return a non-translatable unit {@link String} for this attribute values.
76          public Translation getDesc() {           */
77                  return desc;          public String getUnit();
78          }  
79            /**
80          public void setDesc(final Translation desc) {           * Set a unit {@link String} for this attribute values.
81                  this.desc = desc;           */
82          }          public void setUnit(String unit);
83    
84          public String getUnit() {          /**
85                  return unit;           * @return A value defining the position of this attribute whenever the
86          }           *         attributes are listed to an end-user. The higher the weight, the
87             *         lower the position. (heavy goes down, light goes up)
88          public void setUnit(final String unit) {           */
89                  this.unit = unit;          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.304  
changed lines
  Added in v.770

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26