Mercurial > dive4elements > river
changeset 7733:228be10e6165
Merge slt-simplify-cross-sections branch into default.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 22 Jan 2014 12:54:18 +0100 |
parents | 772c22b0ea12 (diff) e1b831fe435a (current diff) |
children | 46273d890da5 |
files | |
diffstat | 7 files changed, 38 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Mon Jan 20 14:04:20 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed Jan 22 12:54:18 2014 +0100 @@ -1367,5 +1367,7 @@ String current_gauge(); String suggested_label(); + + String negative_values_not_allowed_for_to(); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Mon Jan 20 14:04:20 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Jan 22 12:54:18 2014 +0100 @@ -715,3 +715,4 @@ FEDSTATE_KM = Station (Federal State) official_regulation = official Regulation +negative_values_not_allowed_for_to=Keine negativen Werte bei 'bis' erlaubt.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Mon Jan 20 14:04:20 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Jan 22 12:54:18 2014 +0100 @@ -713,3 +713,4 @@ WATERBODY = Gewässer FEDSTATE_KM = Landes-Stationierung official_regulation = amtl. Festlegung +negative_values_not_allowed_for_to=Keine negativen Werte bei 'bis' erlaubt.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Mon Jan 20 14:04:20 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Wed Jan 22 12:54:18 2014 +0100 @@ -654,3 +654,4 @@ # Get Feature Info Window PATH = Path official_regulation = Official Regulation +negative_values_not_allowed_for_to=Negative are not allowed for 'to'.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/event/RangeFilterEvent.java Mon Jan 20 14:04:20 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/event/RangeFilterEvent.java Wed Jan 22 12:54:18 2014 +0100 @@ -18,25 +18,21 @@ protected Float from; protected Float to; + private static Float asFloat(NumberFormat nf, String x) { + try { + return Float.valueOf((float)nf.parse(x)); + } + catch (NumberFormatException nfe) { + return Float.NaN; + } + } + public RangeFilterEvent(String from, String to) { NumberFormat nf = NumberFormat.getDecimalFormat(); - double d; - try { - d = nf.parse(from); - this.from = Float.valueOf(String.valueOf(d)); - } - catch(NumberFormatException nfe) { - this.from = Float.NaN; - } - try { - d = nf.parse(to); - this.to = Float.valueOf(String.valueOf(d)); - } - catch(NumberFormatException nfe) { - this.to = Float.NaN; - } + this.from = asFloat(nf, from); + this.to = asFloat(nf, to); }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DistancePanel.java Mon Jan 20 14:04:20 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DistancePanel.java Wed Jan 22 12:54:18 2014 +0100 @@ -598,22 +598,28 @@ Criterion combinedFilter = null; Criterion locationFilter = null; + if (from.equals(Float.NaN) && to.equals(Float.NaN)) { locationsTable.clearCriteria(); distancesTable.clearCriteria(); filterResultCount.setValue(""); return; } - else if (from.equals(Float.NaN)) { - combinedFilter = new Criterion("to", OperatorId.LESS_OR_EQUAL, to); + + if (from.equals(Float.NaN)) { + combinedFilter = + new Criterion("to", OperatorId.LESS_OR_EQUAL, to); + locationFilter = new Criterion("from", OperatorId.LESS_OR_EQUAL, to); + locationsTable.filterData(locationFilter); distancesTable.filterData(combinedFilter); filterResultCount.setValue(currentFiltered.getRecords().length); return; } - else if (to.equals(Float.NaN)) { + + if (to.equals(Float.NaN)) { combinedFilter = new Criterion("from", OperatorId.GREATER_OR_EQUAL, from); }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelGroundPanel.java Mon Jan 20 14:04:20 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelGroundPanel.java Wed Jan 22 12:54:18 2014 +0100 @@ -8,6 +8,8 @@ package org.dive4elements.river.client.client.ui; +import java.util.List; + public class WaterlevelGroundPanel extends DistancePanel { private static final long serialVersionUID = 6598703468619862469L; @@ -123,5 +125,16 @@ // We don't need a helper panel here. But we have to override this // method to avoid the table creation in the parent class. } + + @Override + protected void validateTo(List<String> errors) { + double to = distancePanel.getTo(); + + if (to < 0d) { + distancePanel.setTo(max); + errors.add(MSG.negative_values_not_allowed_for_to()); + } + super.validateTo(errors); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :