Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 261:f3ea644800c4
Fixed the location input. A range selection sets the correct location values
now.
flys-client/trunk@1876 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 10 May 2011 11:37:49 +0000 |
parents | 385e9368ffcd |
children | f56523bf4c55 |
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; |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
4 import java.util.List; |
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
|
5 |
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 import com.google.gwt.core.client.GWT; |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
7 import com.google.gwt.user.client.rpc.AsyncCallback; |
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
|
8 |
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.Canvas; |
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.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
|
11 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
|
12 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
|
13 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
|
14 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
|
15 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
|
16 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
|
17 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
|
18 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
|
19 import com.smartgwt.client.widgets.layout.VLayout; |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
20 import com.smartgwt.client.widgets.grid.ListGrid; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
21 import com.smartgwt.client.widgets.grid.ListGridField; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
22 import com.smartgwt.client.widgets.grid.ListGridRecord; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
23 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
24 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
25 import com.smartgwt.client.widgets.grid.events.CellClickHandler; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
26 import com.smartgwt.client.widgets.grid.events.CellClickEvent; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
27 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
28 import com.smartgwt.client.widgets.tab.TabSet; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
29 import com.smartgwt.client.widgets.tab.Tab; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
30 import com.smartgwt.client.data.Record; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
31 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
32 import com.smartgwt.client.types.ListGridFieldType; |
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
|
33 |
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 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
|
35 import de.intevation.flys.client.shared.model.DataItem; |
51
a2923d63f530
Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
49
diff
changeset
|
36 import de.intevation.flys.client.shared.model.DataList; |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
37 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
|
38 import de.intevation.flys.client.shared.model.DefaultDataItem; |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
39 import de.intevation.flys.client.shared.model.DistanceInfoObject; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
40 import de.intevation.flys.client.shared.model.DistanceInfoRecord; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
41 import de.intevation.flys.client.shared.model.ArtifactDescription; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
42 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
43 import de.intevation.flys.client.client.services.DistanceInfoService; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
44 import de.intevation.flys.client.client.services.DistanceInfoServiceAsync; |
211
b92281182c6b
Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
45 import de.intevation.flys.client.client.FLYSConstants; |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
46 import de.intevation.flys.client.client.FLYSImages; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
47 import de.intevation.flys.client.client.Config; |
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
|
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 |
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 /** |
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 * 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
|
52 * |
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 * @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
|
54 */ |
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 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
|
56 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
|
57 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
|
58 { |
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 /** The message class that provides i18n strings.*/ |
211
b92281182c6b
Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
60 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); |
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
|
61 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
62 /** The interface that provides the image resources. */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
63 private FLYSImages IMAGES = GWT.create(FLYSImages.class); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
64 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
65 /** The DistanceInfoService used to retrieve locations about rivers.*/ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
66 protected DistanceInfoServiceAsync distanceInfoService = |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
67 GWT.create(DistanceInfoService.class); |
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
|
68 |
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
|
69 /** 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
|
70 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
|
71 |
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
|
72 /** 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
|
73 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
|
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 /** 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
|
76 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
|
77 |
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 /** 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
|
79 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
|
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 /** 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
|
82 * 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
|
83 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
|
84 |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
85 public static final int WIDTH = 250; |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
86 |
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
|
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 /** 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
|
89 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
|
90 |
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 /** 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
|
92 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
|
93 |
55
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
94 /** The min value for a distance.*/ |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
95 protected double min; |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
96 |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
97 /** The max value for a distance.*/ |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
98 protected double max; |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
99 |
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
|
100 /** 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
|
101 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
|
102 |
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
|
103 /** 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
|
104 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
|
105 |
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
|
106 /** 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
|
107 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
|
108 |
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
|
109 /** 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
|
110 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
|
111 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
112 /** The input panel for locations */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
113 protected DoubleArrayPanel locationPanel; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
114 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
115 /** The input panel for distances */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
116 protected DoubleRangePanel distancePanel; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
117 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
118 /** The tab set containing the location and distance table*/ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
119 protected TabSet inputTables; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
120 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
121 /** The distance table. */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
122 protected ListGrid distanceTable; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
123 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
124 /** The locations table */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
125 protected ListGrid locationsTable; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
126 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
127 /** The locations table for distance input. */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
128 protected ListGrid locationDistanceTable; |
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
|
129 |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
130 /** The table data. */ |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
131 protected DistanceInfoObject[] tableData; |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
132 |
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
|
133 /** |
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 * 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
|
135 */ |
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
|
136 public LocationDistancePanel() { |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
137 distanceTable = new ListGrid(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
138 locationsTable = new ListGrid(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
139 locationDistanceTable = new ListGrid(); |
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
|
140 } |
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
|
141 |
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
|
142 |
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
|
143 /** |
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
|
144 * 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
|
145 * 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
|
146 * 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
|
147 * |
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
|
148 * @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
|
149 * |
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
|
150 * @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
|
151 */ |
51
a2923d63f530
Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
49
diff
changeset
|
152 public Canvas create(DataList data) { |
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
|
153 VLayout layout = new VLayout(); |
83
4784ca718476
Improved the positioning of helper widgets and some layout specific stuff.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
59
diff
changeset
|
154 layout.setMembersMargin(10); |
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
|
155 |
55
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
156 initDefaults(data); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
157 |
57
246af33f621c
Adjusted the look of the 'next' button in the parameter panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
55
diff
changeset
|
158 Label label = new Label(MESSAGES.location_distance_state()); |
246af33f621c
Adjusted the look of the 'next' button in the parameter panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
55
diff
changeset
|
159 Canvas widget = createWidget(data); |
246af33f621c
Adjusted the look of the 'next' button in the parameter panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
55
diff
changeset
|
160 Canvas submit = getNextButton(); |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
161 createDistanceInputPanel(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
162 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
163 createDistanceTable(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
164 createLocationTable(); |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
165 createLocationTableDistance (); |
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
|
166 |
83
4784ca718476
Improved the positioning of helper widgets and some layout specific stuff.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
59
diff
changeset
|
167 widget.setHeight(50); |
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
|
168 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
|
169 |
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
|
170 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
|
171 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
|
172 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
|
173 |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
174 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
|
175 } |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
176 |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
177 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
178 /** |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
179 * This method creates a table that contains the distance values. |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
180 */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
181 protected void createDistanceTable() { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
182 distanceTable.setWidth100(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
183 distanceTable.setShowRecordComponents(true); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
184 distanceTable.setShowRecordComponentsByCell(true); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
185 distanceTable.setHeight100(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
186 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
187 ListGridField addDistance = new ListGridField ("", ""); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
188 addDistance.setType (ListGridFieldType.ICON); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
189 addDistance.setWidth ("30"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
190 addDistance.addRecordClickHandler (new RecordClickHandler () { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
191 public void onRecordClick (RecordClickEvent e) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
192 if (!isLocationMode ()) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
193 Record r = e.getRecord(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
194 double min = r.getAttributeAsDouble("from"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
195 double max = r.getAttributeAsDouble("to"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
196 setDistanceValues(min, max); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
197 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
198 else { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
199 double[] selected; |
261
f3ea644800c4
Fixed the location input. A range selection sets the correct location values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
252
diff
changeset
|
200 Record r = e.getRecord(); |
f3ea644800c4
Fixed the location input. A range selection sets the correct location values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
252
diff
changeset
|
201 double min = r.getAttributeAsDouble("from"); |
f3ea644800c4
Fixed the location input. A range selection sets the correct location values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
252
diff
changeset
|
202 double max = r.getAttributeAsDouble("to"); |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
203 if (getLocationValues() != null) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
204 double[] val = getLocationValues(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
205 selected = new double[val.length + 2]; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
206 for(int i = 0; i < val.length; i++){ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
207 selected[i] = val[i]; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
208 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
209 selected[val.length] = min; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
210 selected[val.length + 1] = max; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
211 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
212 else { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
213 selected = new double[2]; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
214 selected[0] = min; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
215 selected[1] = max; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
216 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
217 setLocationValues(selected); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
218 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
219 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
220 }); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
221 addDistance.setCellIcon (IMAGES.markerGreen ().getURL ()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
222 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
223 ListGridField ddescr = new ListGridField("description", |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
224 MESSAGES.description()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
225 ddescr.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
226 ddescr.setWidth("*"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
227 ListGridField from = new ListGridField("from", MESSAGES.from()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
228 from.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
229 from.setWidth(75); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
230 ListGridField to = new ListGridField("to", MESSAGES.to()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
231 to.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
232 to.setWidth(75); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
233 ListGridField dside = new ListGridField("riverside", |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
234 MESSAGES.riverside()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
235 dside.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
236 dside.setWidth(60); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
237 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
238 distanceTable.setFields(addDistance, ddescr, from, to, dside); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
239 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
240 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
241 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
242 /** |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
243 * This method creates a table that contains the location values. |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
244 */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
245 protected void createLocationTable() { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
246 locationsTable.setWidth100(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
247 locationsTable.setShowRecordComponents(true); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
248 locationsTable.setShowRecordComponentsByCell(true); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
249 locationsTable.setHeight100(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
250 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
251 ListGridField addLocation = new ListGridField ("", ""); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
252 addLocation.setType (ListGridFieldType.ICON); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
253 addLocation.setWidth ("30"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
254 addLocation.addRecordClickHandler (new RecordClickHandler () { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
255 public void onRecordClick (RecordClickEvent e) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
256 ListGridRecord[] records = locationsTable.getSelection(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
257 double[] selected; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
258 if (getLocationValues() != null) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
259 double[] val = getLocationValues(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
260 selected = new double[val.length + 1]; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
261 for(int i = 0; i < val.length; i++){ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
262 selected[i] = val[i]; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
263 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
264 selected[val.length] = |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
265 records[0].getAttributeAsDouble("from"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
266 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
267 else { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
268 selected = new double[1]; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
269 selected[0] = records[0].getAttributeAsDouble("from"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
270 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
271 setLocationValues(selected); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
272 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
273 }); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
274 addLocation.setCellIcon (IMAGES.markerGreen ().getURL ()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
275 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
276 ListGridField ldescr = new ListGridField("description", |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
277 MESSAGES.description()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
278 ldescr.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
279 ldescr.setWidth("*"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
280 ListGridField lside = new ListGridField("riverside", |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
281 MESSAGES.riverside()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
282 lside.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
283 lside.setWidth(60); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
284 ListGridField loc = new ListGridField("from", MESSAGES.location()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
285 loc.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
286 loc.setWidth(80); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
287 locationsTable.setFields(addLocation, ldescr, loc, lside); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
288 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
289 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
290 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
291 /** |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
292 * This method creates a table that contains the location values. |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
293 */ |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
294 protected void createLocationTableDistance (){ |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
295 locationDistanceTable = null; |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
296 locationDistanceTable = new ListGrid (); |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
297 locationDistanceTable.setWidth100(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
298 locationDistanceTable.setShowRecordComponents(true); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
299 locationDistanceTable.setShowRecordComponentsByCell(true); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
300 locationDistanceTable.setHeight100(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
301 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
302 ListGridField addfrom = new ListGridField ("", ""); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
303 addfrom.setType (ListGridFieldType.ICON); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
304 addfrom.setWidth ("30"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
305 addfrom.setCellIcon (IMAGES.markerGreen ().getURL ()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
306 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
307 ListGridField addto2 = new ListGridField ("", ""); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
308 addto2.setType (ListGridFieldType.ICON); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
309 addto2.setWidth ("30"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
310 addto2.setCellIcon (IMAGES.markerRed ().getURL ()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
311 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
312 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
313 ListGridField ldescr = new ListGridField("description", |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
314 MESSAGES.description()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
315 ldescr.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
316 ldescr.setWidth("*"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
317 ListGridField lside = new ListGridField("riverside", |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
318 MESSAGES.riverside()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
319 lside.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
320 lside.setWidth(60); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
321 ListGridField loc = new ListGridField("from", MESSAGES.location()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
322 loc.setType(ListGridFieldType.TEXT); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
323 loc.setWidth(80); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
324 locationDistanceTable.addCellClickHandler (new CellClickHandler () { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
325 public void onCellClick (CellClickEvent e) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
326 if (e.getColNum() == 0) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
327 Record r = e.getRecord (); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
328 double fromvalue = r.getAttributeAsDouble ("from"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
329 double tovalue = getTo (); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
330 setDistanceValues (fromvalue, tovalue); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
331 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
332 else if (e.getColNum() == 1) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
333 Record r = e.getRecord (); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
334 double fromvalue = getFrom (); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
335 double tovalue = r.getAttributeAsDouble ("to"); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
336 setDistanceValues (fromvalue, tovalue); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
337 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
338 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
339 }); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
340 locationDistanceTable.setFields(addfrom, addto2, ldescr, loc, lside); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
341 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
342 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
343 |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
344 public Canvas createOld(DataList dataList) { |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
345 List<Data> items = dataList.getAll(); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
346 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
347 Data dFrom = getData(items, "ld_from"); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
348 Data dTo = getData(items, "ld_to"); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
349 Data dStep = getData(items, "ld_step"); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
350 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
351 DataItem[] from = dFrom.getItems(); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
352 DataItem[] to = dTo.getItems(); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
353 DataItem[] step = dStep.getItems(); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
354 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
355 HLayout layout = new HLayout(); |
91
0d8203594bb4
Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
83
diff
changeset
|
356 layout.setWidth("400px"); |
0d8203594bb4
Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
83
diff
changeset
|
357 |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
358 Label label = new Label(dataList.getLabel()); |
91
0d8203594bb4
Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
83
diff
changeset
|
359 label.setWidth("200px"); |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
360 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
361 StringBuilder sb = new StringBuilder(); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
362 sb.append(from[0].getLabel()); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
363 sb.append(" " + MESSAGES.unitFrom() + " "); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
364 sb.append(to[0].getLabel()); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
365 sb.append(" " + MESSAGES.unitTo() + " "); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
366 sb.append(step[0].getLabel()); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
367 sb.append(" " + MESSAGES.unitWidth()); |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
368 |
58
d018995fbee7
The 'old' items in the parameter panel have a button to step back to a previous state (NOTE: just the UI stuff is implemented now).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
57
diff
changeset
|
369 Canvas back = getBackButton(dataList.getState()); |
d018995fbee7
The 'old' items in the parameter panel have a button to step back to a previous state (NOTE: just the UI stuff is implemented now).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
57
diff
changeset
|
370 |
91
0d8203594bb4
Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
83
diff
changeset
|
371 Label selected = new Label(sb.toString()); |
0d8203594bb4
Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
83
diff
changeset
|
372 selected.setWidth("130px"); |
0d8203594bb4
Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
83
diff
changeset
|
373 |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
374 layout.addMember(label); |
91
0d8203594bb4
Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
83
diff
changeset
|
375 layout.addMember(selected); |
58
d018995fbee7
The 'old' items in the parameter panel have a button to step back to a previous state (NOTE: just the UI stuff is implemented now).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
57
diff
changeset
|
376 layout.addMember(back); |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
377 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
378 return layout; |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
379 } |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
380 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
381 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
382 /** |
55
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
383 * This method reads the default values defined in the DataItems of the Data |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
384 * objects in <i>list</i>. |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
385 * |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
386 * @param list The DataList container that stores the Data objects. |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
387 */ |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
388 protected void initDefaults(DataList list) { |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
389 Data f = getData(list.getAll(), "ld_from"); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
390 Data t = getData(list.getAll(), "ld_to"); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
391 Data s = getData(list.getAll(), "ld_step"); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
392 |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
393 DataItem[] fItems = f.getItems(); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
394 DataItem[] tItems = t.getItems(); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
395 DataItem[] sItems = s.getItems(); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
396 |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
397 min = Double.valueOf(fItems[0].getStringValue()); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
398 max = Double.valueOf(tItems[0].getStringValue()); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
399 step = Double.valueOf(sItems[0].getStringValue()); |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
400 |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
401 this.from = min; |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
402 this.to = max; |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
403 this.step = step; |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
404 } |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
405 |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
406 |
4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
53
diff
changeset
|
407 /** |
53
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
408 * This method greps the Data with name <i>name</i> from the list and |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
409 * returns it. |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
410 * |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
411 * @param items A list of Data. |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
412 * @param name The name of the Data that we are searching for. |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
413 * |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
414 * @return the Data with the name <i>name</i>. |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
415 */ |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
416 protected Data getData(List<Data> data, String name) { |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
417 for (Data d: data) { |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
418 if (name.equals(d.getLabel())) { |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
419 return d; |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
420 } |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
421 } |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
422 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
423 return null; |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
424 } |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
425 |
3d5d7788d471
The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
426 |
51
a2923d63f530
Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
49
diff
changeset
|
427 protected Canvas createWidget(DataList data) { |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
428 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
|
429 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
|
430 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
|
431 |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
432 // the initial view will display the location input mode |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
433 locationPanel = new DoubleArrayPanel( |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
434 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
|
435 getLocationValues(), |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
436 this); |
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
437 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
|
438 |
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
|
439 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
|
440 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
|
441 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
442 container.setMembersMargin(30); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
443 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
444 inputTables = new TabSet(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
445 Tab locations = new Tab(MESSAGES.location()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
446 Tab distances = new Tab(MESSAGES.distance()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
447 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
448 inputTables.setWidth(500); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
449 inputTables.setHeight(350); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
450 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
451 locations.setPane(locationsTable); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
452 distances.setPane(distanceTable); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
453 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
454 inputTables.addTab(locations); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
455 inputTables.addTab(distances); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
456 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
457 container.addMember(inputTables); |
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
|
458 |
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
|
459 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
|
460 } |
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
|
461 |
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
|
462 |
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
|
463 /** |
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
|
464 * 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
|
465 * |
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
|
466 * @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
|
467 */ |
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
|
468 public Data[] getData() { |
59
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
469 // XXX If we have entered a value and click right afterwards on the |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
470 // 'next' button, the BlurEvent is not fired, and the values are not |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
471 // saved. So, we gonna save those values explicitly. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
472 if (isLocationMode()) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
473 Canvas member = container.getMember(0); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
474 if (member instanceof DoubleArrayPanel) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
475 DoubleArrayPanel form = (DoubleArrayPanel) member; |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
476 saveLocationValues(form); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
477 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
478 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
479 else { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
480 Canvas member = container.getMember(0); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
481 if (member instanceof DoubleRangePanel) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
482 DoubleRangePanel form = (DoubleRangePanel) member; |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
483 saveDistanceValues(form); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
484 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
485 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
486 |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
487 return new Data[] { getDataFrom(), getDataTo(), getDataStep() }; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
488 } |
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
|
489 |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
490 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
491 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
492 * 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
|
493 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
494 * @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
|
495 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
496 protected Data getDataFrom() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
497 String value = Double.valueOf(getFinalFrom()).toString(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
498 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
|
499 return new DefaultData( |
51
a2923d63f530
Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
49
diff
changeset
|
500 "ld_from", null, null, new DataItem[] { item }); |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
501 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
502 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
503 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
504 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
505 * 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
|
506 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
507 * @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
|
508 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
509 protected Data getDataTo() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
510 String value = Double.valueOf(getFinalTo()).toString(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
511 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
|
512 return new DefaultData( |
51
a2923d63f530
Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
49
diff
changeset
|
513 "ld_to", null, null, new DataItem[] { item }); |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
514 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
515 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
516 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
517 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
518 * 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
|
519 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
520 * @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
|
521 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
522 protected Data getDataStep() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
523 String value = Double.valueOf(getFinalStep()).toString(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
524 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
|
525 return new DefaultData( |
51
a2923d63f530
Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
49
diff
changeset
|
526 "ld_step", null, null, new DataItem[] { item }); |
46
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
527 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
528 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
529 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
530 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
531 * 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
|
532 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
533 * @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
|
534 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
535 protected double getFinalFrom() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
536 if (isLocationMode()) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
537 double[] values = getLocationValues(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
538 double value = Double.MAX_VALUE; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
539 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
540 for (double v: values) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
541 value = value < v ? value : v; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
542 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
543 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
544 return value; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
545 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
546 else { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
547 return getFrom(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
548 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
549 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
550 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
551 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
552 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
553 * 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
|
554 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
555 * @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
|
556 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
557 protected double getFinalTo() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
558 if (isLocationMode()) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
559 double[] values = getLocationValues(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
560 double value = Double.MIN_VALUE; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
561 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
562 for (double v: values) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
563 value = value > v ? value : v; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
564 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
565 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
566 return value; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
567 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
568 else { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
569 return getTo(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
570 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
571 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
572 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
573 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
574 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
575 * 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
|
576 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
577 * @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
|
578 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
579 protected double getFinalStep() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
580 if (isLocationMode()) { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
581 // 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
|
582 // mode |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
583 return 0.0; |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
584 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
585 else { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
586 return getStep(); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
587 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
588 } |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
589 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
590 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
591 /** |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
592 * Determines the current input mode. |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
593 * |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
594 * @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
|
595 */ |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
596 public boolean isLocationMode() { |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
597 String inputMode = mode.getValueAsString("mode"); |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
598 |
0d4795b4f284
Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
45
diff
changeset
|
599 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
|
600 } |
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
|
601 |
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
|
602 |
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
|
603 /** |
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
|
604 * 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
|
605 * |
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
|
606 * @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
|
607 */ |
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
|
608 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
|
609 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
|
610 |
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
|
611 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
|
612 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
|
613 } |
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
|
614 if (value.equals(FIELD_LOCATION)) { |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
615 locationPanel = new DoubleArrayPanel( |
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
|
616 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
|
617 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
|
618 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
|
619 |
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
|
620 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
|
621 container.addMember(locationPanel); |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
622 while (inputTables.getNumTabs() > 0) { |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
623 inputTables.removeTab(0); |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
624 } |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
625 Tab t1 = new Tab (MESSAGES.location()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
626 createLocationTable(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
627 t1.setPane(locationsTable); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
628 inputTables.addTab(t1); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
629 createDistanceTable(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
630 Tab t2 = new Tab (MESSAGES.distance()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
631 t2.setPane(distanceTable); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
632 inputTables.addTab(t2); |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
633 updateDistanceInfo(tableData); |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
634 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
635 container.addMember(inputTables); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
636 inputTables.selectTab(0); |
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
|
637 } |
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
|
638 else { |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
639 distancePanel = new DoubleRangePanel( |
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
|
640 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
|
641 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
|
642 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
|
643 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
|
644 |
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
|
645 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
|
646 container.addMember(distancePanel); |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
647 while (inputTables.getNumTabs () > 0) { |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
648 inputTables.removeTab(0); |
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
649 } |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
650 Tab t1 = new Tab(MESSAGES.location ()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
651 createLocationTableDistance (); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
652 t1.setPane(locationDistanceTable); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
653 inputTables.addTab(t1); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
654 createDistanceTable (); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
655 Tab t2 = new Tab(MESSAGES.distance ()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
656 t2.setPane(distanceTable); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
657 inputTables.addTab(t2); |
244
1bc787eeb556
Do not update the locations table if no data is cached.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
237
diff
changeset
|
658 if (tableData != null) { |
1bc787eeb556
Do not update the locations table if no data is cached.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
237
diff
changeset
|
659 updateDistanceInfo(tableData); |
1bc787eeb556
Do not update the locations table if no data is cached.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
237
diff
changeset
|
660 } |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
661 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
662 container.addMember(inputTables); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
663 inputTables.selectTab(1); |
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
|
664 } |
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
|
665 } |
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
|
666 |
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
|
667 |
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
|
668 /** |
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
|
669 * 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
|
670 * |
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
|
671 * @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
|
672 * 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
|
673 */ |
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
|
674 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
|
675 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
|
676 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
|
677 |
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
|
678 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
|
679 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
|
680 } |
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
|
681 |
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
|
682 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
|
683 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
|
684 |
59
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
685 saveLocationValue(p, 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
|
686 } |
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
|
687 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
|
688 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
|
689 |
59
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
690 saveDistanceValue(p, item); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
691 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
692 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
693 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
694 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
695 |
59
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
696 /** |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
697 * Validates and stores all values entered in the location mode. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
698 * |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
699 * @param p The DoubleArrayPanel. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
700 */ |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
701 protected void saveLocationValues(DoubleArrayPanel p) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
702 FormItem[] formItems = p.getFields(); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
703 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
704 for (FormItem item: formItems) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
705 if (item.getFieldName().equals(DoubleArrayPanel.FIELD_NAME)) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
706 saveLocationValue(p, item); |
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
|
707 } |
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
|
708 } |
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
|
709 } |
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
|
710 |
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
|
711 |
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
|
712 /** |
59
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
713 * Validates and stores all values entered in the distance mode. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
714 * |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
715 * @param p The DoubleRangePanel. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
716 */ |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
717 protected void saveDistanceValues(DoubleRangePanel p) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
718 FormItem[] formItems = p.getFields(); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
719 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
720 for (FormItem item: formItems) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
721 saveDistanceValue(p, item); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
722 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
723 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
724 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
725 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
726 /** |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
727 * Validates and stores a value entered in the location mode. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
728 * |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
729 * @param p The DoubleArrayPanel. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
730 * @param item The item that needs to be validated. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
731 */ |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
732 protected void saveLocationValue(DoubleArrayPanel p, FormItem item) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
733 if (p.validateForm(item)) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
734 setLocationValues(p.getInputValues(item)); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
735 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
736 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
737 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
738 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
739 /** |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
740 * Validates and stores value entered in the distance mode. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
741 * |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
742 * @param p The DoubleRangePanel. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
743 * @param item The item that needs to be validated. |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
744 */ |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
745 protected void saveDistanceValue(DoubleRangePanel p, FormItem item) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
746 if (p.validateForm(item)) { |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
747 setFrom(p.getFrom()); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
748 setTo(p.getTo()); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
749 setStep(p.getStep()); |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
750 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
751 } |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
752 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
753 |
a3d235c63195
Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
58
diff
changeset
|
754 /** |
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
|
755 * 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
|
756 * 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
|
757 * |
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
|
758 * @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
|
759 */ |
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
|
760 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
|
761 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
|
762 |
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
|
763 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
|
764 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
|
765 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
|
766 |
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
|
767 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
|
768 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
|
769 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
|
770 |
45
f99c5f8e4672
Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
771 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
|
772 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
|
773 |
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
|
774 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
|
775 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
|
776 |
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
|
777 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
|
778 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
|
779 |
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
|
780 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
|
781 } |
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
|
782 |
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
|
783 |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
784 protected void createDistanceInputPanel() { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
785 Config config = Config.getInstance(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
786 String url = config.getServerUrl(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
787 String locale = config.getLocale (); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
788 String river = ""; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
789 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
790 ArtifactDescription adescr = artifact.getArtifactDescription(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
791 DataList[] data = adescr.getOldData(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
792 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
793 if (data != null && data.length > 0) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
794 for (int i = 0; i < data.length; i++) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
795 DataList dl = data[i]; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
796 if (dl.getState().equals("state.winfo.river")) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
797 for (int j = 0; j < dl.size(); j++) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
798 Data d = dl.get(j); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
799 DataItem[] di = d.getItems(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
800 if (di != null && di.length == 1) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
801 river = d.getItems()[0].getStringValue(); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
802 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
803 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
804 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
805 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
806 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
807 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
808 distanceInfoService.getDistanceInfo(url, locale, river, |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
809 new AsyncCallback<DistanceInfoObject[]>() { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
810 public void onFailure(Throwable caught) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
811 GWT.log("Could not recieve distance informations."); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
812 GWT.log(caught.getMessage()); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
813 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
814 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
815 public void onSuccess(DistanceInfoObject[] di) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
816 int num = di != null ? di.length :0; |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
817 GWT.log("Recieved " + num + " distance informations."); |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
818 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
819 if (num == 0) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
820 return; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
821 } |
237
cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
235
diff
changeset
|
822 tableData = di; |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
823 updateDistanceInfo(di); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
824 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
825 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
826 ); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
827 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
828 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
829 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
830 protected void updateDistanceInfo(DistanceInfoObject[] di) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
831 int i = 0; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
832 for (DistanceInfoObject dio: di) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
833 if (dio.getTo() != null) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
834 distanceTable.addData(new DistanceInfoRecord(dio)); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
835 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
836 else { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
837 locationsTable.addData(new DistanceInfoRecord(dio)); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
838 locationDistanceTable.addData(new DistanceInfoRecord(dio)); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
839 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
840 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
841 return; |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
842 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
843 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
844 |
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
|
845 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
|
846 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
|
847 } |
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
|
848 |
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
|
849 |
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
|
850 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
|
851 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
|
852 } |
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
|
853 |
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
|
854 |
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
|
855 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
|
856 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
|
857 } |
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
|
858 |
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
|
859 |
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
|
860 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
|
861 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
|
862 } |
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
|
863 |
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
|
864 |
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
|
865 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
|
866 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
|
867 } |
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
|
868 |
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
|
869 |
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
|
870 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
|
871 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
|
872 } |
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
|
873 |
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
|
874 |
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
|
875 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
|
876 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
|
877 } |
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
|
878 |
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
|
879 |
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
|
880 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
|
881 this.values = values; |
235
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
882 locationPanel.setValues(values); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
883 } |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
884 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
885 |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
886 protected void setDistanceValues (double from, double to) { |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
887 setFrom(from); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
888 setTo(to); |
d3f8d6966c20
Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
889 distancePanel.setValues(from, to, getStep()); |
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
|
890 } |
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
|
891 } |
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
|
892 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |