Mercurial > dive4elements > river
changeset 2473:9fa513b7955b
Issue 499.
Completed the 'W free' input and validation.
flys-client/trunk@4202 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 05 Apr 2012 09:01:09 +0000 |
parents | 75d19d46c3cd |
children | 6f7e188fac1a |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java |
diffstat | 2 files changed, 184 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Wed Apr 04 13:31:05 2012 +0000 +++ b/flys-client/ChangeLog Thu Apr 05 09:01:09 2012 +0000 @@ -1,3 +1,11 @@ +2012-04-05 Raimund Renkert <raimund.renkert@intevation.de> + + Issue 499. + + * src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java: + Added panels for 'W free' input. Added validation for 'W free' input + values. + 2012-04-04 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Wed Apr 04 13:31:05 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Thu Apr 05 09:01:09 2012 +0000 @@ -104,6 +104,9 @@ /** The min value for the 'from' property in the free Q-Range input mode.*/ protected double minQFree; + /** The min value for the 'from' property in the free W-Range input mode.*/ + protected double minWFree; + /** The max values for the 'from' property in the W-Range input mode.*/ protected double maxW; @@ -113,6 +116,9 @@ /** The max value for the 'from' property in the free Q-Range input mode.*/ protected double maxQFree; + /** The max value for the 'from' property in the free W-Range input mode.*/ + protected double maxWFree; + /** The 'from' value entered in the range W mode.*/ protected double fromW; @@ -125,24 +131,36 @@ /** The values entered in the single W mode.*/ protected double[] valuesW; + /** The values entered in the single W mode.*/ + protected double[] valuesWFree; + /** The 'from' value entered in the range Q mode.*/ protected double fromQ; /** The 'from' value entered in the range free Q mode.*/ protected double fromQFree; + /** The 'from' value entered in the range free W mode.*/ + protected double fromWFree; + /** The 'to' value entered in the range Q mode.*/ protected double toQ; /** The 'to' value entered in the range free Q mode.*/ protected double toQFree; + /** The 'to' value entered in the range free W mode.*/ + protected double toWFree; + /** The 'step' value entered in the range Q mode.*/ protected double stepQ; /** The 'step' value entered in the range free Q mode.*/ protected double stepQFree; + /** The 'step' value entered in the range free W mode.*/ + protected double stepWFree; + /** The values entered in the single Q mode.*/ protected double[] valuesQ; @@ -158,6 +176,9 @@ /** The input panel for free q values*/ protected DoubleArrayPanel qFreeArrayPanel; + /** The input panel for free w values*/ + protected DoubleArrayPanel wFreeArrayPanel; + /** The input panel for w range*/ protected DoubleRangePanel wRangePanel; @@ -167,6 +188,9 @@ /** The input panel for free q range*/ protected DoubleRangePanel qFreeRangePanel; + /** The input panel for free w range*/ + protected DoubleRangePanel wFreeRangePanel; + protected QDTable qdTable; protected WTable wTable; @@ -324,7 +348,7 @@ String wqMode = null; if (!isQMode) { - wqMode = MESSAGE.wqW(); + wqMode = isFree ? MESSAGE.wqWFree() : MESSAGE.wqW(); } else { wqMode = isFree ? MESSAGE.wqQ() : MESSAGE.wqQGauge(); @@ -368,6 +392,9 @@ DataItem fQFItem = getDataItem(f.getItems(), "minQFree"); DataItem tQFItem = getDataItem(t.getItems(), "maxQFree"); DataItem sQFItem = getDataItem(s.getItems(), "stepQFree"); + DataItem fWFItem = getDataItem(f.getItems(), "minWFree"); + DataItem tWFItem = getDataItem(t.getItems(), "maxWFree"); + DataItem sWFItem = getDataItem(s.getItems(), "stepWFree"); minW = Double.valueOf(fWItem.getStringValue()); maxW = Double.valueOf(tWItem.getStringValue()); @@ -381,6 +408,10 @@ maxQFree = Double.valueOf(tQFItem.getStringValue()); stepQFree = Double.valueOf(sQFItem.getStringValue()); + minWFree = Double.valueOf(fWFItem.getStringValue()); + maxWFree = Double.valueOf(tWFItem.getStringValue()); + stepWFree = Double.valueOf(sWFItem.getStringValue()); + this.fromW = minW; this.toW = maxW; this.stepW = stepW; @@ -392,6 +423,10 @@ this.fromQFree = minQFree; this.toQFree = maxQFree; this.stepQFree = stepQFree; + + this.fromWFree = minWFree; + this.toWFree = maxWFree; + this.stepWFree = stepWFree; } @@ -696,13 +731,13 @@ protected List<String> validateRangeValues() { - if (isWMode()) { - return validateRange(wRangePanel, minW, maxW); + if (isWFree()) { + return validateRange(wFreeRangePanel, minWFree, maxWFree); } else if (isQFree()) { return validateRange(qFreeRangePanel, minQFree, maxQFree); } - else if (isWFree()) { + else if (isWMode()) { return validateRange(wRangePanel, minW, maxW); } else { @@ -712,12 +747,11 @@ protected List<String> validateSingleValues() { if (isWFree()) { - // FIXME: We need min W and max W of the start km of the range. - return validateSingle(wArrayPanel, 0, 100000); + return validateSingle(wFreeArrayPanel, minWFree, maxWFree); } else if (isWMode()) { - //return validateSingle(wArrayPanel, minW, maxW); - return validateSingle(wArrayPanel, 0, 100000); + return validateSingle(wArrayPanel, minW, maxW); + //return validateSingle(wArrayPanel, 0, 100000); } else if (isQFree()) { return validateSingle(qFreeArrayPanel, minQFree, maxQFree); @@ -837,7 +871,10 @@ Canvas member = container.getMember(0); if (member instanceof DoubleArrayPanel) { DoubleArrayPanel form = (DoubleArrayPanel) member; - if (isWMode()) { + if (isWFree()) { + saveSingleWFreeValues(form); + } + else if (isWMode()) { saveSingleWValues(form); } else if (isQFree()) { @@ -855,7 +892,10 @@ if (member instanceof DoubleRangePanel) { DoubleRangePanel form = (DoubleRangePanel) member; - if (isWMode()) { + if (isWFree()) { + saveRangeWFreeValues(form); + } + else if (isWMode()) { saveRangeWValues(form); } else if (isQFree()) { @@ -939,7 +979,7 @@ value = "true"; } else { - GWT.log("getData: FIELD_WQ_W"); + GWT.log("getData: FIELD_WQ_W || FIELD_WQ_W_FREE"); value = "false"; } @@ -1051,9 +1091,10 @@ protected double[] getFinalSingle() { - boolean wMode = isWMode(); - - if (isWMode()) { + if (isWFree()) { + return getSingleWFree(); + } + else if (isWMode()) { return getSingleW(); } else if (isQFree()) { @@ -1071,11 +1112,11 @@ * @return the value of 'from' depending on the selected input mode. */ protected double getFinalFrom() { - boolean wMode = isWMode(); - boolean rangeMode = isRangeMode(); - - if (rangeMode) { - if (wMode) { + if (isRangeMode()) { + if (isWFree()) { + return getFromWFree(); + } + else if (isWMode()) { return getFromW(); } else if (isQFree()) { @@ -1088,7 +1129,10 @@ else { double[] values = null; - if (wMode) { + if (isWFree()) { + values = getSingleWFree(); + } + else if (isWMode()) { values = getSingleW(); } else if (isQFree()) { @@ -1114,11 +1158,11 @@ * @return the value of 'to' depending on the selected input mode. */ protected double getFinalTo() { - boolean wMode = isWMode(); - boolean rangeMode = isRangeMode(); - - if (rangeMode) { - if (wMode) { + if (isRangeMode()) { + if (isWFree()) { + return getToWFree(); + } + else if (isWMode()) { return getToW(); } else if (isQFree()) { @@ -1131,7 +1175,10 @@ else { double[] values = null; - if (wMode) { + if (isWFree()) { + values = getSingleWFree(); + } + else if (isWMode()) { values = getSingleW(); } else if (isQFree()) { @@ -1157,11 +1204,11 @@ * @return the value of 'step' depending on the selected input mode. */ protected double getFinalStep() { - boolean wMode = isWMode(); - boolean rangeMode = isRangeMode(); - - if (rangeMode) { - if (wMode) { + if (isRangeMode()) { + if (isWFree()) { + return getStepWFree(); + } + else if (isWMode()) { return getStepW(); } else if (isQFree()) { @@ -1255,7 +1302,33 @@ protected void updatePanels(boolean isQ, boolean isFree, boolean isRange) { container.removeMembers(container.getMembers()); - if (!isQ) { + if (!isQ && isFree) { + if (!isRange) { + // Single W mode + double[] values = getSingleWFree(); + + wFreeArrayPanel = new DoubleArrayPanel( + MESSAGE.unitWSingle(), values, this); + + container.addMember(wFreeArrayPanel); + } + else { + // Range W mode + double from = getFromWFree(); + double to = getToWFree(); + double step = getStepWFree(); + + wFreeRangePanel = new DoubleRangePanel( + MESSAGE.unitWFrom(), MESSAGE.unitWTo(), MESSAGE.unitWStep(), + from, to, step, + 250, + this); + container.addMember(wFreeRangePanel); + } + + tabs.selectTab(0); + } + else if (!isQ) { if (!isRange) { // Single W mode double[] values = getSingleW(); @@ -1356,7 +1429,17 @@ saveRangeWValue(p, item); } } - else if (wqMode.equals(FIELD_WQ_Q)) { + else if (wqMode.equals(FIELD_WQ_W_FREE)) { + if (inputMode.equals(FIELD_MODE_SINGLE)) { + DoubleArrayPanel p = (DoubleArrayPanel) form; + saveSingleWFreeValue(p, item); + } + else { + DoubleRangePanel p = (DoubleRangePanel) form; + saveRangeWFreeValue(p, item); + } + } + else if (wqMode.equals(FIELD_WQ_Q_FREE)) { if (inputMode.equals(FIELD_MODE_SINGLE)) { DoubleArrayPanel p = (DoubleArrayPanel) form; saveSingleQFreeValue(p, item); @@ -1390,6 +1473,17 @@ } + protected void saveSingleWFreeValues(DoubleArrayPanel p) { + FormItem[] formItems = p.getFields(); + + for (FormItem item: formItems) { + if (item.getFieldName().equals(DoubleArrayPanel.FIELD_NAME)) { + saveSingleWFreeValue(p, item); + } + } + } + + protected void saveSingleQValues(DoubleArrayPanel p) { FormItem[] formItems = p.getFields(); @@ -1419,6 +1513,13 @@ } + protected void saveSingleWFreeValue(DoubleArrayPanel p, FormItem item) { + if (p.validateForm(item)) { + setSingleWFree(p.getInputValues(item)); + } + } + + protected void saveSingleQValue(DoubleArrayPanel p, FormItem item) { if (p.validateForm(item)) { setSingleQ(p.getInputValues(item)); @@ -1442,6 +1543,15 @@ } + protected void saveRangeWFreeValues(DoubleRangePanel p) { + FormItem[] formItems = p.getFields(); + + for (FormItem item: formItems) { + saveRangeWFreeValue(p, item); + } + } + + protected void saveRangeQValues(DoubleRangePanel p) { FormItem[] formItems = p.getFields(); @@ -1469,6 +1579,15 @@ } + protected void saveRangeWFreeValue(DoubleRangePanel p, FormItem item) { + if (p.validateForm()) { + setFromW(p.getFrom()); + setToW(p.getTo()); + setStepW(p.getStep()); + } + } + + protected void saveRangeQValue(DoubleRangePanel p, FormItem item) { if (p.validateForm()) { setFromQ(p.getFrom()); @@ -1566,46 +1685,69 @@ this.stepQFree = stepQ; } - protected double[] getSingleW() { return valuesW; } + protected double[] getSingleWFree() { + return valuesWFree; + } protected void setSingleW(double[] values) { valuesW = values; } + protected void setSingleWFree(double[] values) { + valuesWFree = values; + } protected double getFromW() { return fromW; } + protected double getFromWFree() { + return fromWFree; + } protected void setFromW(double fromW) { this.fromW = fromW; } + protected void setFromWFree(double fromW) { + this.fromW = fromW; + } protected double getToW() { return toW; } + protected double getToWFree() { + return toWFree; + } protected void setToW(double toW) { this.toW = toW; } + protected void setToWFree(double toW) { + this.toWFree = toW; + } protected double getStepW() { return stepW; } + protected double getStepWFree() { + return stepWFree; + } protected void setStepW(double stepW) { this.stepW = stepW; } + protected void setStepWFree(double stepW) { + this.stepWFree = stepW; + } /** * Determines the min and max kilometer value selected in a former state. A