Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/ChartArtifact.java @ 5000:99b452967737
Doc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 15 Feb 2013 12:47:15 +0100 |
parents | a2735a4bf75e |
children |
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 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.Artifact; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.ArtifactFactory; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.CallMeta; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.CallContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.common.utils.XMLUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifactdatabase.ProtocolUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.state.Facet; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifactdatabase.state.State; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifactdatabase.state.StateEngine; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifactdatabase.state.Output; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.utils.FLYSUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.artifacts.states.DefaultState; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.artifacts.context.FLYSContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.artifacts.resources.Resources; |
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 |
3650
cbe2febe30cc
Merged revisions 5391-5392 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3555
diff
changeset
|
32 /** Artifact, open to generate any (?) out. */ |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 public class ChartArtifact extends FLYSArtifact { |
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 private static final Logger logger = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 Logger.getLogger(ChartArtifact.class); |
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 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 public void setup( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 String identifier, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 ArtifactFactory factory, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 Object context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 CallMeta callmeta, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 Document data) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 logger.debug("ChartArtifact.setup"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 this.identifier = identifier; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 name = "new_chart"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 List<State> states = getStates(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 setCurrentState(states.get(0)); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 } |
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 @Override |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3083
diff
changeset
|
56 protected void appendBackgroundActivity( |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 ElementCreator cr, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 Element root, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 CallContext context |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 ) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 Element inBackground = cr.create("background-processing"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 root.appendChild(inBackground); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 cr.addAttr( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 inBackground, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 "value", |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 String.valueOf(context.isInBackground()), |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 true); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 |
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 /** |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 * Append output mode nodes to a document. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 */ |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3083
diff
changeset
|
75 @Override |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 protected void appendOutputModes( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 Document doc, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 Element outs, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 CallContext context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 String uuid) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 List<String> stateIds = getPreviousStateIds(); |
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 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 StateEngine engine = (StateEngine) flysContext.get( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 FLYSContext.STATE_ENGINE_KEY); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 for (String stateId: stateIds) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 logger.debug("Append output modes for state: " + stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 DefaultState state = (DefaultState) engine.getState(stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 List<Output> list = state.getOutputs(); |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3193
diff
changeset
|
93 if (list == null || list.isEmpty()) { |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 logger.debug("-> No output modes for this state."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 continue; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4049
diff
changeset
|
98 List<Facet> fs = getFacets(stateId); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3193
diff
changeset
|
100 if (fs == null || fs.isEmpty()) { |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 logger.debug("No facets for previous state found."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 continue; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 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
|
106 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 List<Output> generated = generateOutputs(list, fs); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 ProtocolUtils.appendOutputModes(doc, outs, generated); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 } |
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 try { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 DefaultState cur = (DefaultState) getCurrentState(context); |
2158
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
114 List<Output> list = cur.getOutputs(); |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
115 if (list != null && list.size() > 0) { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
116 logger.debug( |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
117 "Append output modes for current state: " + cur.getID()); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4049
diff
changeset
|
119 List<Facet> fs = getFacets(cur.getID()); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 |
2158
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
121 if (fs != null && fs.size() > 0) { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
122 List<Output> generated = generateOutputs(list, fs); |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
123 |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
124 logger.debug("Found " + fs.size() + " current facets."); |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
125 if (!generated.isEmpty()) { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
126 ProtocolUtils.appendOutputModes( |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
127 doc, outs, generated); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 } |
2158
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
129 } |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
130 else { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
131 logger.debug("No facets found for the current state."); |
2113
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 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 catch (IllegalArgumentException iae) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 // 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
|
137 } |
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 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 public static class ChartState extends DefaultState { |
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 public static final String FIELD_MODE = "chart_type"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 public static final String DURATION_CURVE = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 "chart.new.durationcurve"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 public static final String COMPUTED_DISCHARGE_CURVE = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 "chart.new.computeddischargecurve"; |
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 public static final String DISCHARGE_LONGITUDINAL_CURVE = |
2153
734d5f5e55c0
'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2120
diff
changeset
|
151 "chart.new.longitudinal_section"; |
2113
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 public static final String W_DIFFERENCES = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 "chart.new.w_differences"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 public static final String WATERLEVEL = |
2153
734d5f5e55c0
'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2120
diff
changeset
|
157 "chart.new.crosssection"; |
2113
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 public static final String[] CHARTS = { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 COMPUTED_DISCHARGE_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 DURATION_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 DISCHARGE_LONGITUDINAL_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 W_DIFFERENCES, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 WATERLEVEL }; |
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 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 public Object computeAdvance( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 FLYSArtifact artifact, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 String hash, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 CallContext context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 List<Facet> facets, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 Object old) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 logger.debug("ChartState.computeAdvance"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 |
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 return null; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 } |
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 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 protected Element[] createItems( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 XMLUtils.ElementCreator cr, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 Artifact artifact, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 String name, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 CallContext context) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 CallMeta meta = context.getMeta(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 Element[] charts = new Element[CHARTS.length]; |
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 int i = 0; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 for (String chart: CHARTS) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 charts[i++] = createItem( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 cr, new String[] { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 Resources.getMsg(meta, chart, chart), |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 chart |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 }); |
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 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 return charts; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 } |
3083
4bd3d8bbb60c
Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
207 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |