Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java @ 5455:45c5b8b08ffd
Schema Change: use parameter instead of fraction in sq_relation_value
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Wed, 27 Mar 2013 12:45:52 +0100 |
parents | 8e66293c5369 |
children |
rev | line source |
---|---|
2306
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
3649
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
3 import org.apache.log4j.Logger; |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
4 import org.w3c.dom.Element; |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
5 |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
6 import de.intevation.artifacts.Artifact; |
2312
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
7 import de.intevation.artifacts.CallContext; |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
8 import de.intevation.artifacts.common.utils.StringUtils; |
3649
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
9 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
10 import de.intevation.flys.artifacts.WINFOArtifact; |
2312
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
11 |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
12 |
2306
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 /** |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 * Get me doubles (km). |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 */ |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 public class EnterMultipleLocationsState extends EnterLocationState { |
3649
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
17 /** The logger for this class. */ |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
18 private static Logger logger = Logger.getLogger(EnterMultipleLocationsState.class); |
2306
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 @Override |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 protected String getUIProvider() { |
3649
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
22 logger.debug("multi location panel"); |
2306
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 return "multi_location_panel"; |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 } |
2312
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
25 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2314
diff
changeset
|
26 |
2312
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
27 /** Deal with multiple double values. */ |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
28 @Override |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
29 protected String getLabelFor( |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
30 CallContext cc, |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
31 String name, |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
32 String value, |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
33 String type |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
34 ) { |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
35 String[] vals = value.split(" "); |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
36 for (int i = 0; i < vals.length; i++) { |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
37 vals[i] = super.getLabelFor(cc, name, vals[i], type); |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
38 } |
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
39 |
2314
f4ca234ba214
Fix call to StringUtils.join .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2312
diff
changeset
|
40 return StringUtils.join(" ", vals); |
2312
f911ddd93f58
Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2306
diff
changeset
|
41 } |
3649
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
42 |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
43 /** |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
44 * This method creates a list of items. These items represent the amount of |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
45 * input data that is possible for this state. |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
46 * |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
47 * @param cr The ElementCreator. |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
48 * @param name The name of the amount of data. |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
49 * |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
50 * @return a list of items. |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
51 */ |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
52 @Override |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
53 protected Element[] createItems( |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
54 ElementCreator cr, |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
55 Artifact artifact, |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
56 String name, |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
57 CallContext context |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
58 ) { |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
59 if (name.equals("reference_endpoint")) { |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
60 Element[] elements = new Element[1]; |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
61 WINFOArtifact winfo = (WINFOArtifact) artifact; |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
62 Double km = winfo.getReferenceStartKm(); |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
63 elements[0] = createItem( |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
64 cr, |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
65 new String[] {"start_km", km.toString()}); |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
66 return elements; |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
67 } |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
68 return null; |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
69 } |
33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
70 |
2306
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 } |
cc6b8af44728
Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |