# HG changeset patch # User Raimund Renkert # Date 1346750373 0 # Node ID 091397efaca5585325ac53f90dd57390cde8cf03 # Parent 9f8f941351b1f7b54d5e1c0e78830af663af78f2 Issue 791: Do not allow the same values in reference and target location. flys-client/trunk@5352 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 9f8f941351b1 -r 091397efaca5 flys-client/ChangeLog --- a/flys-client/ChangeLog Tue Sep 04 07:14:29 2012 +0000 +++ b/flys-client/ChangeLog Tue Sep 04 09:19:33 2012 +0000 @@ -1,3 +1,16 @@ +2012-09-04 Raimund Renkert + + Issue 791. + + * src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java: + Do not allow the same values in reference and target location. + + * src/main/java/de/intevation/flys/client/client/FLYSConstants.java, + src/main/java/de/intevation/flys/client/client/FLYSConstants.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties: + Added i18n strings. + 2012-09-04 Felix Wolfsteller Partial fix for issue820. diff -r 9f8f941351b1 -r 091397efaca5 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Tue Sep 04 07:14:29 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Tue Sep 04 09:19:33 2012 +0000 @@ -635,6 +635,10 @@ String top_edge(); + String error_same_location(); + + String error_contains_same_location(); + // MAP RELATED STRINGS String digitize(); diff -r 9f8f941351b1 -r 091397efaca5 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Tue Sep 04 07:14:29 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Tue Sep 04 09:19:33 2012 +0000 @@ -322,6 +322,8 @@ error_bad_dgm_river = You have selected a DEM for a wrong river. error_dialog_not_valid = One or more values are not valid. error_invalid_date = The entered date is not valid. +error_same_location = Reference location equals selected location. +error_contains_same_location = Target locations contains reference location. ## map related strings digitize = images/digitize.png diff -r 9f8f941351b1 -r 091397efaca5 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Tue Sep 04 07:14:29 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Tue Sep 04 09:19:33 2012 +0000 @@ -322,6 +322,8 @@ error_bad_dgm_river = Das gew\u00e4hlte DGM passt nicht zum gew\u00e4hlten Fluss. error_dialog_not_valid = Eine oder mehrere Daten sind nicht korrekt. error_invalid_date = Das eingegebene Datum ist nicht korrekt. +error_same_location = Der gewählte Ort ist der Bezugsort. +error_contains_same_location = Zielorte beinhalten den Bezugsort. ## map related strings digitize = images/digitize.png diff -r 9f8f941351b1 -r 091397efaca5 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Tue Sep 04 07:14:29 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Tue Sep 04 09:19:33 2012 +0000 @@ -323,6 +323,8 @@ error_bad_dgm_river = You have selected a DEM for a wrong river. error_dialog_not_valid = One or more values are not valid. error_invalid_date = The entered date is not valid. +error_same_location = Reference location equals selected location. +error_contains_same_location = Target locations contains reference location. ## map related strings digitize = images/digitize.png diff -r 9f8f941351b1 -r 091397efaca5 flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java Tue Sep 04 07:14:29 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java Tue Sep 04 09:19:33 2012 +0000 @@ -171,7 +171,7 @@ locationPanel = new DoubleArrayPanel( MSG.unitLocation(), getLocationValues(), - new BlurHandler(){public void onBlur(BlurEvent be) {}}); + new BlurHandler(){public void onBlur(BlurEvent be) {validate();}}); picker.getLocationTable().setAutoFetchData(true); @@ -197,6 +197,9 @@ List errors = new ArrayList(); NumberFormat nf = NumberFormat.getDecimalFormat(); + DataList[] ref = artifact.getArtifactDescription().getOldData(); + String mode = ref[1].get(0).getStringValue(); + saveLocationValues(locationPanel); if (!locationPanel.validateForm()) { @@ -208,7 +211,14 @@ double[] good = new double[lValues.length]; int idx = 0; + double reference = + Double.valueOf(ref[2].get(0).getStringValue()).doubleValue(); for (double value: lValues) { + if (mode.equals("calc.reference.curve") && + value == reference) { + errors.add(MSG.error_contains_same_location()); + return errors; + } if (value < min || value > max) { String tmp = MSG.error_validate_range(); tmp = tmp.replace("$1", nf.format(value)); @@ -315,6 +325,17 @@ catch(NumberFormatException nfe) { // Is there anything else to do here? } + + // compare reference location and target location. + DataList[] ref = artifact.getArtifactDescription().getOldData(); + String mode = ref[1].get(0).getStringValue(); + if (mode.equals("calc.reference.curve") && + ref[2].get(0).getStringValue().equals(record.getAttribute("from"))) + { + SC.warn(MSG.error_same_location()); + return; + } + setLocationValues(selected); }