changeset 1693:5f1156d61e9e

Let WaterlevelPairSelect send "old" data. flys-artifacts/trunk@2919 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 10 Oct 2011 09:53:18 +0000
parents 5201173c3db5
children 2b9f0ca1449b
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelPairSelectState.java
diffstat 2 files changed, 41 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Oct 10 08:35:30 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Oct 10 09:53:18 2011 +0000
@@ -1,3 +1,12 @@
+2011-10-10  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Let WaterlevelPairSelectState include diffids-data (if any) to enable
+	future work on repopulation of Grid in GUI when jumping back
+	(reparameterization).
+
+	* src/main/java/de/intevation/flys/artifacts/states/WaterlevelPairSelectState.java:
+	  (createItems): Override to include old data.
+
 2011-10-10  Ingo Weinzierl <ingo@intevation.de>
 
 	flys/issue150 (Diagramm: Anzeige von W bergauf)
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelPairSelectState.java	Mon Oct 10 08:35:30 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelPairSelectState.java	Mon Oct 10 09:53:18 2011 +0000
@@ -6,8 +6,10 @@
 
 import org.w3c.dom.Element;
 
+import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 
+import de.intevation.artifactdatabase.ProtocolUtils;
 import de.intevation.artifactdatabase.state.Facet;
 
 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
@@ -22,13 +24,13 @@
 import de.intevation.flys.utils.StringUtil;
 
 
-
 public class WaterlevelPairSelectState
 extends      DefaultState
 implements   FacetTypes
 {
     /** The logger that is used in this state. */
-    private static Logger logger = Logger.getLogger(WaterlevelPairSelectState.class);
+    private static Logger logger = Logger.getLogger(
+         WaterlevelPairSelectState.class);
 
 
     // TODO fix (state.winfo.waterlevel)
@@ -56,7 +58,34 @@
         Object       old
     ) {
         //Get data and do stuff, do not calculate
-        return "";
+        return old;
+    }
+
+
+
+    /**
+     * Create elements for document (prepopulated with data, if any).
+     */
+    @Override
+    protected Element[] createItems(
+        XMLUtils.ElementCreator cr,
+        Artifact    artifact,
+        String      name,
+        CallContext context)
+    {
+        logger.debug("createItems: " + name);
+        if (name.equals("diffids")) {
+            Element item  = ProtocolUtils.createArtNode(cr, "item", null, null);
+            Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
+            Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
+            FLYSArtifact flys = (FLYSArtifact) artifact;
+            String s = flys.getDataAsString("diffids");
+            value.setTextContent(s);
+            item.appendChild(label);
+            item.appendChild(value);
+            return new Element[] { item };
+        }
+        return new Element[] {};
     }
 
 
@@ -112,7 +141,6 @@
                 .unbracket(recommendations[i+1])
                 .split(";");
 
-    
             FLYSArtifact artifact1 = FLYSUtils.getArtifact(minuendParts[0], cc);
     
             CalculationResult rawData1 = (CalculationResult) artifact1.compute(

http://dive4elements.wald.intevation.org