diff 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 diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodInfrastructure.java	Thu Oct 10 17:33:56 2019 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodInfrastructure.java	Fri Oct 11 18:30:36 2019 +0200
@@ -8,7 +8,15 @@
 
 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>
@@ -26,4 +34,22 @@
 
         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[] {};
+    }
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org