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

Diff of /trunk/src/skrueger/AttributeMetadataImpl.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 branches/1.0-gt2-2.6/src/skrueger/AttributeMetaData.java revision 320 by mojays, Wed Aug 26 13:49:19 2009 UTC
# Line 1  Line 1 
1  package skrueger;  /*******************************************************************************
2     * Copyright (c) 2009 Martin O. J. Schmitz.
3  import org.apache.log4j.Logger;   *
4     * This file is part of the SCHMITZM library - a collection of utility
5  import skrueger.geotools.StyledMapInterface;   * classes based on Java 1.6, focusing (not only) on Java Swing
6  import skrueger.i8n.Translation;   * and the Geotools library.
7     *
8  /**   * The SCHMITZM project is hosted at:
9   * This class holds meta information about an attribute/column. This   * http://wald.intevation.org/projects/schmitzm/
10   * information is used by {@link StyledMapInterface}.   *
11   *   * This program is free software; you can redistribute it and/or
12   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>   * modify it under the terms of the GNU Lesser General Public License
13   */   * as published by the Free Software Foundation; either version 3
14  public class AttributeMetaData {   * of the License, or (at your option) any later version.
15          static private final Logger LOGGER = Logger   *
16                          .getLogger(AttributeMetaData.class);   * This program is distributed in the hope that it will be useful,
17          protected Translation title = new Translation();   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18          protected Translation desc = new Translation();   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19          protected boolean visible = false;   * GNU General Public License for more details.
20          protected String unit = "";   *
21          protected int colIdx;   * You should have received a copy of the GNU Lesser General Public License (license.txt)
22     * along with this program; if not, write to the Free Software
23          /**   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24           * Creates an {@link AttributeMetaData} object with the following information   * or try this link: http://www.gnu.org/licenses/lgpl.html
25           * @param colIdx The column index of this attribute in the underlying table/dbf/etc...   *
26           * @param visible Shall this attribute be displayed or hidden from the user?   * Contributors:
27           * @param title {@link Translation} for Name   *     Martin O. J. Schmitz - initial API and implementation
28           * @param desc {@link Translation} for an attribute description   *     Stefan A. Krüger - additional utility classes
29           * @param unit {@link String} of the unit that the information is in   ******************************************************************************/
30           */  package skrueger;
31          public AttributeMetaData(final int colIdx, final Boolean visible,  
32                          final Translation title, final Translation desc, final String unit) {  import org.apache.log4j.Logger;
33            
34                  this.colIdx = colIdx;  import skrueger.i8n.Translation;
35                  this.title = title;  
36                  this.desc = desc;  /**
37                  if (colIdx == 0){   * This class holds meta information about an attribute/column. This
38                          // The first attribut is THE_GEOM and shall never be visible!   * information is used by {@link StyledLayerInterface}.
39                          this.visible = false;   *
40                  }else   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>
41                          this.visible = visible;   */
42                  this.unit = unit;  public class AttributeMetaData {
43          }          static private final Logger LOGGER = Logger
44                            .getLogger(AttributeMetaData.class);
45          /**          protected Translation title = new Translation();
46           * Creates a {@link AttributeMetaData} with default (no) values.          protected Translation desc = new Translation();
47           */          protected boolean visible = false;
48          public AttributeMetaData(final Integer col, final String defaultName) {          protected String unit = "";
49                  this(col, true, new Translation(defaultName), new Translation(""), "");          protected int colIdx;
50          }  
51            /**
52          public Boolean isVisible() {           * Creates an {@link AttributeMetaData} object with the following information
53                  return visible;           * @param colIdx The column index of this attribute in the underlying table/dbf/etc...
54          }           * @param visible Shall this attribute be displayed or hidden from the user?
55             * @param title {@link Translation} for Name
56          public void setVisible(final Boolean visible) {           * @param desc {@link Translation} for an attribute description
57                  this.visible = visible;           * @param unit {@link String} of the unit that the information is in
58          }           */
59            public AttributeMetaData(final int colIdx, final Boolean visible,
60          /** @return the index of this attribute in the underlying table/dbf **/                          final Translation title, final Translation desc, final String unit) {
61          public int getColIdx() {          
62                  return colIdx;                  this.colIdx = colIdx;
63          }                  this.title = title;
64                    this.desc = desc;
65          public Translation getTitle() {                  if (colIdx == 0){
66                  return title;                          // The first attribute is THE_GEOM and shall never be visible!
67          }                          this.visible = false;
68                    }else
69          public void setTitle(final Translation title) {                          this.visible = visible;
70                  this.title = title;                  this.unit = unit;
71          }          }
72    
73          public Translation getDesc() {          /**
74                  return desc;           * Creates a new visible {@link AttributeMetaData} with default (no) values.  
75          }           */
76            public AttributeMetaData(final Integer col, final String defaultName) {
77          public void setDesc(final Translation desc) {                  this(col, true, new Translation(defaultName), new Translation(), "");
78                  this.desc = desc;          }
79          }  
80            public Boolean isVisible() {
81          public String getUnit() {                  return visible;
82                  return unit;          }
83          }  
84            public void setVisible(final Boolean visible) {
85          public void setUnit(final String unit) {                  this.visible = visible;
86                  this.unit = unit;          }
87          }  
88  }          /** @return the index of this attribute in the underlying table/dbf **/
89            public int getColIdx() {
90                    return colIdx;
91            }
92    
93            public Translation getTitle() {
94                    return title;
95            }
96    
97            public void setTitle(final Translation title) {
98                    this.title = title;
99            }
100    
101            public Translation getDesc() {
102                    return desc;
103            }
104    
105            public void setDesc(final Translation desc) {
106                    this.desc = desc;
107            }
108    
109            public String getUnit() {
110                    return unit;
111            }
112    
113            public void setUnit(final String unit) {
114                    this.unit = unit;
115            }
116    }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26