changeset 3721:1cfe788325d5

Issue 791. Add start km to data to compare reference and target km in next state. flys-artifacts/trunk@5379 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 07 Sep 2012 11:58:41 +0000
parents 181e250bf989
children c91e7db0fd4b
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java
diffstat 2 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 07 09:26:45 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 07 11:58:41 2012 +0000
@@ -1,3 +1,10 @@
+2012-09-07  Raimund Renkert <raimund.renkert@intevation.de>
+
+	Issue 791.
+
+	* src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java:
+	  Add start km to data to compare reference and target km in next state.
+
 2012-09-07  Ingo Weinzierl <ingo@intevation.de>
 
 	Tagged RELEASE 2.9
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java	Fri Sep 07 09:26:45 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java	Fri Sep 07 11:58:41 2012 +0000
@@ -1,16 +1,25 @@
 package de.intevation.flys.artifacts.states;
 
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+
+import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.common.utils.StringUtils;
+import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
+import de.intevation.flys.artifacts.WINFOArtifact;
 
 
 /**
  * Get me doubles (km).
  */
 public class EnterMultipleLocationsState extends EnterLocationState {
+    /** The logger for this class. */
+    private static Logger logger = Logger.getLogger(EnterMultipleLocationsState.class);
 
     @Override
     protected String getUIProvider() {
+        logger.debug("multi location panel");
         return "multi_location_panel";
     }
 
@@ -31,5 +40,34 @@
 
         return StringUtils.join(" ", vals);
     }
+
+    /**
+     * This method creates a list of items. These items represent the amount of
+     * input data that is possible for this state.
+     *
+     * @param cr The ElementCreator.
+     * @param name The name of the amount of data.
+     *
+     * @return a list of items.
+     */
+    @Override
+    protected Element[] createItems(
+        ElementCreator cr,
+        Artifact    artifact,
+        String      name,
+        CallContext context
+    ) {
+        if (name.equals("reference_endpoint")) {
+            Element[] elements = new Element[1];
+            WINFOArtifact winfo = (WINFOArtifact) artifact;
+            Double km = winfo.getReferenceStartKm();
+            elements[0] = createItem(
+                cr,
+                new String[] {"start_km", km.toString()});
+            return elements;
+        }
+        return null;
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org