[Dive4elements-commits] [PATCH 1 of 2] Partly fix flys/issue1127 (show unit in wqadapted) and added documentation

Wald Commits scm-commit at wald.intevation.org
Fri Mar 1 12:33:13 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1362138003 -3600
# Node ID 56091d58a99f558b13555e5840240e4e373f97c6
# Parent  658dc517fd7b16777c07ab4ee0fdd5ea9d71baee
Partly fix flys/issue1127 (show unit in wqadapted) and added documentation.

diff -r 658dc517fd7b -r 56091d58a99f flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java	Fri Mar 01 11:35:06 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java	Fri Mar 01 12:40:03 2013 +0100
@@ -160,7 +160,7 @@
         List<Data> all = dataList.getAll();
         Data    wqData = getData(all, "wq_values");
         Data    wqMode = getData(all, "wq_isq");
-
+        boolean isQ = wqMode.getItems()[0].getStringValue().equals("true");
         Canvas back = getBackButton(dataList.getState());
 
         HLayout valLayout  = new HLayout();
@@ -178,7 +178,8 @@
         modeLabel.setWidth(200);
 
         valLayout.addMember(wqLabel);
-        valLayout.addMember(createOldWQValues(wqData));
+        valLayout.addMember(createOldWQValues(wqData, isQ));
+
         valLayout.addMember(back);
         modeLayout.addMember(modeLabel);
 
@@ -190,7 +191,7 @@
 
 
     /** Create area showing previously entered w or q data. */
-    protected Canvas createOldWQValues(Data wqData) {
+    protected Canvas createOldWQValues(Data wqData, boolean isQ) {
         VLayout layout = new VLayout();
 
         DataItem item  = wqData.getItems()[0];
@@ -198,6 +199,8 @@
 
         String[] gauges = value.split(GAUGE_SEPARATOR);
 
+        String unit = isQ ? "m³/s" : "cm";
+
         for (String gauge: gauges) {
             HLayout h = new HLayout();
 
@@ -215,6 +218,8 @@
                 }
 
                 sb.append(v);
+                sb.append(" ");
+                sb.append(unit);
 
                 first = false;
             }
@@ -439,6 +444,7 @@
     }
 
 
+    /** Get items which are not WQ_MODE. */
     protected DataItem[] getWQItems(DataList dataList) {
         List<Data> data = dataList.getAll();
 
@@ -456,6 +462,10 @@
     }
 
 
+    /**
+     * Create radio button for switching w and q input.
+     * Radiobutton-change also triggers helper panel tab selection.
+     */
     protected Canvas createMode(DataList dataList) {
         RadioGroupItem wq = new RadioGroupItem(FIELD_WQ_MODE);
         wq.setShowTitle(false);


More information about the Dive4elements-commits mailing list