Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/ChartArtifact.java @ 2119:dc28ea60b53d
Added cached/chunked access to cross section lines. TODO: Use the FastCrossSectionLines.
flys-artifacts/trunk@3689 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 16 Jan 2012 15:51:46 +0000 |
parents | d109e7702995 |
children | f021080cb409 |
rev | line source |
---|---|
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Element; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 import org.w3c.dom.Node; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.Artifact; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.ArtifactFactory; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.CallMeta; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.CallContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.common.utils.XMLUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifactdatabase.ProtocolUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifactdatabase.state.Facet; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifactdatabase.state.State; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifactdatabase.state.StateEngine; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.artifactdatabase.state.Output; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.artifactdatabase.transition.TransitionEngine; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.model.River; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.utils.FLYSUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.flys.artifacts.states.DefaultState; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.flys.artifacts.context.FLYSContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 import de.intevation.flys.artifacts.resources.Resources; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 public class ChartArtifact extends FLYSArtifact { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 private static final Logger logger = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 Logger.getLogger(ChartArtifact.class); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 public void setup( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 String identifier, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 ArtifactFactory factory, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 Object context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 CallMeta callmeta, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 Document data) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 logger.debug("ChartArtifact.setup"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 this.identifier = identifier; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 name = "new_chart"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 List<State> states = getStates(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 setCurrentState(states.get(0)); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 public Document describe(Document data, CallContext context) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 logger.debug("Describe: the current state is: " + getCurrentStateId()); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 if (logger.isDebugEnabled()) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 dumpArtifact(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 StateEngine stateEngine = (StateEngine) flysContext.get( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 FLYSContext.STATE_ENGINE_KEY); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 FLYSContext.TRANSITION_ENGINE_KEY); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 List<State> reachable = transitionEngine.getReachableStates( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 this, getCurrentState(context), stateEngine); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 Document description = XMLUtils.newDocument(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 description, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 ArtifactNamespaceContext.NAMESPACE_URI, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 Element root = ProtocolUtils.createRootNode(creator); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 description.appendChild(root); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 State current = getCurrentState(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 ProtocolUtils.appendState(creator, root, current); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 ProtocolUtils.appendReachableStates(creator, root, reachable); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 appendBackgroundActivity(creator, root, context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 Element name = ProtocolUtils.createArtNode( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 creator, "name", |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 new String[] { "value" }, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 new String[] { getName() }); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 Element ui = ProtocolUtils.createArtNode( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 creator, "ui", null, null); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 Element staticUI = ProtocolUtils.createArtNode( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 creator, "static", null, null); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 Element outs = ProtocolUtils.createArtNode( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 creator, "outputmodes", null, null); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 appendOutputModes(description, outs, context, identifier()); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 appendStaticUI(description, staticUI, context, identifier()); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 Element dynamic = current.describe( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 this, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 description, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 root, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 identifier()); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 if (dynamic != null) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 ui.appendChild(dynamic); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 ui.appendChild(staticUI); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 root.appendChild(name); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 root.appendChild(ui); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 root.appendChild(outs); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 return description; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 protected static void appendBackgroundActivity( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 ElementCreator cr, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 Element root, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 CallContext context |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 ) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 Element inBackground = cr.create("background-processing"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 root.appendChild(inBackground); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 cr.addAttr( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 inBackground, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 "value", |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 String.valueOf(context.isInBackground()), |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 true); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 /** |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 * Append output mode nodes to a document. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 */ |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 protected void appendOutputModes( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 Document doc, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 Element outs, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 CallContext context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 String uuid) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 List<String> stateIds = getPreviousStateIds(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 doc, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 ArtifactNamespaceContext.NAMESPACE_URI, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 StateEngine engine = (StateEngine) flysContext.get( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 FLYSContext.STATE_ENGINE_KEY); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 for (String stateId: stateIds) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 logger.debug("Append output modes for state: " + stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 DefaultState state = (DefaultState) engine.getState(stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 List<Output> list = state.getOutputs(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 if (list == null || list.size() == 0) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 logger.debug("-> No output modes for this state."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 continue; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 List<Facet> fs = facets.get(stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 if (fs == null || fs.size() == 0) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 logger.debug("No facets for previous state found."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 continue; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 logger.debug("Found " + fs.size() + " facets in previous states."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 List<Output> generated = generateOutputs(list, fs); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 ProtocolUtils.appendOutputModes(doc, outs, generated); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 try { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 DefaultState cur = (DefaultState) getCurrentState(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 if (cur.validate(this)) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 List<Output> list = cur.getOutputs(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 if (list != null && list.size() > 0) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 logger.debug( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 "Append output modes for current state: " + cur.getID()); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 List<Facet> fs = facets.get(cur.getID()); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 if (fs != null && fs.size() > 0) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 List<Output> generated = generateOutputs(list, fs); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 logger.debug("Found " + fs.size() + " current facets."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 if (!generated.isEmpty()) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 ProtocolUtils.appendOutputModes( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 doc, outs, generated); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
212 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 else { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 logger.debug("No facets found for the current state."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
215 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
216 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
217 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
218 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
219 catch (IllegalArgumentException iae) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
220 // state is not valid, so we do not append its outputs. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
221 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
223 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
224 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
225 /** |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 * This method appends the static data - that has already been inserted by |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 * the user - to the static node of the DESCRIBE document. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 * |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
229 * @param doc The document. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
230 * @param ui The root node. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
231 * @param context The CallContext. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 * @param uuid The identifier of the artifact. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 */ |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 protected void appendStaticUI( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
235 Document doc, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 Node ui, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 CallContext context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 String uuid) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
239 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
240 List<String> stateIds = getPreviousStateIds(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
242 logger.debug("previous states: " + stateIds); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 StateEngine engine = (StateEngine) flysContext.get( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 FLYSContext.STATE_ENGINE_KEY); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 for (String stateId: stateIds) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
248 logger.debug("Append static data for state: " + stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 DefaultState state = (DefaultState) engine.getState(stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
250 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
251 ui.appendChild(state.describeStatic(this, doc, ui, context, uuid)); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
252 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
253 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
254 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 public static class ChartState extends DefaultState { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
257 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 public static final String FIELD_MODE = "chart_type"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
259 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
260 public static final String DURATION_CURVE = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
261 "chart.new.durationcurve"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
262 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 public static final String COMPUTED_DISCHARGE_CURVE = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 "chart.new.computeddischargecurve"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 public static final String DISCHARGE_LONGITUDINAL_CURVE = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
267 "chart.new.discharge_longitudinal_section"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
268 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
269 public static final String W_DIFFERENCES = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 "chart.new.w_differences"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
271 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
272 public static final String WATERLEVEL = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
273 "chart.new.waterlevel"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
274 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
275 public static final String[] CHARTS = { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
276 COMPUTED_DISCHARGE_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
277 DURATION_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
278 DISCHARGE_LONGITUDINAL_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
279 W_DIFFERENCES, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
280 WATERLEVEL }; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
281 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
282 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
283 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
284 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
285 public Object computeAdvance( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
286 FLYSArtifact artifact, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
287 String hash, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
288 CallContext context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
289 List<Facet> facets, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
290 Object old) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
291 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
292 logger.debug("ChartState.computeAdvance"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
293 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
294 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
295 return null; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
296 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
297 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
298 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
299 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
300 protected Element[] createItems( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
301 XMLUtils.ElementCreator cr, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
302 Artifact artifact, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
303 String name, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
304 CallContext context) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
305 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
306 CallMeta meta = context.getMeta(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
307 Element[] charts = new Element[CHARTS.length]; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
308 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
309 int i = 0; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
310 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
311 for (String chart: CHARTS) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
312 charts[i++] = createItem( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
313 cr, new String[] { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
314 Resources.getMsg(meta, chart, chart), |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
315 chart |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
316 }); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
317 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
318 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
319 return charts; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
320 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
321 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
322 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
323 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
324 } |