Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java @ 1135:c8c753931514
Added a fallback mechanism to style mapserver layers as long as the theme mechanism is not implemented for maps (as it is for charts).
flys-artifacts/trunk@2656 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 06 Sep 2011 17:41:07 +0000 |
parents | eccf966fb677 |
children | 8da5f5a9ed3c |
rev | line source |
---|---|
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
669
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
3 import java.text.NumberFormat; |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
4 import java.util.Iterator; |
669
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
5 import java.util.Locale; |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.util.Map; |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
7 import java.util.List; |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.Logger; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.Document; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.w3c.dom.Element; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.w3c.dom.Node; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
306
35301cc3b875
Modified the states' describe() method - related to the last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
142
diff
changeset
|
15 import de.intevation.artifacts.Artifact; |
142
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
16 import de.intevation.artifacts.ArtifactNamespaceContext; |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.CallContext; |
142
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
18 import de.intevation.artifacts.CallMeta; |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifacts.common.utils.XMLUtils; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifactdatabase.ProtocolUtils; |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
23 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifactdatabase.data.StateData; |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
25 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.artifactdatabase.state.AbstractState; |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
27 import de.intevation.artifactdatabase.state.Facet; |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
29 import de.intevation.flys.artifacts.FLYSArtifact; |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
30 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.flys.artifacts.resources.Resources; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 /** |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 */ |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 public abstract class DefaultState extends AbstractState { |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
958
diff
changeset
|
39 /** The logger that is used in this class. */ |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 private static Logger logger = Logger.getLogger(DefaultState.class); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
42 public static enum ComputeType { |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
941
diff
changeset
|
43 FEED, ADVANCE, INIT |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
44 } |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
46 protected StateData getData(FLYSArtifact artifact, String name) { |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
47 return artifact.getData(name); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
48 } |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
49 |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
50 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
51 public Element describeStatic( |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
52 Artifact artifact, |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
53 Document document, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
54 Node root, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
55 CallContext context, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
56 String uuid) |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
57 { |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
58 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
59 document, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
60 ArtifactNamespaceContext.NAMESPACE_URI, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
61 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
62 |
142
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
63 CallMeta meta = context.getMeta(); |
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
64 |
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
65 String label = Resources.getMsg(meta, getID(), getID()); |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
135
diff
changeset
|
66 Element ui = ProtocolUtils.createArtNode( |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
67 creator, "state", |
136
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
135
diff
changeset
|
68 new String[] { "name", "uiprovider", "label" }, |
2e510c998adb
New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
135
diff
changeset
|
69 new String[] { getID(), getUIProvider(), label }); |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
70 |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
71 Map<String, StateData> theData = getData(); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
72 if (theData == null) { |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
73 return ui; |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
74 } |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
75 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
76 Iterator<String> iter = theData.keySet().iterator(); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
77 FLYSArtifact flys = (FLYSArtifact) artifact; |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
78 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
79 while (iter.hasNext()) { |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
80 String name = iter.next(); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
81 StateData data = getData(flys, name); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
82 |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
83 String value = data != null ? (String) data.getValue() : null; |
142
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
84 |
379
c21fb8de54f8
Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
322
diff
changeset
|
85 if (value == null) { |
c21fb8de54f8
Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
322
diff
changeset
|
86 continue; |
c21fb8de54f8
Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
322
diff
changeset
|
87 } |
c21fb8de54f8
Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
322
diff
changeset
|
88 |
142
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
89 logger.debug("Append element '" + name + "' (" + value + ")"); |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
90 |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
91 Element dataElement = creator.create("data"); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
92 creator.addAttr(dataElement, "name", name, true); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
93 creator.addAttr(dataElement, "type", data.getType(), true); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
94 |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
95 Element itemElement = creator.create("item"); |
142
b43671a551d1
Append human readable strings of the selected values to the DESCRIBE output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
136
diff
changeset
|
96 creator.addAttr(itemElement, "value", value, true); |
669
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
97 |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
98 String attrValue = ""; |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
99 try { |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
100 // XXX A better way to format the output would be to use the |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
101 // 'type' value if the data objects. |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
102 double doubleVal = Double.valueOf(value); |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
103 Locale l = Resources.getLocale(meta); |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
104 NumberFormat nf = NumberFormat.getInstance(l); |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
105 |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
106 attrValue = nf.format(doubleVal); |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
107 } |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
108 catch (NumberFormatException nfe) { |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
109 attrValue = Resources.getMsg(meta, value, value); |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
110 } |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
111 |
23fced04ffdb
#103 PART 1: The numbers which are written into the static DESCRIBE part are i18n formatted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
660
diff
changeset
|
112 creator.addAttr(itemElement, "label", attrValue, true); |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
113 |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
114 dataElement.appendChild(itemElement); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
115 ui.appendChild(dataElement); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
116 } |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
117 |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
118 return ui; |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
119 } |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
120 |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
129
diff
changeset
|
121 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 public Element describe( |
306
35301cc3b875
Modified the states' describe() method - related to the last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
142
diff
changeset
|
123 Artifact artifact, |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 Document document, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 Node root, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 CallContext context, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 String uuid) |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 { |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 document, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 ArtifactNamespaceContext.NAMESPACE_URI, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
135
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
134 Element ui = null; |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
135 String uiprovider = getUIProvider(); |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
136 if (uiprovider != null) { |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
137 ui = ProtocolUtils.createArtNode( |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
138 creator, "dynamic", |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
139 new String[] { "uiprovider" }, |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
140 new String[] { uiprovider }); |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
141 } |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
142 else { |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
143 ui = ProtocolUtils.createArtNode(creator, "dynamic", null, null); |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
144 } |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 Map<String, StateData> theData = getData(); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 if (theData == null) { |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 return ui; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 } |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
151 Iterator<String> iter = theData.keySet().iterator(); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
152 FLYSArtifact flys = (FLYSArtifact) artifact; |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
154 while (iter.hasNext()) { |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
155 String name = iter.next(); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
156 StateData data = getData(flys, name); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
157 |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
158 data = data != null ? data : getData(name); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
379
diff
changeset
|
159 |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
160 Element select = createData(creator, artifact, data, context); |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 |
630
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
162 String defValue = (String) data.getValue(); |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
163 String defDesc = null; |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
164 |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
165 if (defValue != null && defValue.length() > 0) { |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
166 defDesc = Resources.getMsg( |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
167 context.getMeta(), |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
168 defValue, |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
169 defValue); |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
170 } |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
171 |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
172 if (defValue != null && defDesc != null) { |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
173 creator.addAttr(select, "defaultValue", defValue, true); |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
174 creator.addAttr(select, "defaultLabel", defDesc, true); |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
175 } |
40d3039f85ac
ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
176 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 Element choices = ProtocolUtils.createArtNode( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 creator, "choices", null, null); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 select.appendChild(choices); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 ui.appendChild(select); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
183 Element[] items = createItems(creator, artifact, name, context); |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
630
diff
changeset
|
184 if (items != null) { |
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
630
diff
changeset
|
185 for (Element item: items) { |
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
630
diff
changeset
|
186 choices.appendChild(item); |
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
630
diff
changeset
|
187 } |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 } |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 } |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 return ui; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 } |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 /** |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 * This method creates the root node that contains the list of selectable |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 * items. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 * |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 * @param cr The ElementCreator. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 * @param name The name of the amount of data. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 * |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 * @return the root node of the item list. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 */ |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 protected Element createData( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 XMLUtils.ElementCreator cr, |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
206 Artifact artifact, |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 StateData data, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 CallContext context) |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 { |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 Element select = ProtocolUtils.createArtNode( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 cr, "select", null, null); |
129
b06cd117b565
Appended a missing node to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
212 cr.addAttr(select, "name", data.getName(), true); |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 Element label = ProtocolUtils.createArtNode( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 cr, "label", null, null); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 |
129
b06cd117b565
Appended a missing node to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
217 select.appendChild(label); |
b06cd117b565
Appended a missing node to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
218 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 label.setTextContent(Resources.getMsg( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 context.getMeta(), |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 getID(), |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 getID())); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 return select; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 } |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 /** |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 * This method creates a list of items. These items represent the amount of |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 * input data that is possible for this state. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 * |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 * @param cr The ElementCreator. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 * @param name The name of the amount of data. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 * |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 * @return a list of items. |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 */ |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
237 protected Element[] createItems( |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 XMLUtils.ElementCreator cr, |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
239 Artifact artifact, |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 String name, |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
241 CallContext context |
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
242 ) { |
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
243 return null; |
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
244 } |
135
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
245 |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
246 |
322
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
247 /** |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
248 * This method validates the inserted data and returns true, if everything |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
249 * was correct, otherwise an exception is thrown. |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
250 * |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
251 * @param artifact A reference to the owner artifact. |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
252 * |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
253 * @return true, if everything was fine. |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
254 */ |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
255 public boolean validate(Artifact artifact) |
322
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
256 throws IllegalArgumentException |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
257 { |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
258 return true; |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
259 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
260 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
261 |
135
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
262 protected String getUIProvider() { |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
263 return null; |
2d6e02787d00
Added a method to retrieve the UIProvider for a state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
264 } |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
669
diff
changeset
|
265 |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
266 public Object computeAdvance( |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
267 FLYSArtifact artifact, |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
268 String hash, |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
697
diff
changeset
|
269 CallContext context, |
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
697
diff
changeset
|
270 List<Facet> facets, |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
271 Object old |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
272 ) { |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
273 return null; |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
274 } |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
669
diff
changeset
|
275 |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
276 public Object computeFeed( |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
277 FLYSArtifact artifact, |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
278 String hash, |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
279 CallContext context, |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
697
diff
changeset
|
280 List<Facet> facets, |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
281 Object old |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
687
diff
changeset
|
282 ) { |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
669
diff
changeset
|
283 return null; |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
669
diff
changeset
|
284 } |
941
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
285 |
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
286 public Object computeInit( |
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
287 FLYSArtifact artifact, |
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
288 String hash, |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
289 Object context, |
941
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
290 CallMeta meta, |
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
291 List<Facet> facets) |
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
292 { |
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
293 return null; |
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
294 } |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 } |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |