Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterMultipleLocationsState.java @ 5831:bd047b71ab37
Repaired internal references
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:06:39 +0200 |
parents | flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterMultipleLocationsState.java@8e66293c5369 |
children |
comparison
equal
deleted
inserted
replaced
5830:160f53ee0870 | 5831:bd047b71ab37 |
---|---|
1 package org.dive4elements.river.artifacts.states; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 import org.w3c.dom.Element; | |
5 | |
6 import org.dive4elements.artifacts.Artifact; | |
7 import org.dive4elements.artifacts.CallContext; | |
8 import org.dive4elements.artifacts.common.utils.StringUtils; | |
9 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | |
10 import org.dive4elements.river.artifacts.WINFOArtifact; | |
11 | |
12 | |
13 /** | |
14 * Get me doubles (km). | |
15 */ | |
16 public class EnterMultipleLocationsState extends EnterLocationState { | |
17 /** The logger for this class. */ | |
18 private static Logger logger = Logger.getLogger(EnterMultipleLocationsState.class); | |
19 | |
20 @Override | |
21 protected String getUIProvider() { | |
22 logger.debug("multi location panel"); | |
23 return "multi_location_panel"; | |
24 } | |
25 | |
26 | |
27 /** Deal with multiple double values. */ | |
28 @Override | |
29 protected String getLabelFor( | |
30 CallContext cc, | |
31 String name, | |
32 String value, | |
33 String type | |
34 ) { | |
35 String[] vals = value.split(" "); | |
36 for (int i = 0; i < vals.length; i++) { | |
37 vals[i] = super.getLabelFor(cc, name, vals[i], type); | |
38 } | |
39 | |
40 return StringUtils.join(" ", vals); | |
41 } | |
42 | |
43 /** | |
44 * This method creates a list of items. These items represent the amount of | |
45 * input data that is possible for this state. | |
46 * | |
47 * @param cr The ElementCreator. | |
48 * @param name The name of the amount of data. | |
49 * | |
50 * @return a list of items. | |
51 */ | |
52 @Override | |
53 protected Element[] createItems( | |
54 ElementCreator cr, | |
55 Artifact artifact, | |
56 String name, | |
57 CallContext context | |
58 ) { | |
59 if (name.equals("reference_endpoint")) { | |
60 Element[] elements = new Element[1]; | |
61 WINFOArtifact winfo = (WINFOArtifact) artifact; | |
62 Double km = winfo.getReferenceStartKm(); | |
63 elements[0] = createItem( | |
64 cr, | |
65 new String[] {"start_km", km.toString()}); | |
66 return elements; | |
67 } | |
68 return null; | |
69 } | |
70 | |
71 } | |
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |