teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
teichmann@5863: * Software engineering by Intevation GmbH
teichmann@5863: *
teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3)
teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the
teichmann@5994: * documentation coming with Dive4Elements River for details.
teichmann@5863: */
teichmann@5863:
teichmann@5831: package org.dive4elements.river.exports;
felix@3615:
felix@3615: import org.w3c.dom.Element;
felix@3615: import org.w3c.dom.Node;
felix@3615:
felix@3615:
felix@3615: /**
felix@3615: * @author Ingo Weinzierl
felix@3615: */
felix@3615: public class ChoiceStringAttribute extends StringAttribute {
felix@3615:
felix@3615: /** Indicator which type of choice is dealt with. */
felix@3615: protected String choiceType;
sascha@3633:
felix@3615:
felix@3615: public ChoiceStringAttribute(String name,
felix@3615: String value,
felix@3615: boolean visible,
felix@3615: String choiceType) {
felix@3615: super(name, value, visible);
felix@3615: this.choiceType = choiceType;
felix@3615: }
felix@3615:
felix@3615:
felix@3615: /**
felix@3615: * Calls VisibleAttribute.toXML() and appends afterwards an attribute
felix@3615: * type with value string.
felix@3615: *
felix@3615: * @param parent The parent Node.
felix@3615: *
felix@3615: * @return the new Node that represents this Attribute.
felix@3615: */
felix@3615: @Override
felix@3615: public Node toXML(Node parent) {
felix@3615: Element ele = (Element) super.toXML(parent);
felix@3615: ele.setAttribute("type", "string");
felix@3615: ele.setAttribute("choice", choiceType);
felix@3615:
felix@3615: return ele;
felix@3615: }
felix@3615: }
felix@3615: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :