annotate gwt-client/src/main/java/org/dive4elements/river/client/client/event/RangeFilterEvent.java @ 7731:91a57b66c7ed

Client side fix for flys/issue1549
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 20 Jan 2014 12:44:16 +0100
parents ea9eef426962
children
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.client.event;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
11 import com.google.gwt.i18n.client.NumberFormat;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
12
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 /**
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 */
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 public class RangeFilterEvent {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
18 protected Float from;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
19 protected Float to;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20
7731
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
21 private static Float asFloat(NumberFormat nf, String x) {
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
22 try {
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
23 return Float.valueOf((float)nf.parse(x));
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
24 }
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
25 catch (NumberFormatException nfe) {
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
26 return Float.NaN;
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
27 }
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
28 }
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
29
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 public RangeFilterEvent(String from, String to) {
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
32 NumberFormat nf = NumberFormat.getDecimalFormat();
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
33
7731
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
34 this.from = asFloat(nf, from);
91a57b66c7ed Client side fix for flys/issue1549
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
35 this.to = asFloat(nf, to);
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
39 public Float getFrom() {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
40 return this.from;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
44 public Float getTo() {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
45 return this.to;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org