Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java @ 321:9581b88f2920
Removed testing code that has been comitted by accident in the last revision.
flys-artifacts/trunk@1714 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 18 Apr 2011 09:34:18 +0000 |
parents | 89bd0417418f |
children | 448d0dc64357 |
rev | line source |
---|---|
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.w3c.dom.Element; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
7 import de.intevation.artifacts.Artifact; |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.CallContext; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.common.utils.XMLUtils; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifactdatabase.ProtocolUtils; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifactdatabase.data.StateData; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
15 import de.intevation.flys.model.River; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
16 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
17 import de.intevation.flys.artifacts.FLYSArtifact; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
18 import de.intevation.flys.artifacts.model.RiverFactory; |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.artifacts.resources.Resources; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 */ |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class LocationDistanceSelect extends DefaultState { |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 /** The logger used in this class.*/ |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 private static Logger logger = Logger.getLogger(LocationDistanceSelect.class); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 /** The default step width.*/ |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 public static final String DEFAULT_STEP = "100"; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 /** |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 * The default constructor that initializes an empty State object. |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 */ |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public LocationDistanceSelect() { |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 protected Element createData( |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 XMLUtils.ElementCreator cr, |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
41 Artifact artifact, |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 StateData data, |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 CallContext context) |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 { |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 Element select = ProtocolUtils.createArtNode( |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 cr, "select", null, null); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 cr.addAttr(select, "name", data.getName(), true); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 Element label = ProtocolUtils.createArtNode( |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 cr, "label", null, null); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 Element choices = ProtocolUtils.createArtNode( |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 cr, "choices", null, null); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 label.setTextContent(Resources.getMsg( |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 context.getMeta(), |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 data.getName(), |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 data.getName())); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 select.appendChild(label); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 return select; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 protected Element[] createItems( |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 XMLUtils.ElementCreator cr, |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
69 Artifact artifact, |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 String name, |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 CallContext context) |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 { |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
73 double[] minmax = getMinMaxDistance(artifact); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
74 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
75 double minVal = Double.MIN_VALUE; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
76 double maxVal = Double.MAX_VALUE; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
77 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
78 if (minmax != null) { |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
79 minVal = minmax[0]; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
80 maxVal = minmax[1]; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
81 } |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
82 else { |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
83 logger.warn("Could not read min/max distance values!"); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
84 } |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 if (name.equals("ld_from")) { |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
87 Element min = createItem( |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
88 cr, |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
89 new String[] {"min", new Double(minVal).toString()}); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
90 |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 return new Element[] { min }; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 else if (name.equals("ld_to")) { |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
94 Element max = createItem( |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
95 cr, |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
96 new String[] {"max", new Double(maxVal).toString()}); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
97 |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 return new Element[] { max }; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 else { |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 Element step = createItem(cr, new String[] {"step", DEFAULT_STEP}); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 return new Element[] { step }; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 Element label = ProtocolUtils.createArtNode(cr, "label", null, null); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 Element value = ProtocolUtils.createArtNode(cr, "value", null, null); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 String[] arr = (String[]) obj; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 label.setTextContent(arr[0]); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 value.setTextContent(arr[1]); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 item.appendChild(label); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 item.appendChild(value); |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 return item; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 protected String getUIProvider() { |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 return "location_distance_panel"; |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 } |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
128 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
129 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
130 protected double[] getMinMaxDistance(Artifact artifact) { |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
131 FLYSArtifact flysArtifact = (FLYSArtifact) artifact; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
132 StateData data = flysArtifact.getData("river"); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
133 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
134 String name = (String) data.getValue(); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
135 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
136 logger.debug("Search for the min/max distances of '" + name + "'"); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
137 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
138 River river = RiverFactory.getRiver(name); |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
139 |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
140 return river != null ? river.determineMinMaxDistance() : null; |
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
141 } |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 } |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |