Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DoubleRangeOnlyPanel.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/client/ui/DoubleRangeOnlyPanel.java@821a02bbfb4e |
children | 172338b1407f |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.client.client.ui; | |
2 | |
3 import com.google.gwt.i18n.client.NumberFormat; | |
4 | |
5 import com.smartgwt.client.types.Alignment; | |
6 import com.smartgwt.client.widgets.form.fields.FloatItem; | |
7 import com.smartgwt.client.widgets.form.fields.StaticTextItem; | |
8 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; | |
9 | |
10 | |
11 public class DoubleRangeOnlyPanel extends DoubleRangePanel { | |
12 | |
13 public DoubleRangeOnlyPanel( | |
14 String titleFrom, | |
15 String titleTo, | |
16 double from, | |
17 double to, | |
18 int width, | |
19 BlurHandler handler | |
20 ) { | |
21 this(titleFrom, titleTo, from, to, width, handler, "right"); | |
22 } | |
23 | |
24 | |
25 public DoubleRangeOnlyPanel( | |
26 String titleFrom, | |
27 String titleTo, | |
28 double from, | |
29 double to, | |
30 int width, | |
31 BlurHandler handler, | |
32 String labelOrientation | |
33 ) { | |
34 super(); | |
35 | |
36 fromItem = new FloatItem(FIELD_FROM); | |
37 toItem = new FloatItem(FIELD_TO); | |
38 stepItem = new FloatItem(FIELD_WIDTH); | |
39 | |
40 fromItem.addBlurHandler(handler); | |
41 toItem.addBlurHandler(handler); | |
42 | |
43 NumberFormat nf = NumberFormat.getDecimalFormat(); | |
44 | |
45 fromItem.setValue(nf.format(from)); | |
46 toItem.setValue(nf.format(to)); | |
47 | |
48 StaticTextItem fromText = new StaticTextItem("staticFrom"); | |
49 fromText.setValue(titleFrom); | |
50 fromText.setShowTitle(false); | |
51 fromItem.setShowTitle(false); | |
52 | |
53 StaticTextItem toText = new StaticTextItem("staticTo"); | |
54 toText.setValue(titleTo); | |
55 toText.setShowTitle(false); | |
56 toItem.setShowTitle(false); | |
57 | |
58 int itemWidth = width / 4; | |
59 fromItem.setWidth(itemWidth); | |
60 fromText.setWidth(itemWidth); | |
61 toItem.setWidth(itemWidth); | |
62 toText.setWidth(itemWidth); | |
63 | |
64 if (labelOrientation.equals("right")) { | |
65 setFields(fromItem, fromText, toItem, toText); | |
66 } | |
67 else { | |
68 setFields(fromText, fromItem, toText, toItem); | |
69 } | |
70 | |
71 setFixedColWidths(false); | |
72 setNumCols(4); | |
73 setWidth(width); | |
74 setAlign(Alignment.CENTER); | |
75 } | |
76 | |
77 | |
78 @Override | |
79 public boolean validateForm() { | |
80 return validateForm(fromItem) && validateForm(toItem); | |
81 } | |
82 | |
83 | |
84 @Override | |
85 public double getStep() { | |
86 return -1; | |
87 } | |
88 } |