35 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
36 |
import org.geotools.feature.NameImpl; |
import org.geotools.feature.NameImpl; |
37 |
import org.opengis.feature.type.AttributeDescriptor; |
import org.opengis.feature.type.AttributeDescriptor; |
|
import org.opengis.feature.type.Name; |
|
38 |
|
|
39 |
import skrueger.geotools.Copyable; |
import skrueger.geotools.Copyable; |
40 |
import skrueger.geotools.StyledLayerInterface; |
import skrueger.geotools.StyledLayerInterface; |
71 |
|
|
72 |
public AttributeMetadataImpl(final AttributeDescriptor attDesc, |
public AttributeMetadataImpl(final AttributeDescriptor attDesc, |
73 |
final int weight, final List<String> langs) { |
final int weight, final List<String> langs) { |
74 |
this(attDesc.getName(), langs); |
this( new NameImpl(attDesc.getName().getNamespaceURI(), attDesc.getName().getLocalPart()), langs); |
75 |
setWeight(weight); |
setWeight(weight); |
76 |
} |
} |
77 |
|
|
78 |
public AttributeMetadataImpl(final AttributeDescriptor attDesc, |
public AttributeMetadataImpl(final AttributeDescriptor attDesc, |
79 |
final List<String> langs) { |
final List<String> langs) { |
80 |
this(attDesc.getName(), langs); |
this(new NameImpl(attDesc.getName().getNamespaceURI(), attDesc.getName().getLocalPart()), langs); |
81 |
} |
} |
82 |
|
|
83 |
/** |
/** |
96 |
* @param unit |
* @param unit |
97 |
* {@link String} of the unit that the information is in |
* {@link String} of the unit that the information is in |
98 |
*/ |
*/ |
99 |
public AttributeMetadataImpl(final Name name, final Boolean visible, |
public AttributeMetadataImpl(final NameImpl name, final Boolean visible, |
100 |
final Translation title, final Translation desc, final String unit) { |
final Translation title, final Translation desc, final String unit) { |
101 |
|
|
102 |
this.setName(name); |
this.setName(name); |
118 |
* @param unit |
* @param unit |
119 |
* {@link String} of the unit that the information is in |
* {@link String} of the unit that the information is in |
120 |
*/ |
*/ |
121 |
public AttributeMetadataImpl(final Name name, final Boolean visible, |
public AttributeMetadataImpl(final NameImpl name, final Boolean visible, |
122 |
final String unit) { |
final String unit) { |
123 |
this.setName(name); |
this.setName(name); |
124 |
this.visible = visible; |
this.visible = visible; |
128 |
/** |
/** |
129 |
* Creates a new visible {@link AttributeMetadataImpl} |
* Creates a new visible {@link AttributeMetadataImpl} |
130 |
*/ |
*/ |
131 |
public AttributeMetadataImpl(final Name name, final List<String> langs) { |
public AttributeMetadataImpl(final NameImpl name, final List<String> langs) { |
132 |
this(name, true, new Translation(langs, name.getLocalPart()), |
this(name, true, new Translation(langs, name.getLocalPart()), |
133 |
new Translation(), ""); |
new Translation(), ""); |
134 |
} |
} |
136 |
/** |
/** |
137 |
* Creates a new visible {@link AttributeMetadataImpl} |
* Creates a new visible {@link AttributeMetadataImpl} |
138 |
*/ |
*/ |
139 |
public AttributeMetadataImpl(final Name name, final String defaultTitle, |
public AttributeMetadataImpl(final NameImpl name, final String defaultTitle, |
140 |
final List<String> langs) { |
final List<String> langs) { |
141 |
this(name, true, new Translation(langs, defaultTitle), |
this(name, true, new Translation(langs, defaultTitle), |
142 |
new Translation(), ""); |
new Translation(), ""); |
184 |
* further down. |
* further down. |
185 |
*/ |
*/ |
186 |
@Override |
@Override |
187 |
public int compareTo(final AttributeMetadata atm2) { |
public int compareTo(final AttributeMetadataInterface atm2) { |
188 |
return new Integer(weight).compareTo(new Double(atm2.getWeight()) |
return new Integer(weight).compareTo(new Double(atm2.getWeight()) |
189 |
.intValue()); |
.intValue()); |
190 |
} |
} |
193 |
* @see Copyable inferface |
* @see Copyable inferface |
194 |
*/ |
*/ |
195 |
@Override |
@Override |
196 |
public AttributeMetadata copy() { |
public AttributeMetadataInterface copy() { |
197 |
return copyTo(new AttributeMetadataImpl()); |
return copyTo(new AttributeMetadataImpl()); |
198 |
} |
} |
199 |
|
|
201 |
* @see Copyable inferface |
* @see Copyable inferface |
202 |
*/ |
*/ |
203 |
@Override |
@Override |
204 |
public AttributeMetadata copyTo(final AttributeMetadata amd) { |
public AttributeMetadataInterface copyTo(final AttributeMetadataInterface amd) { |
205 |
getTitle().copyTo(amd.getTitle()); |
getTitle().copyTo(amd.getTitle()); |
206 |
getDesc().copyTo(amd.getDesc()); |
getDesc().copyTo(amd.getDesc()); |
207 |
amd.setUnit(getUnit()); |
amd.setUnit(getUnit()); |