Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/StringOptionsData.java @ 5086:4f65d833680f dami
Merge Default onto Dami branch.
Dami is now temporarily a public merge branch to fix problems
created by the merge.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 25 Feb 2013 11:50:13 +0100 |
parents | 1ea53a363db4 |
children |
rev | line source |
---|---|
2533
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.shared.model; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 public class StringOptionsData implements Data { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 public static final String TYPE = "options"; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 protected String label; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 protected String description; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 public DataItem[] opts; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 public StringOptionsData() { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 } |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 public StringOptionsData(String label, String desc, DataItem[] opts) { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 this.label = label; |
3704
1ea53a363db4
Fixed constructor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2535
diff
changeset
|
20 this.description = desc; |
2533
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 this.opts = opts; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 } |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 /** |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 * Returns the label of the item. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 * |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * @return the label. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 */ |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 public String getLabel() { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 return label; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 } |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 /** |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * Returns the description of the item. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 * |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 * @return the description. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 */ |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 public String getDescription() { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 return description; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 } |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 /** |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * Returns the type of the item. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 * |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 * @return the type. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 */ |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 public String getType() { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 return TYPE; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 /** |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 * Returns the data items which represent the allowed options for this Data. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 * |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 * @return the allowed options as DataItem array. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 */ |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 public DataItem[] getItems() { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 return opts; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 /** |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 * @return always null. |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 */ |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 public DataItem getDefault() { |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 return null; |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 } |
2535
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
71 |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
72 |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
73 /** |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
74 * Returns the values as colon separated string. |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
75 * |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
76 * @return colon separated string. |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
77 */ |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
78 public String getStringValue() { |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
79 String data = ""; |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
80 boolean first = true; |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
81 for (int i = 0; i < opts.length; i++) { |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
82 if (!first) { |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
83 data += ";"; |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
84 } |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
85 data += opts[i].getStringValue(); |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
86 first = false; |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
87 } |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
88 return data; |
d0a9acddbea2
Added an int data item used in int array data and added getter that returns
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2533
diff
changeset
|
89 } |
2533
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
f46940bdd178
Added missing StringOptionsData class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |