annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/SwitchModeState.java @ 1038:9981452c7e75

First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27). gnv-artifacts/trunk@1110 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 18 May 2010 16:28:05 +0000
parents
children f953c9a559d8
rev   line source
1038
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.state;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import de.intevation.artifactdatabase.XMLUtils;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import de.intevation.artifacts.CallContext;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import de.intevation.artifacts.CallMeta;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import de.intevation.artifacts.PreferredLocale;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Document;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.w3c.dom.Element;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Node;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 /**
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 * This task of this <code>State</code> implementation is to switch between
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 * working with vector or scalar data.
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 *
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 */
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public class SwitchModeState extends StateBase {
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 public static final String VECTOR_VALUE = "vector";
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public static final String SCALAR_VALUE = "scalar";
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 public static final String RESSOURCE_VECTOR = "vectorvalues";
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 public static final String RESSOURCE_SCALAR = "scalarvalues";
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 private static Logger logger = Logger.getLogger(SwitchModeState.class);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 public SwitchModeState() {
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 }
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 @Override
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 protected void describeDynamic(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 XMLUtils.ElementCreator artCreator,
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 XMLUtils.ElementCreator creator,
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 Document document,
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 Node dynamic,
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 CallContext context,
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 String uuid)
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 {
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 RessourceFactory ressource = RessourceFactory.getInstance();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 CallMeta callMeta = context.getMeta();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 PreferredLocale[] locales = callMeta.getLanguages();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 Element selectNode = creator.create("select1");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 creator.addAttr(selectNode, "ref", dataName);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 Element labelNode = creator.create("label");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 labelNode.setTextContent(ressource.getRessource(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 locales, dataName, dataName));
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 selectNode.appendChild(labelNode);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 selectNode.appendChild(createChoices(creator, context));
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 dynamic.appendChild(selectNode);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 logger.debug("creating dynamic ui elements finished");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 }
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 protected Node createChoices(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 XMLUtils.ElementCreator creator,
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 CallContext context)
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 {
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 RessourceFactory ressource = RessourceFactory.getInstance();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 CallMeta callMeta = context.getMeta();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 PreferredLocale[] locales = callMeta.getLanguages();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 Element choiceNodes = creator.create("choices");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 // add choice for scalar values
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 logger.debug("create choice for scalar values");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 Element scalar = creator.create("item");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 Element label = creator.create("label");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 label.setTextContent(ressource.getRessource(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 locales, RESSOURCE_SCALAR, RESSOURCE_SCALAR));
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 scalar.appendChild(label);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 Element value = creator.create("value");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 value.setTextContent(SCALAR_VALUE);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 scalar.appendChild(value);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 // add choice for vector values
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 logger.debug("create choice for vector values");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 Element vector = creator.create("item");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 label = creator.create("label");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 label.setTextContent(ressource.getRessource(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 locales, RESSOURCE_VECTOR, RESSOURCE_VECTOR));
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 vector.appendChild(label);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 value = creator.create("value");
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 value.setTextContent(VECTOR_VALUE);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 vector.appendChild(value);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 choiceNodes.appendChild(scalar);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 choiceNodes.appendChild(vector);
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 return choiceNodes;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 }
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 @Override
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 protected String[] getDescriptionForInputData(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 InputData data, CallContext context, String uuid)
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 {
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 RessourceFactory ressource = RessourceFactory.getInstance();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 CallMeta callMeta = context.getMeta();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 PreferredLocale[] locales = callMeta.getLanguages();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 String value = data.getValue();
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 if (value != null && value.equals(SCALAR_VALUE)) {
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 return new String[] { ressource.getRessource(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 locales, RESSOURCE_SCALAR, RESSOURCE_SCALAR) };
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 }
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 else if (value != null && value.equals(VECTOR_VALUE)) {
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 return new String[] { ressource.getRessource(
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 locales, RESSOURCE_VECTOR, RESSOURCE_VECTOR) };
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 }
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 return null;
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 }
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
9981452c7e75 First step: Added a new state handling the selection between vector or scalar and a new transition in timeseries to provide vector values (issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org