Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/VisibleAttribute.java @ 1986:3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
flys-artifacts/trunk@3418 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 14 Dec 2011 14:17:31 +0000 |
parents | |
children | 382e38164200 |
comparison
equal
deleted
inserted
replaced
1985:07b176b14205 | 1986:3632150dbe0b |
---|---|
1 package de.intevation.flys.exports; | |
2 | |
3 import org.w3c.dom.Attr; | |
4 import org.w3c.dom.Document; | |
5 import org.w3c.dom.Node; | |
6 | |
7 import de.intevation.artifactdatabase.state.DefaultAttribute; | |
8 | |
9 | |
10 /** | |
11 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
12 */ | |
13 public class VisibleAttribute extends DefaultAttribute { | |
14 | |
15 protected boolean visible; | |
16 | |
17 | |
18 public VisibleAttribute(String name, Object value, boolean visible) { | |
19 super(name, value); | |
20 this.visible = visible; | |
21 } | |
22 | |
23 | |
24 /** | |
25 * This implementation of Attribute calls DefaultAttribute.toXML() first. | |
26 * After this, a new Attr <i>display</i> is added to the resulting Node. | |
27 * | |
28 * @param parent The parent Node. | |
29 * | |
30 * @return a new Node that represents this Attribute. | |
31 */ | |
32 @Override | |
33 public Node toXML(Node parent) { | |
34 Document owner = parent.getOwnerDocument(); | |
35 Node node = super.toXML(parent); | |
36 | |
37 Attr attr = owner.createAttribute("display"); | |
38 attr.setValue(String.valueOf(visible)); | |
39 | |
40 node.appendChild(attr); | |
41 | |
42 return node; | |
43 } | |
44 } | |
45 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |