annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java @ 4029:f613268af51f

Fix dates in changelog and a typo
author Björn Ricks <bjoern.ricks@intevation.de>
date Thu, 04 Oct 2012 14:10:32 +0200
parents 33bfc01410fb
children 8e66293c5369
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 label = "";
f911ddd93f58 Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2306
diff changeset
36 String[] vals = value.split(" ");
f911ddd93f58 Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2306
diff changeset
37 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
38 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
39 }
f911ddd93f58 Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2306
diff changeset
40
2314
f4ca234ba214 Fix call to StringUtils.join .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2312
diff changeset
41 return StringUtils.join(" ", vals);
2312
f911ddd93f58 Format multiple double values with a locale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2306
diff changeset
42 }
3649
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 /**
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
45 * 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
46 * 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
47 *
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
48 * @param cr The ElementCreator.
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
49 * @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
50 *
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
51 * @return a list of items.
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
52 */
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
53 @Override
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
54 protected Element[] createItems(
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
55 ElementCreator cr,
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
56 Artifact artifact,
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
57 String name,
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
58 CallContext context
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
59 ) {
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
60 if (name.equals("reference_endpoint")) {
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
61 Element[] elements = new Element[1];
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
62 WINFOArtifact winfo = (WINFOArtifact) artifact;
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
63 Double km = winfo.getReferenceStartKm();
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
64 elements[0] = createItem(
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
65 cr,
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
66 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
67 return elements;
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
68 }
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
69 return null;
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
70 }
33bfc01410fb Merged revisions 5375,5379,5382 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
71
2306
cc6b8af44728 Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 }
cc6b8af44728 Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org