ingo@1986: package de.intevation.flys.exports;
ingo@1986:
ingo@1986: import org.w3c.dom.Attr;
ingo@1986: import org.w3c.dom.Document;
ingo@1987: import org.w3c.dom.Element;
ingo@1986: import org.w3c.dom.Node;
ingo@1986:
ingo@1986: import de.intevation.artifactdatabase.state.DefaultAttribute;
ingo@1986:
ingo@1986:
ingo@1986: /**
ingo@1986: * @author Ingo Weinzierl
ingo@1986: */
ingo@1986: public class VisibleAttribute extends DefaultAttribute {
ingo@1986:
ingo@1986: protected boolean visible;
ingo@1986:
ingo@1986:
ingo@1986: public VisibleAttribute(String name, Object value, boolean visible) {
ingo@1986: super(name, value);
ingo@1986: this.visible = visible;
ingo@1986: }
ingo@1986:
ingo@1986:
ingo@1986: /**
ingo@1986: * This implementation of Attribute calls DefaultAttribute.toXML() first.
ingo@1986: * After this, a new Attr display is added to the resulting Node.
ingo@1986: *
ingo@1986: * @param parent The parent Node.
ingo@1986: *
ingo@1986: * @return a new Node that represents this Attribute.
ingo@1986: */
ingo@1986: @Override
ingo@1986: public Node toXML(Node parent) {
ingo@1986: Document owner = parent.getOwnerDocument();
ingo@1986:
ingo@1987: Element ele = (Element) super.toXML(parent);
ingo@1987: ele.setAttribute("display", String.valueOf(visible));
ingo@1986:
ingo@1987: return ele;
ingo@1986: }
ingo@1986: }
ingo@1986: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :