Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ScenarioSelect.java @ 927:53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
flys-artifacts/trunk@2281 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 05 Jul 2011 15:34:54 +0000 |
parents | |
children | eccf966fb677 |
comparison
equal
deleted
inserted
replaced
926:659608128823 | 927:53a2be494765 |
---|---|
1 package de.intevation.flys.artifacts.states; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 | |
5 import org.w3c.dom.Element; | |
6 | |
7 import de.intevation.artifacts.Artifact; | |
8 import de.intevation.artifacts.CallContext; | |
9 import de.intevation.artifacts.CallMeta; | |
10 | |
11 import de.intevation.artifacts.common.utils.XMLUtils; | |
12 | |
13 import de.intevation.artifactdatabase.ProtocolUtils; | |
14 | |
15 import de.intevation.flys.artifacts.resources.Resources; | |
16 | |
17 /** | |
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
19 */ | |
20 public class ScenarioSelect extends DefaultState { | |
21 | |
22 /** The logger that is used in this class.*/ | |
23 private static Logger logger = Logger.getLogger(ScenarioSelect.class); | |
24 | |
25 | |
26 public static final String FIELD_MODE = "szenario"; | |
27 | |
28 public static final String SCENARIO_CURRENT = "scenario.current"; | |
29 public static final String SCENARIO_POTENTIEL = "scenario.potentiel"; | |
30 public static final String SCENARIO_SCENRAIO = "scenario.scenario"; | |
31 | |
32 public static final String[] SCENARIOS = { | |
33 SCENARIO_CURRENT, | |
34 SCENARIO_POTENTIEL, | |
35 SCENARIO_SCENRAIO }; | |
36 | |
37 | |
38 @Override | |
39 protected Element[] createItems( | |
40 XMLUtils.ElementCreator cr, | |
41 Artifact artifact, | |
42 String name, | |
43 CallContext context) | |
44 { | |
45 CallMeta meta = context.getMeta(); | |
46 Element[] scenarios = new Element[SCENARIOS.length]; | |
47 | |
48 int i = 0; | |
49 | |
50 for (String scenario: SCENARIOS) { | |
51 scenarios[i++] = createItem( | |
52 cr, new String[] { | |
53 Resources.getMsg(meta, scenario, scenario), | |
54 scenario | |
55 }); | |
56 } | |
57 | |
58 return scenarios; | |
59 } | |
60 | |
61 | |
62 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { | |
63 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); | |
64 Element label = ProtocolUtils.createArtNode(cr, "label", null, null); | |
65 Element value = ProtocolUtils.createArtNode(cr, "value", null, null); | |
66 | |
67 String[] arr = (String[]) obj; | |
68 | |
69 label.setTextContent(arr[0]); | |
70 value.setTextContent(arr[1]); | |
71 | |
72 item.appendChild(label); | |
73 item.appendChild(value); | |
74 | |
75 return item; | |
76 } | |
77 | |
78 | |
79 @Override | |
80 public boolean validate(Artifact artifact, CallContext context) | |
81 throws IllegalArgumentException | |
82 { | |
83 // TODO | |
84 | |
85 return true; | |
86 } | |
87 } | |
88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |