comparison 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
comparison
equal deleted inserted replaced
9175:34dc0163ad2d 9176:1614cb14308f
10 10
11 import java.util.ArrayList; 11 import java.util.ArrayList;
12 import java.util.List; 12 import java.util.List;
13 13
14 import org.dive4elements.river.artifacts.states.RadioSelect; 14 import org.dive4elements.river.artifacts.states.RadioSelect;
15 import org.dive4elements.river.model.Attribute.AttributeKey;
15 16
16 /** 17 /**
17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
18 */ 19 */
19 public class RiversideRadioChoice extends RadioSelect { 20 public class RiversideRadioChoice extends RadioSelect {
21
20 private static final long serialVersionUID = 1L; 22 private static final long serialVersionUID = 1L;
23
24 /***** TYPES *****/
25
26 public enum RiversideChoiceKey {
27 NONE("", AttributeKey.NONE), //
28 LEFT("state.sinfo.riverside.left", AttributeKey.LEFT), //
29 RIGHT("state.sinfo.riverside.right", AttributeKey.RIGHT), //
30 BOTH("state.sinfo.riverside.both", AttributeKey.UNKNOWN);
31
32 private final String key;
33 private final AttributeKey attributeKey;
34
35 RiversideChoiceKey(final String key, final AttributeKey attributeKey) {
36 this.key = key;
37 this.attributeKey = attributeKey;
38 }
39
40 public static RiversideChoiceKey fromKey(final String key) {
41 for (final RiversideChoiceKey v : values()) {
42 if (key.equalsIgnoreCase(v.key))
43 return v;
44 }
45 return NONE;
46 }
47
48 public String getKey() {
49 return this.key;
50 }
51
52 public AttributeKey getAttributeKey() {
53 return this.attributeKey;
54 }
55 }
56
57 /***** CONSTRUCTORS *****/
21 58
22 public RiversideRadioChoice() { 59 public RiversideRadioChoice() {
23 super(); 60 super();
24 } 61 }
25 62
63 /***** METHODS *****/
64
26 @Override 65 @Override
27 protected List<String> makeEntries() { 66 protected List<String> makeEntries() {
28 final List<String> entries = new ArrayList<>(); 67 final List<String> entries = new ArrayList<>();
29 entries.add("state.sinfo.riverside.left"); 68 entries.add(RiversideChoiceKey.LEFT.getKey());
30 entries.add("state.sinfo.riverside.right"); 69 entries.add(RiversideChoiceKey.RIGHT.getKey());
31 entries.add("state.sinfo.riverside.both"); 70 entries.add(RiversideChoiceKey.BOTH.getKey());
32 return entries; 71 return entries;
33
34 } 72 }
35 73
36 } 74 }

http://dive4elements.wald.intevation.org