annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/ChartArtifact.java @ 3424:3fc5c914b1c1

Removed superfluous imports. flys-artifacts/trunk@5079 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 20 Jul 2012 07:44:00 +0000
parents 2f922be407ea
children b1912514e0f5
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 import de.intevation.artifacts.common.ArtifactNamespaceContext;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 import de.intevation.artifactdatabase.ProtocolUtils;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 import de.intevation.artifactdatabase.state.Facet;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 import de.intevation.artifactdatabase.state.State;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 import de.intevation.artifactdatabase.state.StateEngine;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 import de.intevation.artifactdatabase.state.Output;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 import de.intevation.flys.utils.FLYSUtils;
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.artifacts.states.DefaultState;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 import de.intevation.flys.artifacts.context.FLYSContext;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 import de.intevation.flys.artifacts.resources.Resources;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32
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 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 doc,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 ArtifactNamespaceContext.NAMESPACE_URI,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 ArtifactNamespaceContext.NAMESPACE_PREFIX);
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 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 StateEngine engine = (StateEngine) flysContext.get(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 FLYSContext.STATE_ENGINE_KEY);
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 for (String stateId: stateIds) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 logger.debug("Append output modes for state: " + stateId);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 DefaultState state = (DefaultState) engine.getState(stateId);
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 List<Output> list = state.getOutputs();
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 if (list == null || list.size() == 0) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 logger.debug("-> No output modes for this state.");
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 continue;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 }
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 List<Facet> fs = facets.get(stateId);
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 if (fs == null || fs.size() == 0) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 logger.debug("No facets for previous state found.");
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 continue;
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
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 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
111
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 List<Output> generated = generateOutputs(list, fs);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 ProtocolUtils.appendOutputModes(doc, outs, generated);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 try {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 DefaultState cur = (DefaultState) getCurrentState(context);
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
119 List<Output> list = cur.getOutputs();
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
120 if (list != null && list.size() > 0) {
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
121 logger.debug(
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
122 "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
123
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
124 List<Facet> fs = facets.get(cur.getID());
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
126 if (fs != null && fs.size() > 0) {
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
127 List<Output> generated = generateOutputs(list, fs);
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
128
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
129 logger.debug("Found " + fs.size() + " current facets.");
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
130 if (!generated.isEmpty()) {
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
131 ProtocolUtils.appendOutputModes(
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
132 doc, outs, generated);
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 }
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
134 }
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
135 else {
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
136 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
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 catch (IllegalArgumentException iae) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 // 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
142 }
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
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 public static class ChartState extends DefaultState {
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 FIELD_MODE = "chart_type";
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 public static final String DURATION_CURVE =
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 "chart.new.durationcurve";
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 public static final String COMPUTED_DISCHARGE_CURVE =
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 "chart.new.computeddischargecurve";
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 public static final String DISCHARGE_LONGITUDINAL_CURVE =
2153
734d5f5e55c0 'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2120
diff changeset
156 "chart.new.longitudinal_section";
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 public static final String W_DIFFERENCES =
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 "chart.new.w_differences";
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 public static final String WATERLEVEL =
2153
734d5f5e55c0 'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2120
diff changeset
162 "chart.new.crosssection";
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 public static final String[] CHARTS = {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 COMPUTED_DISCHARGE_CURVE,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 DURATION_CURVE,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 DISCHARGE_LONGITUDINAL_CURVE,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 W_DIFFERENCES,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 WATERLEVEL };
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 @Override
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 public Object computeAdvance(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 FLYSArtifact artifact,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 String hash,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 CallContext context,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 List<Facet> facets,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 Object old)
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 logger.debug("ChartState.computeAdvance");
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
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 return null;
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
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 @Override
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 protected Element[] createItems(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 XMLUtils.ElementCreator cr,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 Artifact artifact,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 String name,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 CallContext context)
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 CallMeta meta = context.getMeta();
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 Element[] charts = new Element[CHARTS.length];
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 int i = 0;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 for (String chart: CHARTS) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 charts[i++] = createItem(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 cr, new String[] {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 Resources.getMsg(meta, chart, chart),
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 chart
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 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 return charts;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2158
diff changeset
212 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org