changeset 595:9155110ec0a6

#104 The WQ panel now display the selected wq mode. flys-client/trunk@2195 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 22 Jun 2011 07:39:12 +0000
parents 646cf09dabf2
children 3f094045d512
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java
diffstat 2 files changed, 50 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Jun 21 17:53:08 2011 +0000
+++ b/flys-client/ChangeLog	Wed Jun 22 07:39:12 2011 +0000
@@ -1,3 +1,12 @@
+2011-06-22  Ingo Weinzierl <ingo@intevation.de>
+
+	  flys/issue104 (W-INFO: Wasserspiegellagenberechnung / Strecke)
+
+	* src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java:
+	  The old/static panel will display the selected wq mode now, because it's
+	  no longer possible to recognize the selected q mode based on the
+	  displayed units (there are two different q modes now).
+
 2011-06-21  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Tue Jun 21 17:53:08 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Wed Jun 22 07:39:12 2011 +0000
@@ -255,6 +255,7 @@
         List<Data> items = dataList.getAll();
 
         Data dMode      = getData(items, "wq_mode");
+        Data dFree      = getData(items, "wq_free");
         Data dSelection = getData(items, "wq_selection");
         Data dSingle    = getData(items, "wq_single");
         Data dFrom      = getData(items, "wq_from");
@@ -265,6 +266,10 @@
         String strMode  = mode[0].getStringValue();
         boolean wMode   = strMode.equals(FIELD_WQ_W);
 
+        DataItem[] free = dFree.getItems();
+        String  strFree = free[0].getStringValue();
+        boolean isFree  = Boolean.valueOf(strFree);
+
         HLayout layout = new HLayout();
         layout.setWidth("400px");
 
@@ -295,13 +300,31 @@
                 : createQString(from[0], to[0], step[0]);
         }
 
-        Label selected = new Label(text);
-        selected.setWidth("130px");
+        VLayout selectedLayout = new VLayout();
+        String  wqMode         = null;
+
+        if (wMode) {
+            wqMode = MESSAGE.wqW();
+        }
+        else {
+            wqMode = isFree ? MESSAGE.wqQ() : MESSAGE.wqQGauge();
+        }
+
+        Label mLabel = new Label(wqMode);
+        Label vLabel = new Label(text);
+        mLabel.setWidth(175);
+        mLabel.setHeight(20);
+        vLabel.setWidth(175);
+        vLabel.setHeight(20);
+
+        selectedLayout.addMember(mLabel);
+        selectedLayout.addMember(vLabel);
+        selectedLayout.setHeight(40);
 
         Canvas back = getBackButton(dataList.getState());
 
         layout.addMember(label);
-        layout.addMember(selected);
+        layout.addMember(selectedLayout);
         layout.addMember(back);
 
         return layout;
@@ -356,6 +379,12 @@
         DataItem modeItem = m != null ? m.getDefault() : null;
         String   theMode  = modeItem != null
             ? modeItem.getStringValue()
+            : "";
+
+        Data     f        = getData(allData, "wq_free");
+        DataItem freeItem = f != null ? f.getDefault() : null;
+        String   theFree  = freeItem != null
+            ? freeItem.getStringValue()
             : null;
 
         Data     s            = getData(allData, "wq_selection");
@@ -366,10 +395,18 @@
             return;
         }
 
+        boolean isW    = theMode.equals(FIELD_WQ_W);
+        boolean isFree = Boolean.valueOf(theFree);
+
         initUserSingleValues(list, theMode);
         initUserRangeValues(list, theMode);
 
-        modes.setValue(FIELD_WQ, theMode);
+        if (isW) {
+            modes.setValue(FIELD_WQ, theMode);
+        }
+        else {
+            modes.setValue(FIELD_WQ, isFree ? FIELD_WQ_Q : FIELD_WQ_Q_GAUGE);
+        }
 
         if (theSelection != null || theSelection.length() > 0) {
             modes.setValue(FIELD_MODE, theSelection);

http://dive4elements.wald.intevation.org