Mercurial > dive4elements > river
comparison flys-client/src/main/java/org/dive4elements/river/client/shared/model/StringOptionsData.java @ 5834:f507086aa94b
Repaired internal references.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:31:32 +0200 |
parents | flys-client/src/main/java/de/intevation/flys/client/shared/model/StringOptionsData.java@1ea53a363db4 |
children | 821a02bbfb4e |
comparison
equal
deleted
inserted
replaced
5833:a2bdc0f524e8 | 5834:f507086aa94b |
---|---|
1 package de.intevation.flys.client.shared.model; | |
2 | |
3 | |
4 public class StringOptionsData implements Data { | |
5 | |
6 public static final String TYPE = "options"; | |
7 | |
8 protected String label; | |
9 protected String description; | |
10 | |
11 public DataItem[] opts; | |
12 | |
13 | |
14 public StringOptionsData() { | |
15 } | |
16 | |
17 | |
18 public StringOptionsData(String label, String desc, DataItem[] opts) { | |
19 this.label = label; | |
20 this.description = desc; | |
21 this.opts = opts; | |
22 } | |
23 | |
24 | |
25 /** | |
26 * Returns the label of the item. | |
27 * | |
28 * @return the label. | |
29 */ | |
30 public String getLabel() { | |
31 return label; | |
32 } | |
33 | |
34 | |
35 /** | |
36 * Returns the description of the item. | |
37 * | |
38 * @return the description. | |
39 */ | |
40 public String getDescription() { | |
41 return description; | |
42 } | |
43 | |
44 | |
45 /** | |
46 * Returns the type of the item. | |
47 * | |
48 * @return the type. | |
49 */ | |
50 public String getType() { | |
51 return TYPE; | |
52 } | |
53 | |
54 | |
55 /** | |
56 * Returns the data items which represent the allowed options for this Data. | |
57 * | |
58 * @return the allowed options as DataItem array. | |
59 */ | |
60 public DataItem[] getItems() { | |
61 return opts; | |
62 } | |
63 | |
64 | |
65 /** | |
66 * @return always null. | |
67 */ | |
68 public DataItem getDefault() { | |
69 return null; | |
70 } | |
71 | |
72 | |
73 /** | |
74 * Returns the values as colon separated string. | |
75 * | |
76 * @return colon separated string. | |
77 */ | |
78 public String getStringValue() { | |
79 String data = ""; | |
80 boolean first = true; | |
81 for (int i = 0; i < opts.length; i++) { | |
82 if (!first) { | |
83 data += ";"; | |
84 } | |
85 data += opts[i].getStringValue(); | |
86 first = false; | |
87 } | |
88 return data; | |
89 } | |
90 } | |
91 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |