Mercurial > dive4elements > river
changeset 1485:00e429e6420c
Made WQInputPanel able to distinguish between a 'Q at Gauge' and 'Free Q'.
flys-client/trunk@3556 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 29 Dec 2011 14:55:18 +0000 |
parents | cb5ab84505b7 |
children | efdb4fe5a69e |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java |
diffstat | 2 files changed, 236 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Tue Dec 27 11:13:05 2011 +0000 +++ b/flys-client/ChangeLog Thu Dec 29 14:55:18 2011 +0000 @@ -1,3 +1,15 @@ +2011-12-29 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java: + Introduced fields and methods to support free Q values. This panel now + has the cases: + 1) W array input + 2) W range input + 3) Q array input + 4) Q range input + 5) Q free array input + 6) Q free range input + 2011-12-27 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Tue Dec 27 11:13:05 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Thu Dec 29 14:55:18 2011 +0000 @@ -98,12 +98,18 @@ /** The min values for the 'from' property in the Q-Range input mode.*/ protected double minQ; + /** The min value for the 'from' property in the free Q-Range input mode.*/ + protected double minQFree; + /** The max values for the 'from' property in the W-Range input mode.*/ protected double maxW; /** The max values for the 'from' property in the Q-Range input mode.*/ protected double maxQ; + /** The max value for the 'from' property in the free Q-Range input mode.*/ + protected double maxQFree; + /** The 'from' value entered in the range W mode.*/ protected double fromW; @@ -119,27 +125,45 @@ /** 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 '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 '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 values entered in the single Q mode.*/ protected double[] valuesQ; + /** The values entered in the single free Q mode.*/ + protected double[] valuesQFree; + /** The input panel for W values*/ protected DoubleArrayPanel wArrayPanel; /** The input panel for q values*/ protected DoubleArrayPanel qArrayPanel; + /** The input panel for free q values*/ + protected DoubleArrayPanel qFreeArrayPanel; + /** The input panel for w range*/ protected DoubleRangePanel wRangePanel; /** The input panel for q range*/ protected DoubleRangePanel qRangePanel; + /** The input panel for free q range*/ + protected DoubleRangePanel qFreeRangePanel; + protected QDTable qdTable; protected WTable wTable; @@ -333,12 +357,15 @@ Data t = getData(list.getAll(), "wq_to"); Data s = getData(list.getAll(), "wq_step"); - DataItem fQItem = getDataItem(f.getItems(), "minQ"); - DataItem fWItem = getDataItem(f.getItems(), "minW"); - DataItem tQItem = getDataItem(t.getItems(), "maxQ"); - DataItem tWItem = getDataItem(t.getItems(), "maxW"); - DataItem sQItem = getDataItem(s.getItems(), "stepQ"); - DataItem sWItem = getDataItem(s.getItems(), "stepW"); + DataItem fQItem = getDataItem(f.getItems(), "minQ"); + DataItem fWItem = getDataItem(f.getItems(), "minW"); + DataItem tQItem = getDataItem(t.getItems(), "maxQ"); + DataItem tWItem = getDataItem(t.getItems(), "maxW"); + DataItem sQItem = getDataItem(s.getItems(), "stepQ"); + DataItem sWItem = getDataItem(s.getItems(), "stepW"); + DataItem fQFItem = getDataItem(f.getItems(), "minQFree"); + DataItem tQFItem = getDataItem(t.getItems(), "maxQFree"); + DataItem sQFItem = getDataItem(s.getItems(), "stepQFree"); minW = Double.valueOf(fWItem.getStringValue()); maxW = Double.valueOf(tWItem.getStringValue()); @@ -348,6 +375,10 @@ maxQ = Double.valueOf(tQItem.getStringValue()); stepQ = Double.valueOf(sQItem.getStringValue()); + minQFree = Double.valueOf(fQFItem.getStringValue()); + maxQFree = Double.valueOf(tQFItem.getStringValue()); + stepQFree = Double.valueOf(sQFItem.getStringValue()); + this.fromW = minW; this.toW = maxW; this.stepW = stepW; @@ -355,6 +386,10 @@ this.fromQ = minQ; this.toQ = maxQ; this.stepQ = stepQ; + + this.fromQFree = minQFree; + this.toQFree = maxQFree; + this.stepQFree = stepQFree; } @@ -661,6 +696,9 @@ if (isWMode()) { return validateRange(wRangePanel, minW, maxW); } + else if (isQFree()) { + return validateRange(qFreeRangePanel, minQFree, maxQFree); + } else { return validateRange(qRangePanel, minQ, maxQ); } @@ -671,6 +709,9 @@ if (isWMode()) { return validateSingle(wArrayPanel, minW, maxW); } + else if (isQFree()) { + return validateSingle(qFreeArrayPanel, minQFree, maxQFree); + } else { return validateSingle(qArrayPanel, minQ, maxQ); } @@ -773,6 +814,9 @@ if (isWMode()) { saveSingleWValues(form); } + else if (isQFree()) { + saveSingleQFreeValues(form); + } else { saveSingleQValues(form); } @@ -788,6 +832,9 @@ if (isWMode()) { saveRangeWValues(form); } + else if (isQFree()) { + saveRangeQFreeValues(form); + } else { saveRangeQValues(form); } @@ -968,7 +1015,15 @@ protected double[] getFinalSingle() { boolean wMode = isWMode(); - return wMode ? getSingleW() : getSingleQ(); + if (isWMode()) { + return getSingleW(); + } + else if (isQFree()) { + return getSingleQFree(); + } + else { + return getSingleQ(); + } } @@ -982,13 +1037,30 @@ boolean rangeMode = isRangeMode(); if (rangeMode) { - return wMode ? getFromW() : getFromQ(); - + if (wMode) { + return getFromW(); + } + else if (isQFree()) { + return getFromQFree(); + } + else { + return getFromQ(); + } } else { - double[] values = wMode ? getSingleW() : getSingleQ(); - double value = Double.MAX_VALUE; + double[] values = null; + if (wMode) { + values = getSingleW(); + } + else if (isQFree()) { + values = getSingleQFree(); + } + else { + values = getSingleQ(); + } + + double value = Double.MAX_VALUE; for (double v: values) { value = value < v ? value : v; } @@ -1008,13 +1080,30 @@ boolean rangeMode = isRangeMode(); if (rangeMode) { - return wMode ? getToW() : getToQ(); - + if (wMode) { + return getToW(); + } + else if (isQFree()) { + return getToQFree(); + } + else { + return getToQ(); + } } else { - double[] values = wMode ? getSingleW() : getSingleQ(); - double value = Double.MIN_VALUE; + double[] values = null; + if (wMode) { + values = getSingleW(); + } + else if (isQFree()) { + values = getSingleQFree(); + } + else { + values = getSingleQ(); + } + + double value = Double.MIN_VALUE; for (double v: values) { value = value > v ? value : v; } @@ -1034,7 +1123,15 @@ boolean rangeMode = isRangeMode(); if (rangeMode) { - return wMode ? getStepW() : getStepQ(); + if (wMode) { + return getStepW(); + } + else if (isQFree()) { + return getStepQFree(); + } + else { + return getStepQ(); + } } else { // we have no field to enter the 'step' attribute in the @@ -1100,8 +1197,6 @@ } else { qdTable.showIconFields(); - double[] empty = {}; - valuesQ = empty; } updatePanels(wqMode, inputMode); @@ -1137,6 +1232,31 @@ tabs.selectTab(0); } + else if (wqMode.equals(FIELD_WQ_Q)) { + if (inputMode.equals(FIELD_MODE_SINGLE)) { + // Single Q mode + double[] values = getSingleQFree(); + + qFreeArrayPanel = new DoubleArrayPanel( + MESSAGE.unitQSingle(), values, this); + container.addMember(qFreeArrayPanel); + } + else { + // Range Q mode + double from = getFromQFree(); + double to = getToQFree(); + double step = getStepQFree(); + + qFreeRangePanel = new DoubleRangePanel( + MESSAGE.unitQFrom(), MESSAGE.unitQTo(), MESSAGE.unitQStep(), + from, to, step, + 250, + this); + container.addMember(qFreeRangePanel); + } + + tabs.selectTab(1); + } else { if (inputMode.equals(FIELD_MODE_SINGLE)) { // Single Q mode @@ -1187,6 +1307,16 @@ saveRangeWValue(p, item); } } + else if (wqMode.equals(FIELD_WQ_Q)) { + if (inputMode.equals(FIELD_MODE_SINGLE)) { + DoubleArrayPanel p = (DoubleArrayPanel) form; + saveSingleQFreeValue(p, item); + } + else { + DoubleRangePanel p = (DoubleRangePanel) form; + saveRangeQFreeValue(p, item); + } + } else { if (inputMode.equals(FIELD_MODE_SINGLE)) { DoubleArrayPanel p = (DoubleArrayPanel) form; @@ -1222,6 +1352,17 @@ } + protected void saveSingleQFreeValues(DoubleArrayPanel p) { + FormItem[] formItems = p.getFields(); + + for (FormItem item: formItems) { + if (item.getFieldName().equals(DoubleArrayPanel.FIELD_NAME)) { + saveSingleQFreeValue(p, item); + } + } + } + + protected void saveSingleWValue(DoubleArrayPanel p, FormItem item) { if (p.validateForm(item)) { setSingleW(p.getInputValues(item)); @@ -1236,6 +1377,13 @@ } + protected void saveSingleQFreeValue(DoubleArrayPanel p, FormItem item) { + if (p.validateForm(item)) { + setSingleQFree(p.getInputValues(item)); + } + } + + protected void saveRangeWValues(DoubleRangePanel p) { FormItem[] formItems = p.getFields(); @@ -1254,6 +1402,15 @@ } + protected void saveRangeQFreeValues(DoubleRangePanel p) { + FormItem[] formItems = p.getFields(); + + for (FormItem item: formItems) { + saveRangeQFreeValue(p, item); + } + } + + protected void saveRangeWValue(DoubleRangePanel p, FormItem item) { if (p.validateForm(item)) { setFromW(p.getFrom()); @@ -1272,46 +1429,95 @@ } + protected void saveRangeQFreeValue(DoubleRangePanel p, FormItem item) { + if (p.validateForm(item)) { + setFromQFree(p.getFrom()); + setToQFree(p.getTo()); + setStepQFree(p.getStep()); + } + } + + protected double[] getSingleQ() { return valuesQ; } + protected double[] getSingleQFree() { + return valuesQFree; + } + + protected void setSingleQ(double[] values) { valuesQ = values; } + protected void setSingleQFree(double[] values) { + valuesQFree = values; + } + + protected double getFromQ() { return fromQ; } + protected double getFromQFree() { + return fromQFree; + } + + protected void setFromQ(double fromQ) { this.fromQ = fromQ; } + protected void setFromQFree(double fromQ) { + this.fromQFree = fromQ; + } + + protected double getToQ() { return toQ; } + protected double getToQFree() { + return toQFree; + } + + protected void setToQ(double toQ) { this.toQ = toQ; } + protected void setToQFree(double toQ) { + this.toQFree = toQ; + } + + protected double getStepQ() { return stepQ; } + protected double getStepQFree() { + return stepQFree; + } + + protected void setStepQ(double stepQ) { this.stepQ = stepQ; } + protected void setStepQFree(double stepQ) { + this.stepQFree = stepQ; + } + + protected double[] getSingleW() { return valuesW; }