Mercurial > dive4elements > river
diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DoubleRangePanel.java @ 7748:316a9eeb0836
Hopefully a cleaner fix for flys/issue1549 using the FloatRangeValidator from SmartGWT to verify that the 'to' field stays positive.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 21 Feb 2014 15:28:08 +0100 |
parents | 1d6b957d8953 |
children | 7337034eb5d5 |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DoubleRangePanel.java Tue Feb 11 16:18:57 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DoubleRangePanel.java Fri Feb 21 15:28:08 2014 +0100 @@ -45,9 +45,6 @@ * distance.*/ public static final String FIELD_WIDTH = "step"; - /** Whether or not negative 'to' values are allowed. */ - protected boolean negativeToAllowed = true; - /** The textboxes */ protected FloatItem fromItem; protected FloatItem toItem; @@ -57,6 +54,10 @@ public DoubleRangePanel() { } + public FloatItem getToItem() { + return toItem; + } + /** * Creates a new form with a single input field that displays an array of @@ -156,11 +157,6 @@ stepItem.setValue(f.format(steps)); } - public void setNegativeToAllowed(boolean isAllowed) { - negativeToAllowed = isAllowed; - } - - public boolean validateForm() { try { return @@ -197,14 +193,12 @@ @SuppressWarnings("rawtypes") Map errors = getErrors(); - Double d = 0d; - try { if (v == null) { throw new NumberFormatException("empty"); } - d = f.parse(v); + f.parse(v); errors.remove(item.getFieldName()); } @@ -216,17 +210,6 @@ valid = false; } - if (negativeToAllowed == false - && item.getFieldName().equals(FIELD_TO) && d < 0d) { - errors.put(item.getFieldName(), MESSAGES.toShouldNotBeNegative()); - - item.setValue(""); - - item.focusInItem(); - - valid = false; - } - setErrors(errors, true); return valid;