9062
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by Intevation GmbH |
|
3 * |
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
6 * documentation coming with Dive4Elements River for details. |
|
7 */ |
|
8 |
|
9 package org.dive4elements.river.client.client.ui; |
|
10 |
|
11 import org.dive4elements.river.client.client.artifacthelper.ArtifactHelper; |
|
12 import org.dive4elements.river.client.shared.model.Data; |
|
13 import org.dive4elements.river.client.shared.model.DataItem; |
|
14 import org.dive4elements.river.client.shared.model.DataList; |
|
15 |
|
16 public class DistanceOnlyPartPanel extends DistanceOnlyPanel { |
|
17 |
|
18 private static final long serialVersionUID = -5794138573892656947L; |
|
19 |
|
20 public DistanceOnlyPartPanel() { |
|
21 super(); |
|
22 } |
|
23 |
|
24 @Override |
|
25 protected String getLabel() { |
|
26 return this.MSG.distance_part_state(); |
|
27 } |
|
28 |
|
29 @Override |
|
30 protected String getLowerField() { |
|
31 return "ld_from_part"; |
|
32 } |
|
33 |
|
34 @Override |
|
35 protected String getUpperField() { |
|
36 return "ld_to_part"; |
|
37 } |
|
38 |
|
39 @Override |
|
40 protected void initMinMaxValues(final DataList data) { |
|
41 final ArtifactHelper helper = new ArtifactHelper(super.artifact); |
|
42 |
|
43 final Data f = helper.getOldDataByKey("ld_from"); |
|
44 final Data t = helper.getOldDataByKey("ld_to"); |
|
45 try { |
|
46 final DataItem[] fItems = f.getItems(); |
|
47 final DataItem[] tItems = t.getItems(); |
|
48 |
|
49 this.min = Double.valueOf(fItems[0].getStringValue()); |
|
50 this.max = Double.valueOf(tItems[0].getStringValue()); |
|
51 } |
|
52 catch (final NumberFormatException nfe) { |
|
53 this.min = -Double.MAX_VALUE; |
|
54 this.max = Double.MAX_VALUE; |
|
55 } |
|
56 } |
|
57 } |