31 |
|
|
32 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
33 |
|
|
34 |
|
import skrueger.geotools.Copyable; |
35 |
import skrueger.geotools.StyledLayerInterface; |
import skrueger.geotools.StyledLayerInterface; |
36 |
import skrueger.i8n.Translation; |
import skrueger.i8n.Translation; |
37 |
|
|
41 |
* |
* |
42 |
* @author <a href="mailto:[email protected]">Stefan Alfons Krüger</a> |
* @author <a href="mailto:[email protected]">Stefan Alfons Krüger</a> |
43 |
*/ |
*/ |
44 |
public class AttributeMetaData { |
public class AttributeMetaData implements Copyable<AttributeMetaData>{ |
45 |
static private final Logger LOGGER = Logger |
static private final Logger LOGGER = Logger |
46 |
.getLogger(AttributeMetaData.class); |
.getLogger(AttributeMetaData.class); |
47 |
protected Translation title = new Translation(); |
protected Translation title = new Translation(); |
49 |
protected boolean visible = false; |
protected boolean visible = false; |
50 |
protected String unit = ""; |
protected String unit = ""; |
51 |
protected int colIdx; |
protected int colIdx; |
52 |
|
|
53 |
/** |
/** |
54 |
* Creates an {@link AttributeMetaData} object with the following information |
* Creates an {@link AttributeMetaData} object with the following information |
55 |
* @param colIdx The column index of this attribute in the underlying table/dbf/etc... |
* @param colIdx The column index of this attribute in the underlying table/dbf/etc... |
65 |
this.title = title; |
this.title = title; |
66 |
this.desc = desc; |
this.desc = desc; |
67 |
if (colIdx == 0){ |
if (colIdx == 0){ |
68 |
// The first attribut is THE_GEOM and shall never be visible! |
// The first attribute is THE_GEOM and shall never be visible! |
69 |
this.visible = false; |
this.visible = false; |
70 |
}else |
}else |
71 |
this.visible = visible; |
this.visible = visible; |
79 |
this(col, true, new Translation(defaultName), new Translation(), ""); |
this(col, true, new Translation(defaultName), new Translation(), ""); |
80 |
} |
} |
81 |
|
|
82 |
public Boolean isVisible() { |
/** Only used for {@link Copyable<AttributeMetaData>#copy()}**/ |
83 |
|
private AttributeMetaData() { |
84 |
|
} |
85 |
|
|
86 |
|
public boolean isVisible() { |
87 |
return visible; |
return visible; |
88 |
} |
} |
89 |
|
|
119 |
public void setUnit(final String unit) { |
public void setUnit(final String unit) { |
120 |
this.unit = unit; |
this.unit = unit; |
121 |
} |
} |
122 |
|
|
123 |
|
@Override |
124 |
|
public AttributeMetaData copyTo(AttributeMetaData amd) { |
125 |
|
getTitle().copyTo(amd.getTitle()); |
126 |
|
getDesc().copyTo(amd.getDesc()); |
127 |
|
amd.setUnit(getUnit()); |
128 |
|
amd.setVisible(isVisible()); |
129 |
|
amd.setColIdx(getColIdx()); |
130 |
|
|
131 |
|
return amd; |
132 |
|
} |
133 |
|
|
134 |
|
@Override |
135 |
|
public AttributeMetaData copy() { |
136 |
|
AttributeMetaData amd = new AttributeMetaData(); |
137 |
|
getTitle().copyTo(amd.getTitle()); |
138 |
|
getDesc().copyTo(amd.getDesc()); |
139 |
|
amd.setUnit(getUnit()); |
140 |
|
amd.setVisible(isVisible()); |
141 |
|
amd.setColIdx(getColIdx()); |
142 |
|
|
143 |
|
return amd; |
144 |
|
} |
145 |
|
|
146 |
|
private void setColIdx(int colIdx_) { |
147 |
|
colIdx = colIdx_; |
148 |
|
} |
149 |
} |
} |