comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/LongRangeData.java @ 2468:6a65694bdcc2

Issue 506. Gauge time range panel now accepts dates. The dates are stored as long values. flys-client/trunk@4176 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 20 Mar 2012 14:53:42 +0000
parents
children d0a9acddbea2
comparison
equal deleted inserted replaced
2467:070321cf17e1 2468:6a65694bdcc2
1 package de.intevation.flys.client.shared.model;
2
3 /**
4 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
5 */
6 public class LongRangeData implements RangeData {
7
8 public static final String TYPE = "longrange";
9
10
11 protected String label;
12 protected String description;
13
14 protected long lower;
15 protected long upper;
16
17 protected Long defLower;
18 protected Long defUpper;
19
20
21 public LongRangeData() {
22 }
23
24
25 public LongRangeData(String label, String desc, long lower, long upper) {
26 this(label, desc, lower, upper, null, null);
27 }
28
29
30 /**
31 * @param label
32 * @param desc
33 * @param lower
34 * @param upper
35 * @param defLower
36 * @param defUpper
37 */
38 public LongRangeData(
39 String label,
40 String desc,
41 long lower,
42 long upper,
43 Long defLower,
44 Long defUpper
45 ) {
46 this.label = label;
47 this.description = desc;
48 this.lower = lower;
49 this.upper = upper;
50 this.defLower = defLower;
51 this.defUpper = defUpper;
52 }
53
54
55 /**
56 * Returns the label of the item.
57 *
58 * @return the label.
59 */
60 public String getLabel() {
61 return label;
62 }
63
64
65 /**
66 * Returns the description of the item.
67 *
68 * @return the description.
69 */
70 public String getDescription() {
71 return description;
72 }
73
74
75 /**
76 * Returns the type of the item.
77 *
78 * @return the type.
79 */
80 public String getType() {
81 return "longrange";
82 }
83
84
85 /**
86 * Returns a DataItem which value is a string that consists of the min and
87 * max value separated by a ';'.
88 *
89 * @return the DataItem.
90 */
91 public DataItem[] getItems() {
92 String theMin = String.valueOf(lower);
93 String theMax = String.valueOf(upper);
94
95 String label = theMin + " - " + theMax;
96 String value = theMin + ";" + theMax;
97
98 DataItem item = new DefaultDataItem(label, label, value);
99
100 return new DataItem[] { item };
101 }
102
103
104 /**
105 * @return always null.
106 */
107 public DataItem getDefault() {
108 return null;
109 }
110
111
112 public Object getLower() {
113 return lower;
114 }
115
116
117 public Object getUpper() {
118 return upper;
119 }
120
121
122 public Object getDefaultLower() {
123 return defLower;
124 }
125
126
127 public Object getDefaultUpper() {
128 return defUpper;
129 }
130 }
131 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org