Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/shared/model/MultiAttributeData.java @ 7821:5c80f419aea4 minfo-opt
Added new state data type.
The new datatype takes a set of additional attributes and stores them to a
map.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 20 Mar 2014 13:32:43 +0100 |
parents | |
children | 6e6506ec0ae0 |
comparison
equal
deleted
inserted
replaced
7819:b468dc65154a | 7821:5c80f419aea4 |
---|---|
1 package org.dive4elements.river.client.shared.model; | |
2 | |
3 | |
4 public class MultiAttributeData | |
5 implements Data | |
6 { | |
7 | |
8 public static final String TYPE = "multiattribute"; | |
9 | |
10 protected String label; | |
11 protected String description; | |
12 | |
13 public DataItem[] opts; | |
14 | |
15 | |
16 public MultiAttributeData() { | |
17 } | |
18 | |
19 | |
20 public MultiAttributeData(String label, String desc, DataItem[] opts) { | |
21 this.label = label; | |
22 this.description = desc; | |
23 this.opts = opts; | |
24 } | |
25 | |
26 | |
27 /** | |
28 * Returns the label of the item. | |
29 * | |
30 * @return the label. | |
31 */ | |
32 public String getLabel() { | |
33 return label; | |
34 } | |
35 | |
36 | |
37 /** | |
38 * Returns the description of the item. | |
39 * | |
40 * @return the description. | |
41 */ | |
42 public String getDescription() { | |
43 return description; | |
44 } | |
45 | |
46 | |
47 /** | |
48 * Returns the type of the item. | |
49 * | |
50 * @return the type. | |
51 */ | |
52 public String getType() { | |
53 return TYPE; | |
54 } | |
55 | |
56 | |
57 /** | |
58 * Returns the data items which represent the allowed options for this Data. | |
59 * | |
60 * @return the allowed options as DataItem array. | |
61 */ | |
62 public DataItem[] getItems() { | |
63 return opts; | |
64 } | |
65 | |
66 | |
67 /** | |
68 * @return always null. | |
69 */ | |
70 public DataItem getDefault() { | |
71 return null; | |
72 } | |
73 | |
74 | |
75 /** | |
76 * Returns the values as colon separated string. | |
77 * | |
78 * @return colon separated string. | |
79 */ | |
80 public String getStringValue() { | |
81 String data = ""; | |
82 boolean first = true; | |
83 for (int i = 0; i < opts.length; i++) { | |
84 if (!first) { | |
85 data += ";"; | |
86 } | |
87 data += opts[i].getStringValue(); | |
88 first = false; | |
89 } | |
90 return data; | |
91 } | |
92 } |