Mercurial > dive4elements > river
comparison flys-client/src/main/java/org/dive4elements/river/client/shared/model/LongRangeData.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/LongRangeData.java@b5bf8a2da8d8 |
children | 821a02bbfb4e |
comparison
equal
deleted
inserted
replaced
5833:a2bdc0f524e8 | 5834:f507086aa94b |
---|---|
1 package de.intevation.flys.client.shared.model; | |
2 | |
3 | |
4 /** | |
5 * Long Range (e.g. storing dates). | |
6 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
7 */ | |
8 public class LongRangeData implements RangeData { | |
9 | |
10 public static final String TYPE = "longrange"; | |
11 | |
12 protected String label; | |
13 protected String description; | |
14 | |
15 protected long lower; | |
16 protected long upper; | |
17 | |
18 protected Long defLower; | |
19 protected Long defUpper; | |
20 | |
21 | |
22 public LongRangeData() { | |
23 } | |
24 | |
25 | |
26 public LongRangeData(String label, String desc, long lower, long 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 LongRangeData( | |
40 String label, | |
41 String desc, | |
42 long lower, | |
43 long upper, | |
44 Long defLower, | |
45 Long 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 "longrange"; | |
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 : |