comparison flys-client/src/main/java/org/dive4elements/river/client/shared/model/IntegerArrayData.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/IntegerArrayData.java@d0a9acddbea2
children 821a02bbfb4e
comparison
equal deleted inserted replaced
5833:a2bdc0f524e8 5834:f507086aa94b
1 package de.intevation.flys.client.shared.model;
2
3
4 public class IntegerArrayData implements Data {
5
6 public static final String TYPE = "intarray";
7
8
9 protected String label;
10 protected String description;
11
12 protected IntDataItem[] values;
13
14
15 public IntegerArrayData() {
16 }
17
18
19 public IntegerArrayData(
20 String label,
21 String description,
22 IntDataItem[] values
23 ) {
24 this.label = label;
25 this.description = description;
26 this.values = values;
27 }
28
29
30 /**
31 * Returns the label of the item.
32 *
33 * @return the label.
34 */
35 public String getLabel() {
36 return label;
37 }
38
39
40 /**
41 * Returns the description of the item.
42 *
43 * @return the description.
44 */
45 public String getDescription() {
46 return description;
47 }
48
49
50 /**
51 * Returns the type of the item.
52 *
53 * @return the type.
54 */
55 public String getType() {
56 return "intarray";
57 }
58
59
60 /**
61 * Returns a DataItem which value is a string that consists of the integer
62 * values separated by a ';'.
63 *
64 * @return the DataItem.
65 */
66 public DataItem[] getItems() {
67 return values;
68 }
69
70
71 /**
72 * Returns the values as array.
73 *
74 * @return the values as array.
75 */
76 public int[] getValues() {
77 int[] data = new int[values.length];
78 for (int i = 0; i < values.length; i++) {
79 data[i] = values[i].getValue();
80 }
81 return data;
82 }
83
84
85 /**
86 * Returns the values as colon separated string.
87 *
88 * @return colon separated string.
89 */
90 public String getStringValue() {
91 String data = "";
92 boolean first = true;
93 for (int i = 0; i < values.length; i++) {
94 if (!first) {
95 data += ";";
96 }
97 data += values[i].getStringValue();
98 first = false;
99 }
100 return data;
101 }
102
103 /**
104 * @return always null.
105 */
106 public DataItem getDefault() {
107 return null;
108 }
109 }
110 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org