Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/ScenarioTypeState.java @ 9369:1a4d2ce77423
radio choice fix
author | gernotbelger |
---|---|
date | Thu, 02 Aug 2018 17:39:13 +0200 |
parents | 1b2623dff742 |
children |
rev | line source |
---|---|
9036 | 1 |
2 package org.dive4elements.river.artifacts.uinfo.salix; | |
3 | |
9178
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
4 import java.util.LinkedHashMap; |
9062 | 5 |
9271 | 6 import org.dive4elements.artifactdatabase.ProtocolUtils; |
7 import org.dive4elements.artifactdatabase.data.StateData; | |
9178
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
8 import org.dive4elements.artifacts.Artifact; |
9271 | 9 import org.dive4elements.artifacts.CallContext; |
9178
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
10 import org.dive4elements.artifacts.CallMeta; |
9271 | 11 import org.dive4elements.artifacts.common.utils.XMLUtils; |
9273 | 12 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; |
9271 | 13 import org.dive4elements.river.artifacts.resources.Resources; |
9062 | 14 import org.dive4elements.river.artifacts.states.RadioSelect; |
9271 | 15 import org.w3c.dom.Element; |
9036 | 16 |
17 /** | |
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
19 */ | |
9062 | 20 public class ScenarioTypeState extends RadioSelect { |
9036 | 21 private static final long serialVersionUID = 1L; |
22 | |
23 public ScenarioTypeState() { | |
9062 | 24 super(); |
9036 | 25 } |
26 | |
9062 | 27 @Override |
9178
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
28 protected LinkedHashMap<String, String> makeEntries(final CallMeta meta, final Artifact artifact) { |
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
29 final LinkedHashMap<String, String> entries = new LinkedHashMap<>(); |
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
30 entries.put("scenarioType.option1", null); |
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
31 entries.put("scenarioType.option2", null); |
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9062
diff
changeset
|
32 entries.put("scenarioType.option3", null); |
9062 | 33 return entries; |
34 | |
35 } | |
9271 | 36 |
37 @Override | |
38 protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { | |
9273 | 39 return changeHeaderForCurrentState("state.uinfo.load.scenario_type", data.getName(), cr, context); |
40 } | |
41 | |
42 /// dieser nervige Teil dient lediglich dazu, in create() im client die Überschrift zu ändern... :-( | |
43 // Die Überschrift soll anders sein als in createOld() (links) | |
44 public static final Element changeHeaderForCurrentState(final String msgKey, final String dataName, final ElementCreator cr, final CallContext context) { | |
9271 | 45 final Element select = ProtocolUtils.createArtNode(cr, "select", null, null); |
46 | |
9273 | 47 cr.addAttr(select, "name", dataName, true); |
9271 | 48 |
49 final Element label = ProtocolUtils.createArtNode(cr, "label", null, null); | |
50 | |
9273 | 51 label.setTextContent(Resources.getMsg(context.getMeta(), msgKey)); |
9271 | 52 |
53 final Element description = ProtocolUtils.createArtNode(cr, "description", null, null); | |
54 description.setTextContent("TEST"); | |
55 select.appendChild(description); | |
56 select.appendChild(label); | |
57 | |
58 return select; | |
59 } | |
9369 | 60 |
61 @Override | |
62 protected String getDatakey() { | |
63 return "scenario_selection"; | |
64 } | |
65 | |
66 @Override | |
67 protected String getUIProvider() { | |
68 return "salix_scenariotype_radio_panel"; | |
69 } | |
9036 | 70 } |