Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java @ 9176:1614cb14308f
Work on calculations for S-Info flood duration workflow
author | mschaefer |
---|---|
date | Mon, 25 Jun 2018 19:21:11 +0200 |
parents | 95643dffd006 |
children | 51b316de0d64 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java Mon Jun 25 17:58:11 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java Mon Jun 25 19:21:11 2018 +0200 @@ -12,25 +12,63 @@ import java.util.List; import org.dive4elements.river.artifacts.states.RadioSelect; +import org.dive4elements.river.model.Attribute.AttributeKey; /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class RiversideRadioChoice extends RadioSelect { + private static final long serialVersionUID = 1L; + /***** TYPES *****/ + + public enum RiversideChoiceKey { + NONE("", AttributeKey.NONE), // + LEFT("state.sinfo.riverside.left", AttributeKey.LEFT), // + RIGHT("state.sinfo.riverside.right", AttributeKey.RIGHT), // + BOTH("state.sinfo.riverside.both", AttributeKey.UNKNOWN); + + private final String key; + private final AttributeKey attributeKey; + + RiversideChoiceKey(final String key, final AttributeKey attributeKey) { + this.key = key; + this.attributeKey = attributeKey; + } + + public static RiversideChoiceKey fromKey(final String key) { + for (final RiversideChoiceKey v : values()) { + if (key.equalsIgnoreCase(v.key)) + return v; + } + return NONE; + } + + public String getKey() { + return this.key; + } + + public AttributeKey getAttributeKey() { + return this.attributeKey; + } + } + + /***** CONSTRUCTORS *****/ + public RiversideRadioChoice() { super(); } + /***** METHODS *****/ + @Override protected List<String> makeEntries() { final List<String> entries = new ArrayList<>(); - entries.add("state.sinfo.riverside.left"); - entries.add("state.sinfo.riverside.right"); - entries.add("state.sinfo.riverside.both"); + entries.add(RiversideChoiceKey.LEFT.getKey()); + entries.add(RiversideChoiceKey.RIGHT.getKey()); + entries.add(RiversideChoiceKey.BOTH.getKey()); return entries; - } } \ No newline at end of file