Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java @ 1523:07b532f9e057
Added new panels for inserting ranges, int ranges and time (year) ranges.
flys-client/trunk@3700 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 18 Jan 2012 09:19:36 +0000 |
parents | |
children | 487c3ff7e838 |
comparison
equal
deleted
inserted
replaced
1522:df9baca681a0 | 1523:07b532f9e057 |
---|---|
1 package de.intevation.flys.client.client.ui; | |
2 | |
3 import com.smartgwt.client.widgets.form.fields.FormItem; | |
4 import com.smartgwt.client.widgets.form.fields.IntegerItem; | |
5 import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator; | |
6 import com.smartgwt.client.widgets.form.validator.Validator; | |
7 | |
8 import de.intevation.flys.client.shared.model.DataList; | |
9 | |
10 | |
11 public class IntegerRangePanel extends RangePanel { | |
12 | |
13 protected Integer maxLower; | |
14 protected Integer maxUpper; | |
15 | |
16 | |
17 @Override | |
18 protected FormItem newFormItem(String name) { | |
19 IntegerItem item = new IntegerItem(name, ""); | |
20 item.setShowTitle(false); | |
21 | |
22 return item; | |
23 } | |
24 | |
25 | |
26 @Override | |
27 protected Validator[] createLowerValidators(DataList dataList) { | |
28 Validator validator = newRangeValidator(); | |
29 | |
30 if (validator != null) { | |
31 return new Validator[] { validator }; | |
32 } | |
33 | |
34 return null; | |
35 } | |
36 | |
37 | |
38 @Override | |
39 protected Validator[] createUpperValidators(DataList dataList) { | |
40 Validator validator = newRangeValidator(); | |
41 | |
42 if (validator != null) { | |
43 return new Validator[] { validator }; | |
44 } | |
45 | |
46 return null; | |
47 } | |
48 | |
49 | |
50 protected Validator newRangeValidator() { | |
51 Integer maxLower = getMaxLower(); | |
52 Integer maxUpper = getMaxUpper(); | |
53 | |
54 if (maxLower != null && maxUpper != null) { | |
55 IntegerRangeValidator validator = new IntegerRangeValidator(); | |
56 validator.setMax(maxUpper); | |
57 validator.setMin(maxLower); | |
58 | |
59 return validator; | |
60 } | |
61 | |
62 return null; | |
63 } | |
64 | |
65 | |
66 public Integer getMaxLower() { | |
67 return maxLower; | |
68 } | |
69 | |
70 | |
71 public void setMaxLower(Integer maxLower) { | |
72 this.maxLower = maxLower; | |
73 } | |
74 | |
75 | |
76 public Integer getMaxUpper() { | |
77 return maxUpper; | |
78 } | |
79 | |
80 | |
81 public void setMaxUpper(Integer maxUpper) { | |
82 this.maxUpper = maxUpper; | |
83 } | |
84 } | |
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |