# HG changeset patch # User Raimund Renkert # Date 1354551949 -3600 # Node ID d5821c6f0ab030cd996187d944dcd06ec4c7cfbe # Parent 5b551e3a58d53b60ccb4b1422908bd61d44842cd Fixed validation in parameter matrix panel. Single selections are allowed now. Avoid adding duplicates of user selection in parameter matrix. diff -r 5b551e3a58d5 -r d5821c6f0ab0 flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java Mon Dec 03 17:10:08 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java Mon Dec 03 17:25:49 2012 +0100 @@ -263,16 +263,23 @@ } ListGridRecord[] records = listGrid.getRecords(); - for (ListGridRecord record: records) { + Map> result = new HashMap>(); + for (ListGridRecord record : records) { for (int i = 0, n = columnNames.size(); i < n; i++) { String columnName = columnNames.get(i); - List chosenItems = selected.get(columnName); if (Boolean.valueOf(record.getAttribute(columnName)) == true) { - chosenItems.add(record.getAttribute(columnName + "-value")); + if (result.containsKey(columnName)) { + result.get(columnName).add(record.getAttribute(columnName + "-value")); + } + else { + List items = new ArrayList(); + items.add(record.getAttribute(columnName + "-value")); + result.put(columnName, items); + } } } } - return selected; + return result; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 5b551e3a58d5 -r d5821c6f0ab0 flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java Mon Dec 03 17:10:08 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java Mon Dec 03 17:25:49 2012 +0100 @@ -176,11 +176,20 @@ GWT.log ("validation. validation. validation. "); List errors = new ArrayList(); // Early stop on one (only) error. + boolean ok = false; for (Map.Entry> entry : matrix.getSelection().entrySet()) { + /* single entries are allowed!! if (entry.getValue() == null || entry.getValue().size() == 0) { errors.add(MESSAGES.error_values_needed()); return errors; } + */ + if (entry.getValue() != null && entry.getValue().size() > 0) { + ok = true; + } + } + if (!ok) { + errors.add(MESSAGES.error_values_needed()); } return errors; }