comparison gwt-client/src/main/java/org/dive4elements/river/client/shared/model/IntegerRangeData.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/shared/model/IntegerRangeData.java@821a02bbfb4e
children 172338b1407f
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.client.shared.model;
2
3
4 /**
5 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
6 */
7 public class IntegerRangeData implements RangeData {
8
9 public static final String TYPE = "intrange";
10
11
12 protected String label;
13 protected String description;
14
15 protected int lower;
16 protected int upper;
17
18 protected Integer defLower;
19 protected Integer defUpper;
20
21
22 public IntegerRangeData() {
23 }
24
25
26 public IntegerRangeData(String label, String desc, int lower, int upper) {
27 this(label, desc, lower, upper, null, null);
28 }
29
30
31 /**
32 * @param label
33 * @param desc
34 * @param lower
35 * @param upper
36 * @param defLower
37 * @param defUpper
38 */
39 public IntegerRangeData(
40 String label,
41 String desc,
42 int lower,
43 int upper,
44 Integer defLower,
45 Integer defUpper
46 ) {
47 this.label = label;
48 this.description = desc;
49 this.lower = lower;
50 this.upper = upper;
51 this.defLower = defLower;
52 this.defUpper = defUpper;
53 }
54
55
56 /**
57 * Returns the label of the item.
58 *
59 * @return the label.
60 */
61 public String getLabel() {
62 return label;
63 }
64
65
66 /**
67 * Returns the description of the item.
68 *
69 * @return the description.
70 */
71 public String getDescription() {
72 return description;
73 }
74
75
76 /**
77 * Returns the type of the item.
78 *
79 * @return the type.
80 */
81 public String getType() {
82 return "intrange";
83 }
84
85
86 /**
87 * Returns a DataItem which value is a string that consists of the min and
88 * max value separated by a ';'.
89 *
90 * @return the DataItem.
91 */
92 public DataItem[] getItems() {
93 String theMin = String.valueOf(lower);
94 String theMax = String.valueOf(upper);
95
96 String label = theMin + " - " + theMax;
97 String value = theMin + ";" + theMax;
98
99 DataItem item = new DefaultDataItem(label, label, value);
100
101 return new DataItem[] { item };
102 }
103
104
105 /**
106 * @return always null.
107 */
108 public DataItem getDefault() {
109 return null;
110 }
111
112
113 public Object getLower() {
114 return lower;
115 }
116
117
118 public Object getUpper() {
119 return upper;
120 }
121
122
123 public Object getDefaultLower() {
124 return defLower;
125 }
126
127
128 public Object getDefaultUpper() {
129 return defUpper;
130 }
131
132
133 /**
134 * Returns the values as colon separated string.
135 *
136 * @return colon separated string.
137 */
138 public String getStringValue() {
139 String data = lower + ";" + upper;
140 return data;
141 }
142
143 }
144 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org