Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java @ 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 | 55a90afaf513 |
children | bcf1a37223a5 |
line wrap: on
line diff
--- 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); }