changeset 577:ded285064e43

#118 Added a further radio button to select 'Q at Gauge' to the WQ panel. flys-client/trunk@2145 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 17 Jun 2011 11:14:02 +0000
parents a0884f486711
children bcf1a37223a5
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java
diffstat 6 files changed, 65 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jun 17 10:16:45 2011 +0000
+++ b/flys-client/ChangeLog	Fri Jun 17 11:14:02 2011 +0000
@@ -1,3 +1,18 @@
+2011-06-17  Ingo Weinzierl <ingo@intevation.de>
+
+	  flys/issue118 (W-INFO: Eingabe Q aus Auswahlunterstützung und Manuell)
+
+	* src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java:
+	  Added a further radio button to select a "Q at Gauge". In addition, this
+	  panel returns a new value "wq_free" that depends on the selected Q mode.
+	  It is "true" if Q is selected, otherwise "false".
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+	  Added strings for the new radio button.
+
 2011-06-17  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/CollectionHelper.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Jun 17 10:16:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Jun 17 11:14:02 2011 +0000
@@ -122,6 +122,8 @@
 
     String wqQ();
 
+    String wqQGauge();
+
     String wqSingle();
 
     String wqRange();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Jun 17 10:16:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Jun 17 11:14:02 2011 +0000
@@ -51,7 +51,8 @@
 wqadaptedTitle = Input for W/Q Data
 calcTableTitle = Calculated Output
 wqW = W at Gauge [cm]
-wqQ = Q [m³/s]
+wqQ = Q [m\u00b3/s]
+wqQGauge = Q [m\u00b3/s] at Gauge
 wqSingle = Single values
 wqRange = Range
 unitWNN = W [NN+m]
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Jun 17 10:16:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Jun 17 11:14:02 2011 +0000
@@ -52,6 +52,7 @@
 calcTableTitle = Berechnungsausgabe
 wqW = W am Pegel [cm]
 wqQ = Q [m\u00b3/s]
+wqQGauge = Q [m\u00b3/s] am Pegel
 wqSingle = Einzelwerte
 wqRange = Wertebereich
 unitWNN = W [NN+m]
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Jun 17 10:16:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Jun 17 11:14:02 2011 +0000
@@ -50,6 +50,7 @@
 calcTableTitle = Calculated Output
 wqW = W at Gauge [cm]
 wqQ = Q [m³/s]
+wqQGauge = Q [m³/s] at Gauge
 wqSingle = Single values
 wqRange = Range
 unitWNN = W [NN+m]
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Fri Jun 17 10:16:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Fri Jun 17 11:14:02 2011 +0000
@@ -73,6 +73,9 @@
     /** The constant field value for Q input mode.*/
     public static final String FIELD_WQ_Q = "Q";
 
+    /** The constant field value for Q input mode.*/
+    public static final String FIELD_WQ_Q_GAUGE = "Q_GAUGE";
+
     /** The constant field name for choosing single values or range.*/
     public static final String FIELD_MODE = "mode";
 
@@ -83,7 +86,9 @@
     public static final String FIELD_MODE_RANGE = "range";
 
     /** The constant value that determines the width of the left panel.*/
-    public static final int WIDTH_LEFT = 200;
+    public static final int WIDTH_LEFT_UPPER = 300;
+
+    public static final int WIDTH_LEFT_LOWER = 238;
 
 
     /** The container that manages the w and q panels.*/
@@ -631,16 +636,17 @@
         RadioGroupItem wq = new RadioGroupItem(FIELD_WQ);
         wq.setShowTitle(false);
         wq.setVertical(false);
-        wq.setWidth(WIDTH_LEFT);
+        wq.setWidth(WIDTH_LEFT_UPPER);
 
         RadioGroupItem mode = new RadioGroupItem(FIELD_MODE);
         mode.setShowTitle(false);
         mode.setVertical(false);
-        mode.setWidth(WIDTH_LEFT);
+        mode.setWidth(WIDTH_LEFT_LOWER);
 
         LinkedHashMap wqValues = new LinkedHashMap();
         wqValues.put(FIELD_WQ_W, MESSAGE.wqW());
         wqValues.put(FIELD_WQ_Q, MESSAGE.wqQ());
+        wqValues.put(FIELD_WQ_Q_GAUGE, MESSAGE.wqQGauge());
 
         LinkedHashMap modeValues = new LinkedHashMap();
         modeValues.put(FIELD_MODE_SINGLE, MESSAGE.wqSingle());
@@ -654,11 +660,11 @@
 
         modes = new DynamicForm();
         modes.setFields(wq, mode);
-        modes.setWidth(WIDTH_LEFT);
+        modes.setWidth(WIDTH_LEFT_UPPER);
         modes.setNumCols(1);
 
         LinkedHashMap initial = new LinkedHashMap();
-        initial.put(FIELD_WQ, FIELD_WQ_Q);
+        initial.put(FIELD_WQ, FIELD_WQ_Q_GAUGE);
         initial.put(FIELD_MODE, FIELD_MODE_SINGLE);
         modes.setValues(initial);
 
@@ -813,6 +819,7 @@
 
             return new Data[] {
                 getDataMode(),
+                getQMode(),
                 getDataSelectionMode(),
                 getDataFrom(),
                 getDataTo(),
@@ -828,13 +835,38 @@
      */
     protected Data getDataMode() {
         String wqMode = modes.getValueAsString(FIELD_WQ);
-        DataItem item = new DefaultDataItem("wq_mode", "wq_mode", wqMode);
+
+        String value = null;
+        if (wqMode.equals(FIELD_WQ_Q) || wqMode.equals(FIELD_WQ_Q_GAUGE)) {
+            value = FIELD_WQ_Q;
+        }
+        else {
+            value = FIELD_WQ_W;
+        }
+
+        DataItem item = new DefaultDataItem("wq_mode", "wq_mode", value);
         return new DefaultData(
             "wq_mode", null, null, new DataItem[] { item });
     }
 
 
     /**
+     * Returns the Q mode. The Q mode can be "true" or "false". True means, the
+     * calculation is not based on a gauge, false means the calculation should
+     * be based on a gauge.
+     *
+     * @return the Data object for the 'wq_free' attribute.
+     */
+    protected Data getQMode() {
+        String value = isQFree() ? "true" : "false";
+
+        DataItem item = new DefaultDataItem("wq_free", "wq_free", value);
+        return new DefaultData(
+            "wq_free", null, null, new DataItem[] { item });
+    }
+
+
+    /**
      * Returns the Data object for the 'mode' attribute.
      *
      * @return the Data object for the 'mode' attribute.
@@ -1007,8 +1039,13 @@
      */
     public boolean isWMode() {
         String wq = modes.getValueAsString(FIELD_WQ);
+        return wq.equals(FIELD_WQ_W) ? true : false;
+    }
 
-        return wq.equals(FIELD_WQ_W) ? true : false;
+
+    public boolean isQFree() {
+        String wqMode = modes.getValueAsString(FIELD_WQ);
+        return wqMode.equals(FIELD_WQ_Q);
     }
 
 

http://dive4elements.wald.intevation.org