Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodplainChoice.java @ 3812:f788d2d901d6
merged flys-artifacts/pre2.6-2011-12-05
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:53 +0200 (2012-09-28) |
parents | eccf966fb677 |
children | 2867ae59e216 |
comparison
equal
deleted
inserted
replaced
3808:5fab0fe3c445 | 3812:f788d2d901d6 |
---|---|
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |