Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java @ 5774:496c8c9d4913
issue1260, issue1259: Improve multi-gauge w/q input.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 19 Apr 2013 12:44:55 +0200 |
parents | cdc47534a970 |
children |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Fri Apr 19 11:47:27 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Fri Apr 19 12:44:55 2013 +0200 @@ -216,21 +216,34 @@ double val = r.getAttributeAsDouble("value"); doubleArrayPanels.get(fi).setValues(new double[]{val}); - // Focus next. - if (fi != doubleArrayPanels.size()-1) { - doubleArrayPanels.get(fi+1).focusInItem(1); + // If a named value for first gauge is chosen, try to find and set + // the values to the other panels too. + if (fi == 0) { + String valueName = r.getAttribute("name"); + int oi = 0; + // TODO instead of oi use random access. + for (QDTable otherQDTable: qdTables) { + if (oi == 0) { + oi++; + continue; + } + Double value = otherQDTable.findRecordValue(valueName); + if (value == null) { + // TODO i18n + SC.warn("No Value for <name> at <gauge>"); + } + else { + doubleArrayPanels.get(oi).setValues(new double[]{value}); + } + oi++; + } } - - /*if (itemWithFocus != null) { - itemWithFocus.setValues(new double[]{val}); - int i = doubleArrayPanels.indexOf(itemWithFocus); - if (i == doubleArrayPanels.size()-1) { - doubleArrayPanels.get(0).focusInItem(1); + else { + // Focus next. + if (fi != doubleArrayPanels.size()-1) { + doubleArrayPanels.get(fi+1).focusInItem(1); } - else { - doubleArrayPanels.get(i+1).focusInItem(1); - } - }*/ + } } };