Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedDomFacet.java @ 1636:c2edf0032cf8
Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
flys-artifacts/trunk@2819 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 23 Sep 2011 11:58:08 +0000 |
parents | 59ae2a823e73 |
children | 866c1f37f2bd |
comparison
equal
deleted
inserted
replaced
1635:1b5204203e18 | 1636:c2edf0032cf8 |
---|---|
2 | 2 |
3 import org.w3c.dom.Document; | 3 import org.w3c.dom.Document; |
4 import org.w3c.dom.Element; | 4 import org.w3c.dom.Element; |
5 import org.w3c.dom.Node; | 5 import org.w3c.dom.Node; |
6 | 6 |
7 import de.intevation.artifacts.common.utils.XMLUtils; | |
8 | |
7 import de.intevation.artifacts.ArtifactNamespaceContext; | 9 import de.intevation.artifacts.ArtifactNamespaceContext; |
8 | 10 |
9 | 11 |
12 /** | |
13 * Use an Element (DOM) to store the information about a facet. | |
14 * The intent of this facet type is to represent a facet | |
15 * stored in an Collection attribute. Different facets can have different | |
16 * attributes that we need to parse, but the only thing ManagedFacets need | |
17 * to do, is to adjust the attributes "active" and "position". So, those | |
18 * values are set directly on the Element, the other attributes aren't | |
19 * touched. | |
20 */ | |
10 public class ManagedDomFacet extends ManagedFacet { | 21 public class ManagedDomFacet extends ManagedFacet { |
11 | 22 |
12 protected Element facet; | 23 protected Element facet; |
13 | 24 |
14 | 25 |
62 | 73 |
63 @Override | 74 @Override |
64 public int getPosition() { | 75 public int getPosition() { |
65 if (this.position < 0) { | 76 if (this.position < 0) { |
66 String position = facet.getAttributeNS( | 77 String position = facet.getAttributeNS( |
67 ArtifactNamespaceContext.NAMESPACE_URI, "pos"); | 78 ArtifactNamespaceContext.NAMESPACE_URI, |
79 ArtifactNamespaceContext.NAMESPACE_PREFIX + ":" + "pos"); | |
68 | 80 |
69 if (position != null && position.length() > 0) { | 81 if (position != null && position.length() > 0) { |
70 this.position = Integer.parseInt(position); | 82 this.position = Integer.parseInt(position); |
71 } | 83 } |
72 } | 84 } |
77 | 89 |
78 @Override | 90 @Override |
79 public void setPosition(int position) { | 91 public void setPosition(int position) { |
80 this.position = position; | 92 this.position = position; |
81 | 93 |
94 // TODO Evaluate whether other set/getAttributes also need | |
95 // to use the NAMESPACE_PREFIX. | |
82 facet.setAttributeNS( | 96 facet.setAttributeNS( |
83 ArtifactNamespaceContext.NAMESPACE_URI, | 97 ArtifactNamespaceContext.NAMESPACE_URI, |
84 "pos", | 98 ArtifactNamespaceContext.NAMESPACE_PREFIX + ":" + "pos", |
85 String.valueOf(position)); | 99 String.valueOf(position)); |
86 } | 100 } |
87 | 101 |
88 | 102 |
89 @Override | 103 @Override |