Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/CalculationSelect.java @ 138:38b60ebc71b5
Added new states to insert location/distance and w/q data in the config of a WINFO artifact.
flys-artifacts/trunk@1515 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 18 Mar 2011 09:42:21 +0000 |
parents | 21d791e21aca |
children | 7f909429ccc8 |
rev | line source |
---|---|
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.w3c.dom.Element; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.artifacts.CallContext; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.common.utils.XMLUtils; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifactdatabase.ProtocolUtils; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 /** |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 */ |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 public class CalculationSelect extends DefaultState { |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 /** The logger that is used in this class.*/ |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 private static Logger logger = Logger.getLogger(CalculationSelect.class); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 protected Element[] createItems( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 XMLUtils.ElementCreator cr, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 String name, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 CallContext context) |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 { |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 Element one = createItem(cr, new String[] {"Abflusskurve", "1"}); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 Element two = createItem(cr, new String[] {"Wasserspiegellage", "2"}); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 return new Element[] { one, two }; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 } |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 Element label = ProtocolUtils.createArtNode(cr, "label", null, null); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 Element value = ProtocolUtils.createArtNode(cr, "value", null, null); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 String[] arr = (String[]) obj; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 label.setTextContent(arr[0]); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 value.setTextContent(arr[1]); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 item.appendChild(label); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 item.appendChild(value); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 return item; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 } |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 } |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |