comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerRangeData.java @ 1522:df9baca681a0

Added a new Data type IntegerRangeData that stores min and max integer values. flys-client/trunk@3699 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 18 Jan 2012 09:14:17 +0000
parents
children 487c3ff7e838
comparison
equal deleted inserted replaced
1521:f22713b5d29d 1522:df9baca681a0
1 package de.intevation.flys.client.shared.model;
2
3
4 public class IntegerRangeData implements Data {
5
6 protected String label;
7 protected String description;
8
9 protected int lower;
10 protected int upper;
11
12
13 public IntegerRangeData() {
14 }
15
16
17 public IntegerRangeData(String label, String desc, int lower, int upper) {
18 this.label = label;
19 this.description = desc;
20 this.lower = lower;
21 this.upper = upper;
22 }
23
24
25 /**
26 * Returns the label of the item.
27 *
28 * @return the label.
29 */
30 public String getLabel() {
31 return label;
32 }
33
34
35 /**
36 * Returns the description of the item.
37 *
38 * @return the description.
39 */
40 public String getDescription() {
41 return description;
42 }
43
44
45 /**
46 * Returns the type of the item.
47 *
48 * @return the type.
49 */
50 public String getType() {
51 return "intrange";
52 }
53
54
55 /**
56 * Returns the DataItems provided by this Data object.
57 *
58 * @return the DataItems.
59 */
60 public DataItem[] getItems() {
61 String theMin = String.valueOf(lower);
62 DataItem min = new DefaultDataItem(theMin, theMin, theMin);
63
64 String theMax = String.valueOf(upper);
65 DataItem max = new DefaultDataItem(theMax, theMax, theMax);
66
67 return new DataItem[] { min, max };
68 }
69
70
71 /**
72 * @return always null.
73 */
74 public DataItem getDefault() {
75 return null;
76 }
77
78
79 public int getLower() {
80 return lower;
81 }
82
83
84 public int getUpper() {
85 return upper;
86 }
87 }
88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org