Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodInfrastructure.java @ 9624:02ca823ec9c6
zu Pos 20 Nachtrag; infrastructureChoice
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Fri, 11 Oct 2019 18:30:36 +0200 |
parents | 8ed6c45136fa |
children | f51e23eb036a |
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.artifacts.sinfo.flood_duration; import org.dive4elements.artifactdatabase.ProtocolUtils; import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.access.RiverAccess; import org.dive4elements.river.artifacts.states.DefaultState; import org.dive4elements.river.model.River; import org.w3c.dom.Element; /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class FloodInfrastructure extends DefaultState { private static final long serialVersionUID = 1L; protected final String getDatakey() { return "flood_infrastructure"; } @Override protected String getUIProvider() { return "flood_infrastructure_panel"; } @Override protected Element[] createItems(final ElementCreator cr, final Artifact artifact, final String name, final CallContext context) { if (name.equals(getDatakey())) { final Element item = ProtocolUtils.createArtNode(cr, "item", null, null); final Element label = ProtocolUtils.createArtNode(cr, "label", null, null); final Element value = ProtocolUtils.createArtNode(cr, "value", null, null); final D4EArtifact flys = (D4EArtifact) artifact; final River river = new RiverAccess(flys).getRiver(); final String s = flys.getDataAsString(getDatakey()); value.setTextContent(s); item.appendChild(label); item.appendChild(value); return new Element[] { item }; } return new Element[] {}; } }