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.artifacts.states.minfo; raimund@3614: raimund@3614: import org.w3c.dom.Element; raimund@3614: teichmann@5831: import org.dive4elements.artifacts.CallContext; teichmann@5831: import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; andre@8720: import org.dive4elements.river.artifacts.states.WaterlevelPairSelectState; raimund@3614: raimund@3614: /** raimund@3614: * @author Raimund Renkert raimund@3614: */ andre@8720: public class DifferenceSelect extends WaterlevelPairSelectState { raimund@3614: raimund@3614: /** raimund@3614: * The default constructor that initializes an empty State object. raimund@3614: */ raimund@3614: public DifferenceSelect() { raimund@3614: } andre@8720: raimund@3614: @Override raimund@3614: protected String getUIProvider() { raimund@3614: return "bedheights_twin_panel"; raimund@3614: } raimund@3614: raimund@3614: /** raimund@3614: * Creates the data element used for the static part of DESCRIBE document. raimund@3614: */ raimund@3614: @Override raimund@3614: protected Element createStaticData( teichmann@5867: D4EArtifact flys, raimund@3614: ElementCreator creator, raimund@3614: CallContext cc, raimund@3614: String name, raimund@3614: String value, raimund@3614: String type raimund@3614: ) { raimund@3614: Element dataElement = creator.create("data"); raimund@3614: creator.addAttr(dataElement, "name", name, true); raimund@3614: creator.addAttr(dataElement, "type", type, true); raimund@3614: raimund@3614: Element itemElement = creator.create("item"); raimund@3614: creator.addAttr(itemElement, "value", value, true); raimund@3614: raimund@3614: String[] labels = getLabels(cc, value); raimund@3614: raimund@3614: creator.addAttr( raimund@3614: itemElement, raimund@3614: "label", raimund@3614: labels[0], raimund@3614: true); raimund@3614: dataElement.appendChild(itemElement); raimund@3614: raimund@3614: return dataElement; raimund@3614: } raimund@3614: } raimund@3614: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :