Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/AbstractStaticStateArtifact.java @ 5415:5bac3e75f59c
WaterlevelSelectState: Avoid npe with extreme results.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 26 Mar 2013 09:40:05 +0100 |
parents | 79878efbdf07 |
children |
rev | line source |
---|---|
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
4158
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
4 import java.util.Collection; |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 |
4158
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
7 import org.apache.log4j.Logger; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
8 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
9 import org.w3c.dom.Document; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
10 import org.w3c.dom.Element; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
11 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
12 import de.intevation.artifacts.CallContext; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
13 import de.intevation.artifacts.ArtifactNamespaceContext; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
14 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
15 import de.intevation.artifacts.common.utils.XMLUtils; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
16 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
17 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
18 import de.intevation.artifactdatabase.ProtocolUtils; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
19 import de.intevation.artifactdatabase.data.StateData; |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.state.State; |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 |
4157
44d27b8bb0bc
Store a StaticState class in staticstate member variable
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3936
diff
changeset
|
22 import de.intevation.flys.artifacts.states.StaticState; |
44d27b8bb0bc
Store a StaticState class in staticstate member variable
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3936
diff
changeset
|
23 |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 /** |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 * A abstract baseclass for Artifacts which are using only one static state. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 * |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 * This class is intended to be used without the config/stateengine to generate |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 * the static state. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
29 * |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 */ |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 public abstract class AbstractStaticStateArtifact extends StaticFLYSArtifact { |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 |
4157
44d27b8bb0bc
Store a StaticState class in staticstate member variable
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3936
diff
changeset
|
34 private transient StaticState staticstate; |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 |
4158
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
36 private static final Logger logger = |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
37 Logger.getLogger(AbstractStaticStateArtifact.class); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
38 |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 /** |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 * Get a list containing the one and only State. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 * @param context ignored. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 * @return list with one and only state. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 */ |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 @Override |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 protected List<State> getStates(Object context) { |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 ArrayList<State> states = new ArrayList<State>(); |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 states.add(getStaticState()); |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 return states; |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 } |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 /** |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
53 * Get the "current" state. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 * @param cc ignored. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 * @return always the set static state. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
56 */ |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
57 @Override |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
58 public State getCurrentState(Object cc) { |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
59 return getStaticState(); |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
60 } |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
61 |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
62 /** |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
63 * A child class must override this method to set its static state |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
64 */ |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
65 protected abstract void initStaticState(); |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
66 |
4157
44d27b8bb0bc
Store a StaticState class in staticstate member variable
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3936
diff
changeset
|
67 protected void setStaticState(StaticState state) { |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
68 this.staticstate = state; |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
69 } |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
70 |
4157
44d27b8bb0bc
Store a StaticState class in staticstate member variable
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3936
diff
changeset
|
71 protected StaticState getStaticState() { |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
72 if (staticstate == null) { |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
73 initStaticState(); |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 } |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
75 return staticstate; |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
76 } |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
77 |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
78 /** |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
79 * Get the state. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
80 * @param context ignored. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
81 * @param stateID ignored. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
82 * @return the state. |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
83 */ |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
84 @Override |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
85 protected State getState(Object context, String stateID) { |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
86 return getStaticState(); |
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
87 } |
4158
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
88 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
89 @Override |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
90 public Document describe(Document data, CallContext cc) { |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
91 logger.debug("Describe artifact: " + identifier()); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
92 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
93 Document desc = XMLUtils.newDocument(); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
94 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
95 ElementCreator creator = new ElementCreator( |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
96 desc, |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
97 ArtifactNamespaceContext.NAMESPACE_URI, |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
98 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
99 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
100 Element root = ProtocolUtils.createRootNode(creator); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
101 desc.appendChild(root); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
102 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
103 Element name = ProtocolUtils.createArtNode( |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
104 creator, "name", |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
105 new String[] { "value" }, |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
106 new String[] { getName() }); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
107 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
108 root.appendChild(name); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
109 root.appendChild(createOutputModes(cc, desc, creator)); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
110 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
111 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
112 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
113 // Add the data to an anonymous state. |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
114 Collection<StateData> datas = getAllData(); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
115 if (datas.size() > 0) { |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
116 Element ui = creator.create("ui"); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
117 Element staticE = creator.create("static"); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
118 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
119 StaticState current = getStaticState(); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
120 Element state = current.describeStatic(this, desc, root, cc, null); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
121 staticE.appendChild(state); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
122 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
123 for (StateData dataItem : datas) { |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
124 Element itemelent = creator.create("data"); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
125 creator.addAttr(itemelent, "name", dataItem.getName(), true); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
126 creator.addAttr(itemelent, "type", dataItem.getType(), true); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
127 state.appendChild(itemelent); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
128 Element valuement = creator.create("item"); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
129 creator.addAttr(valuement, "label", dataItem.getDescription(), true); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
130 creator.addAttr(valuement, "value", dataItem.getValue().toString(), true); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
131 itemelent.appendChild(valuement); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
132 } |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
133 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
134 ui.appendChild(staticE); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
135 root.appendChild(ui); |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
136 } |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
137 |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
138 return desc; |
a699d6c42a8b
Override describe method to return also a uiprovider.
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4157
diff
changeset
|
139 } |
3936
4e1b3b4ef132
Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
140 } |