Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/RadioSelect.java @ 9053:ad2ae847e10e
- RadioButton-Auswahl generisch
- Überflutungsdauern (inudation of infrastructures) Ablauf states
author | gernotbelger |
---|---|
date | Fri, 04 May 2018 13:17:57 +0200 |
parents | |
children | 2f5052835b76 |
comparison
equal
deleted
inserted
replaced
9052:a6c19528ac16 | 9053:ad2ae847e10e |
---|---|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.states; | |
11 | |
12 import java.util.List; | |
13 | |
14 import org.dive4elements.artifacts.Artifact; | |
15 import org.dive4elements.artifacts.CallContext; | |
16 import org.dive4elements.artifacts.CallMeta; | |
17 import org.dive4elements.artifacts.common.utils.XMLUtils; | |
18 import org.dive4elements.river.artifacts.resources.Resources; | |
19 import org.w3c.dom.Element; | |
20 | |
21 /** | |
22 * @author Domenico Nardi Tironi | |
23 * | |
24 */ | |
25 public abstract class RadioSelect extends DefaultState { | |
26 | |
27 private static final long serialVersionUID = 1L; | |
28 private final List<String> entries; | |
29 | |
30 public RadioSelect() { | |
31 super(); | |
32 this.entries = makeEntries(); | |
33 } | |
34 | |
35 protected abstract List<String> makeEntries(); | |
36 | |
37 @Override | |
38 protected final String getUIProvider() { | |
39 return "radio_panel"; | |
40 } | |
41 | |
42 @Override | |
43 protected Element[] createItems(final XMLUtils.ElementCreator ec, final Artifact artifact, final String name, final CallContext context) { | |
44 final CallMeta meta = context.getMeta(); | |
45 final Element[] elements = new Element[this.entries.size()]; | |
46 int i = 0; | |
47 for (final String item : this.entries) { | |
48 elements[i] = createItem(ec, new String[] { Resources.getMsg(meta, item, item), item }); | |
49 i++; | |
50 } | |
51 return elements; | |
52 } | |
53 | |
54 } |