Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 49:d573ae975330
Some refactoring (imports, etc).
flys-client/trunk@1497 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 17 Mar 2011 11:39:27 +0000 |
parents | 0d4795b4f284 |
children | a2923d63f530 |
rev | line source |
---|---|
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
3 import java.util.LinkedHashMap; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.core.client.GWT; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import com.smartgwt.client.widgets.Canvas; |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
8 import com.smartgwt.client.widgets.IButton; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import com.smartgwt.client.widgets.Label; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import com.smartgwt.client.widgets.form.DynamicForm; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import com.smartgwt.client.widgets.form.fields.FormItem; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.form.fields.RadioGroupItem; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.layout.HLayout; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import com.smartgwt.client.widgets.layout.VLayout; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.client.shared.model.Data; |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
21 import de.intevation.flys.client.shared.model.DataItem; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
22 import de.intevation.flys.client.shared.model.DefaultData; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
23 import de.intevation.flys.client.shared.model.DefaultDataItem; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.client.FLYSMessages; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 /** |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * This UIProvider creates a widget to enter locations or a distance. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 */ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 public class LocationDistancePanel |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 extends AbstractUIProvider |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 implements ChangeHandler, BlurHandler |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 { |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 /** The message class that provides i18n strings.*/ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 protected FLYSMessages MESSAGES = GWT.create(FLYSMessages.class); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 /** The constant name of the input field to enter locations.*/ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 public static final String FIELD_LOCATION = "location"; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
43 /** The constant name of the input field to enter distance.*/ |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
44 public static final String FIELD_DISTANCE = "distance"; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
45 |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 /** The constant name of the input field to enter the start of a distance.*/ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 public static final String FIELD_FROM = "from"; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 /** The constant name of the input field to enter the end of a distance.*/ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 public static final String FIELD_TO = "to"; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 /** The constant name of the input field to enter the step width of a |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * distance.*/ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 public static final String FIELD_WIDTH = "width"; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 /** The radio group for input mode selection.*/ |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
58 protected DynamicForm mode; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 /** A container that will contain the location or the distance panel.*/ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 protected HLayout container; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
63 /** The 'from' value entered in the distance mode.*/ |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
64 protected double from; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
65 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
66 /** The 'to' value entered in the distance mode.*/ |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
67 protected double to; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
68 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
69 /** The 'step' value entered in the distance mode.*/ |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
70 protected double step; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
71 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
72 /** The values entered in the location mode.*/ |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
73 protected double[] values; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
74 |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 /** |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 * Creates a new LocationDistancePanel instance. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 */ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 public LocationDistancePanel() { |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 /** |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 * This method creates a widget that contains a label, a panel with |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 * checkboxes to switch the input mode between location and distance input, |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 * and a the mode specific panel. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 * |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 * @param data The data that might be inserted. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 * |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 * @return a panel. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 */ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 public Canvas create(Data data) { |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 VLayout layout = new VLayout(); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
95 Label label = new Label(MESSAGES.location_distance_state()); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
96 Canvas widget = createWidget(data); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
97 IButton submit = new IButton(MESSAGES.next(), this); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 label.setHeight(25); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 layout.addMember(label); |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
102 layout.addMember(widget); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
103 layout.addMember(submit); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
104 |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
105 return layout; |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
106 } |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
107 |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
108 |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
109 protected Canvas createWidget(Data data) { |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
110 VLayout layout = new VLayout(); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
111 container = new HLayout(); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
112 Canvas checkboxPanel = createRadioButtonPanel(); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
113 |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
114 // the initial view will display the location input mode |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
115 Canvas locationPanel = new DoubleArrayPanel( |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
116 MESSAGES.unitLocation(), |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
117 getLocationValues(), |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
118 this); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
119 container.addMember(locationPanel); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
120 |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 layout.addMember(checkboxPanel); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 layout.addMember(container); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 // TODO Add a table on the right to select locations by mouse click |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 return layout; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 /** |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 * This method returns the selected data. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 * |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 * @return the selected/inserted data. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 */ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 public Data[] getData() { |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
136 return new Data[] { getDataFrom(), getDataTo(), getDataStep() }; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
137 } |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
139 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
140 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
141 * Returns the Data object for the 'from' attribute. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
142 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
143 * @return the Data object for the 'from' attribute. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
144 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
145 protected Data getDataFrom() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
146 String value = Double.valueOf(getFinalFrom()).toString(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
147 DataItem item = new DefaultDataItem("ld_from", "ld_from", value); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
148 return new DefaultData( |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
149 "ld_from", null, null, new DataItem[] { item }, null); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
150 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
151 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
152 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
153 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
154 * Returns the Data object for the 'to' attribute. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
155 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
156 * @return the Data object for the 'to' attribute. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
157 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
158 protected Data getDataTo() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
159 String value = Double.valueOf(getFinalTo()).toString(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
160 DataItem item = new DefaultDataItem("ld_to", "ld_to", value); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
161 return new DefaultData( |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
162 "ld_to", null, null, new DataItem[] { item }, null); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
163 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
164 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
165 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
166 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
167 * Returns the Data object for the 'step' attribute. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
168 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
169 * @return the Data object for the 'step' attribute. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
170 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
171 protected Data getDataStep() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
172 String value = Double.valueOf(getFinalStep()).toString(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
173 DataItem item = new DefaultDataItem("ld_step","ld_step", value); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
174 return new DefaultData( |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
175 "ld_step", null, null, new DataItem[] { item }, null); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
176 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
177 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
178 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
179 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
180 * Returns the value of 'from' depending on the selected input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
181 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
182 * @return the value of 'from' depending on the selected input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
183 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
184 protected double getFinalFrom() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
185 if (isLocationMode()) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
186 double[] values = getLocationValues(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
187 double value = Double.MAX_VALUE; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
188 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
189 for (double v: values) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
190 value = value < v ? value : v; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
191 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
192 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
193 return value; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
194 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
195 else { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
196 return getFrom(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
197 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
198 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
199 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
200 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
201 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
202 * Returns the value of 'to' depending on the selected input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
203 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
204 * @return the value of 'to' depending on the selected input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
205 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
206 protected double getFinalTo() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
207 if (isLocationMode()) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
208 double[] values = getLocationValues(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
209 double value = Double.MIN_VALUE; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
210 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
211 for (double v: values) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
212 value = value > v ? value : v; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
213 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
214 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
215 return value; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
216 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
217 else { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
218 return getTo(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
219 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
220 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
221 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
222 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
223 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
224 * Returns the value of 'step' depending on the selected input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
225 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
226 * @return the value of 'step' depending on the selected input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
227 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
228 protected double getFinalStep() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
229 if (isLocationMode()) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
230 // we have no field to enter the 'step' attribute in the location |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
231 // mode |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
232 return 0.0; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
233 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
234 else { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
235 return getStep(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
236 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
237 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
238 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
239 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
240 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
241 * Determines the current input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
242 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
243 * @return true, if 'location' is the current input mode, otherwise false. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
244 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
245 public boolean isLocationMode() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
246 String inputMode = mode.getValueAsString("mode"); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
247 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
248 return inputMode.equals(FIELD_LOCATION) ? true : false; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 /** |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 * This method switches the input mode between location and distance input. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 * |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 * @param event The click event fired by a RadioButtonGroupItem. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 */ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 public void onChange(ChangeEvent event) { |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 String value = (String) event.getValue(); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 if (value == null) { |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 return; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
264 if (value.equals(FIELD_LOCATION)) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
265 Canvas locationPanel = new DoubleArrayPanel( |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
266 MESSAGES.unitLocation(), |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
267 getLocationValues(), |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
268 this); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
269 |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 container.removeMembers(container.getMembers()); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 container.addMember(locationPanel); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 } |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
273 else { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
274 Canvas distancePanel = new DoubleRangePanel( |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
275 MESSAGES.unitFrom(), MESSAGES.unitTo(), MESSAGES.unitWidth(), |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
276 getFrom(), getTo(), getStep(), |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
277 250, |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
278 this); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
279 |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 container.removeMembers(container.getMembers()); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 container.addMember(distancePanel); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 /** |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 * This method is used to validate the inserted data in the form fields. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 * |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 * @param event The BlurEvent that gives information about the FormItem that |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 * has been modified and its value. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 */ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 public void onBlur(BlurEvent event) { |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
293 FormItem item = event.getItem(); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
294 String field = item.getFieldName(); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 if (field == null) { |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 return; |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
298 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
299 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
300 if (field.equals(DoubleArrayPanel.FIELD_NAME)) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
301 DoubleArrayPanel p = (DoubleArrayPanel) event.getForm(); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
302 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
303 if (p.validateForm(item)) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
304 setLocationValues(p.getInputValues(item)); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
305 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
306 } |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
307 else { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
308 DoubleRangePanel p = (DoubleRangePanel) event.getForm(); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
309 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
310 if (p.validateForm(item)) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
311 setFrom(p.getFrom()); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
312 setTo(p.getTo()); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
313 setStep(p.getStep()); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
314 } |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
315 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
316 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
317 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
318 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
319 /** |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
320 * This method creates the panel that contains the checkboxes to switch |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
321 * between the input mode 'location' and 'distance'. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
322 * |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
323 * @return the checkbox panel. |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
324 */ |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
325 protected Canvas createRadioButtonPanel() { |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
326 mode = new DynamicForm(); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
327 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
328 RadioGroupItem radio = new RadioGroupItem("mode"); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
329 radio.setShowTitle(false); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
330 radio.setVertical(false); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
331 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
332 LinkedHashMap values = new LinkedHashMap(); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
333 values.put(FIELD_LOCATION, MESSAGES.location()); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
334 values.put(FIELD_DISTANCE, MESSAGES.distance()); |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
335 |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
336 LinkedHashMap initial = new LinkedHashMap(); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
337 initial.put("mode", FIELD_LOCATION); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
338 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
339 radio.setValueMap(values); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
340 radio.addChangeHandler(this); |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
341 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
342 mode.setFields(radio); |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
343 mode.setValues(initial); |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
344 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
345 return mode; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
346 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
347 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
348 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
349 protected double getFrom() { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
350 return from; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
351 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
352 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
353 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
354 protected void setFrom(double from) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
355 this.from = from; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
356 } |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
357 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
358 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
359 protected double getTo() { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
360 return to; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
361 } |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
362 |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
363 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
364 protected void setTo(double to) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
365 this.to = to; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
366 } |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
367 |
43
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
368 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
369 protected double getStep() { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
370 return step; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
371 } |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
372 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
373 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
374 protected void setStep(double step) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
375 this.step = step; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
376 } |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
377 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
378 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
379 protected double[] getLocationValues() { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
380 return values; |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
381 } |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
382 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
383 |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
384 protected void setLocationValues(double[] values) { |
6bcd8e3f21a7
Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
41
diff
changeset
|
385 this.values = values; |
41
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
386 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
387 } |
87a44f8e25cc
Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
388 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |