changeset 3649:33bfc01410fb

Merged revisions 5375,5379,5382 via svnmerge from file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-artifacts/trunk ........ r5375 | ingo | 2012-09-07 11:26:45 +0200 (Fr, 07 Sep 2012) | 1 line Tagged 'flys-artifacts' as 2.9 ........ r5379 | rrenkert | 2012-09-07 13:58:41 +0200 (Fr, 07 Sep 2012) | 4 lines Issue 791. Add start km to data to compare reference and target km in next state. ........ r5382 | rrenkert | 2012-09-07 14:03:48 +0200 (Fr, 07 Sep 2012) | 3 lines Set data for characteristic diameter for use in parameter matrix UI. ........ flys-artifacts/tags/2.9@5388 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 07 Sep 2012 13:12:08 +0000 (2012-09-07)
parents db6bb4c1f41f
children cbe2febe30cc
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/minfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 10 files changed, 116 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 07 13:12:08 2012 +0000
@@ -1,3 +1,32 @@
+2012-09-07  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* doc/conf/artifacts/minfo.xml:
+	  Add data fields for characteristic bed and bedload diameter.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java:
+	  Use parametermatrix as UI provider and set the correct data.
+
+	* src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java,
+	  src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java:
+	  Updated method parameter.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  Added i18n strings.
+
+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
+
 2012-09-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 07 13:12:08 2012 +0000
@@ -197,7 +197,8 @@
         </state>
 
         <state id="state.minfo.bed.char_diameter" description="state.minfo.bed.char_diameter" state="de.intevation.flys.artifacts.states.minfo.CharDiameter">
-            <data name="diameter" type="String"/>
+            <data name="bed_diameter" type="options"/>
+            <data name="load_diameter" type="options"/>
         </state>
 
         <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java	Fri Sep 07 13:12:08 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 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java	Fri Sep 07 13:12:08 2012 +0000
@@ -35,7 +35,7 @@
         try {
             creator.addAttr(select, "type", "options", true);
 
-            for (KVP kvp: getOptions(artifact, name)) {
+            for (KVP kvp: getOptions(artifact, name, context)) {
                 Element item = creator.create("item");
                 creator.addAttr(item, "label", kvp.getValue().toString(), true);
                 creator.addAttr(item, "value", kvp.getKey().toString(), true);
@@ -80,7 +80,8 @@
 
     protected abstract KVP<String, String>[] getOptions(
         Artifact artifact,
-        String   parameterName
+        String   parameterName,
+        CallContext context
     )
     throws IllegalArgumentException;
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Fri Sep 07 13:12:08 2012 +0000
@@ -39,7 +39,8 @@
     @Override
     protected KVP<String, String>[] getOptions(
         Artifact artifact,
-        String   parameterName
+        String   parameterName,
+        CallContext context
     )
     throws IllegalArgumentException
     {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java	Fri Sep 07 13:12:08 2012 +0000
@@ -1,17 +1,26 @@
 package de.intevation.flys.artifacts.states.minfo;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.apache.poi.hssf.record.formula.functions.Rows;
 import org.w3c.dom.Element;
 
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.common.model.KVP;
 import de.intevation.artifacts.common.utils.XMLUtils;
 import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.artifacts.states.DefaultState;
+import de.intevation.flys.artifacts.states.MultiStringArrayState;
 
-public class CharDiameter extends DefaultState {
+public class CharDiameter extends MultiStringArrayState {
 
-    public static final String UI_PROVIDER = "minfo.bed.char_diameter";
+    private static final Logger logger = Logger.getLogger(CharDiameter.class);
+
+    public static final String UI_PROVIDER = "parameter-matrix";
 
     private static final String CHAR_DIAMETER_MIN  = "calc.bed.dmin";
     private static final String CHAR_DIAMETER_MAX  = "calc.bed.dmax";
@@ -55,25 +64,31 @@
     }
 
     @Override
-    protected Element[] createItems(
-        XMLUtils.ElementCreator cr,
-        Artifact    artifact,
-        String      name,
-        CallContext context)
+    protected KVP<String, String>[] getOptions(
+        Artifact artifact,
+        String parameterName,
+        CallContext context
+    )
+    throws IllegalArgumentException
     {
         CallMeta meta   = context.getMeta();
-        Element[] calcs = new Element[CHAR_DIAMETER.length];
 
+        List<KVP<String, String>> rows = new ArrayList<KVP<String, String>>();
+        String key = parameterName;
         for (int i = 0; i < CHAR_DIAMETER.length; ++i) {
             String calc = CHAR_DIAMETER[i];
-            calcs[i] = createItem(
-                cr, new String[] {
-                    Resources.getMsg(meta, calc, calc),
-                    calc
-                });
+            rows.add(new KVP (calc,
+                              Resources.getMsg(meta, calc, calc)));
         }
 
-        return calcs;
+        return rows.toArray(new KVP[rows.size()]);
+    }
+
+    @Override
+    protected String getLabelFor(CallContext cc, String parameterName,
+            String value) throws IllegalArgumentException {
+
+        return Resources.getMsg(cc.getMeta(), value, value);
     }
 
 }
--- a/flys-artifacts/src/main/resources/messages.properties	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Fri Sep 07 13:12:08 2012 +0000
@@ -442,3 +442,6 @@
 module.fixanalysis = Fix Analysis
 module.new_map = New Map
 module.new_chart = New Chart
+
+load_diameter = Bedload Diameter
+bed_diameter = Bed Diameter
--- a/flys-artifacts/src/main/resources/messages_de.properties	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Fri Sep 07 13:12:08 2012 +0000
@@ -445,3 +445,6 @@
 module.fixanalysis = Fixierungsanalyse
 module.new_map = Neue Karte
 module.new_chart = Neues Diagramm
+
+load_diameter = Geschiebedurchmesser
+bed_diameter = Sohldurchmesser
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 07 13:12:08 2012 +0000
@@ -444,3 +444,7 @@
 module.fixanalysis = Fixierungsanalyse
 module.new_map = Neue Karte
 module.new_chart = Neues Diagramm
+
+load_diameter = Geschiebedurchmesser
+bed_diameter = Sohldurchmesser
+
--- a/flys-artifacts/src/main/resources/messages_en.properties	Fri Sep 07 09:12:11 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Fri Sep 07 13:12:08 2012 +0000
@@ -443,3 +443,6 @@
 module.fixanalysis = Fix Analysis
 module.new_map = New Map
 module.new_chart = New Chart
+
+load_diameter = Bedload Diameter
+bed_diameter = Bed Diameter

http://dive4elements.wald.intevation.org