comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodplainChoice.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.w3c.dom.Element;
4
5 import de.intevation.artifacts.Artifact;
6 import de.intevation.artifacts.CallContext;
7 import de.intevation.artifacts.CallMeta;
8
9 import de.intevation.artifacts.common.utils.XMLUtils;
10
11 import de.intevation.artifactdatabase.ProtocolUtils;
12
13 import de.intevation.flys.artifacts.resources.Resources;
14
15
16 /**
17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
18 */
19 public class FloodplainChoice extends DefaultState {
20
21 public static final String OPTION = "floodplain.option";
22
23
24 @Override
25 protected String getUIProvider() {
26 return "boolean_panel";
27 }
28
29
30 @Override
31 protected Element[] createItems(
32 XMLUtils.ElementCreator cr,
33 Artifact artifact,
34 String name,
35 CallContext context)
36 {
37 CallMeta meta = context.getMeta();
38
39 Element option = createItem(
40 cr,
41 new String[] { Resources.getMsg(meta, OPTION, OPTION), "true" });
42
43 return new Element[] { option };
44 }
45
46
47 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
48 Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
49 Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
50 Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
51
52 String[] arr = (String[]) obj;
53
54 label.setTextContent(arr[0]);
55 value.setTextContent(arr[1]);
56
57 item.appendChild(label);
58 item.appendChild(value);
59
60 return item;
61 }
62
63
64 @Override
65 public boolean validate(Artifact artifact, CallContext context)
66 throws IllegalArgumentException
67 {
68 // TODO We have to check the user data if there is a real input!
69 return true;
70 }
71 }
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org