annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 272:d3c053420c3b

ISSUE 44: Moved the location/range and WQ input tables to the helper panel and set the size to 100%. flys-client/trunk@1898 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 May 2011 11:07:18 +0000
parents f56523bf4c55
children be842e36ce1c
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();
263
f56523bf4c55 Changed the empty table message for helper and data tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 261
diff changeset
186 distanceTable.setEmptyMessage(MESSAGES.empty_table());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
187
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
188 ListGridField addDistance = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
189 addDistance.setType (ListGridFieldType.ICON);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
190 addDistance.setWidth ("30");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
191 addDistance.addRecordClickHandler (new RecordClickHandler () {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
192 public void onRecordClick (RecordClickEvent e) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
193 if (!isLocationMode ()) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
194 Record r = e.getRecord();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
195 double min = r.getAttributeAsDouble("from");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
196 double max = r.getAttributeAsDouble("to");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
197 setDistanceValues(min, max);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
198 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
199 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
200 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
201 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
202 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
203 double max = r.getAttributeAsDouble("to");
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
204 if (getLocationValues() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
205 double[] val = getLocationValues();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
206 selected = new double[val.length + 2];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
207 for(int i = 0; i < val.length; i++){
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
208 selected[i] = val[i];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
209 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
210 selected[val.length] = min;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
211 selected[val.length + 1] = max;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
212 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
213 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
214 selected = new double[2];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
215 selected[0] = min;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
216 selected[1] = max;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
217 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
218 setLocationValues(selected);
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 });
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
222 addDistance.setCellIcon (IMAGES.markerGreen ().getURL ());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
223
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
224 ListGridField ddescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
225 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
226 ddescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
227 ddescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
228 ListGridField from = new ListGridField("from", MESSAGES.from());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
229 from.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
230 from.setWidth(75);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
231 ListGridField to = new ListGridField("to", MESSAGES.to());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
232 to.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
233 to.setWidth(75);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
234 ListGridField dside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
235 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
236 dside.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
237 dside.setWidth(60);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
238
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
239 distanceTable.setFields(addDistance, ddescr, from, to, dside);
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 /**
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
244 * 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
245 */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
246 protected void createLocationTable() {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
247 locationsTable.setWidth100();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
248 locationsTable.setShowRecordComponents(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
249 locationsTable.setShowRecordComponentsByCell(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
250 locationsTable.setHeight100();
263
f56523bf4c55 Changed the empty table message for helper and data tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 261
diff changeset
251 locationsTable.setEmptyMessage(MESSAGES.empty_table());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
252
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
253 ListGridField addLocation = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
254 addLocation.setType (ListGridFieldType.ICON);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
255 addLocation.setWidth ("30");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
256 addLocation.addRecordClickHandler (new RecordClickHandler () {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
257 public void onRecordClick (RecordClickEvent e) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
258 ListGridRecord[] records = locationsTable.getSelection();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
259 double[] selected;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
260 if (getLocationValues() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
261 double[] val = getLocationValues();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
262 selected = new double[val.length + 1];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
263 for(int i = 0; i < val.length; i++){
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
264 selected[i] = val[i];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
265 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
266 selected[val.length] =
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
267 records[0].getAttributeAsDouble("from");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
268 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
269 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
270 selected = new double[1];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
271 selected[0] = records[0].getAttributeAsDouble("from");
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 setLocationValues(selected);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
274 }
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 addLocation.setCellIcon (IMAGES.markerGreen ().getURL ());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
277
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
278 ListGridField ldescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
279 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
280 ldescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
281 ldescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
282 ListGridField lside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
283 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
284 lside.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
285 lside.setWidth(60);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
286 ListGridField loc = new ListGridField("from", MESSAGES.location());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
287 loc.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
288 loc.setWidth(80);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
289 locationsTable.setFields(addLocation, ldescr, loc, lside);
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
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 * 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
295 */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
296 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
297 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
298 locationDistanceTable = new ListGrid ();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
299 locationDistanceTable.setWidth100();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
300 locationDistanceTable.setShowRecordComponents(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
301 locationDistanceTable.setShowRecordComponentsByCell(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
302 locationDistanceTable.setHeight100();
263
f56523bf4c55 Changed the empty table message for helper and data tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 261
diff changeset
303 locationDistanceTable.setEmptyMessage(MESSAGES.empty_table());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
304
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
305 ListGridField addfrom = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
306 addfrom.setType (ListGridFieldType.ICON);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
307 addfrom.setWidth ("30");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
308 addfrom.setCellIcon (IMAGES.markerGreen ().getURL ());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
309
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
310 ListGridField addto2 = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
311 addto2.setType (ListGridFieldType.ICON);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
312 addto2.setWidth ("30");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
313 addto2.setCellIcon (IMAGES.markerRed ().getURL ());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
314
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
315
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
316 ListGridField ldescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
317 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
318 ldescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
319 ldescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
320 ListGridField lside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
321 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
322 lside.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
323 lside.setWidth(60);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
324 ListGridField loc = new ListGridField("from", MESSAGES.location());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
325 loc.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
326 loc.setWidth(80);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
327 locationDistanceTable.addCellClickHandler (new CellClickHandler () {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
328 public void onCellClick (CellClickEvent e) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
329 if (e.getColNum() == 0) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
330 Record r = e.getRecord ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
331 double fromvalue = r.getAttributeAsDouble ("from");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
332 double tovalue = getTo ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
333 setDistanceValues (fromvalue, tovalue);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
334 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
335 else if (e.getColNum() == 1) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
336 Record r = e.getRecord ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
337 double fromvalue = getFrom ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
338 double tovalue = r.getAttributeAsDouble ("to");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
339 setDistanceValues (fromvalue, tovalue);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
340 }
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 locationDistanceTable.setFields(addfrom, addto2, ldescr, loc, lside);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
344 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
345
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
346
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
347 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
348 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
349
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 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
351 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
352 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
353
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 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
355 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
356 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
357
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 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
359 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
360
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
361 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
362 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
363
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 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
365 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
366 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
367 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
368 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
369 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
370 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
371
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
372 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
373
91
0d8203594bb4 Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 83
diff changeset
374 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
375 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
376
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 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
378 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
379 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
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 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
382 }
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
383
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
384
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
385 /**
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
386 * 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
387 * 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
388 *
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
389 * @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
390 */
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
391 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
392 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
393 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
394 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
395
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
396 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
397 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
398 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
399
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
400 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
401 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
402 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
403
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
404 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
405 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
406 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
407 }
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
408
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
409
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
410 /**
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
411 * 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
412 * 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
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 * @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
415 * @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
416 *
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 * @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
418 */
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 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
420 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
421 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
422 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
423 }
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 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
427 }
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
428
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
429
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
430 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
431 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
432 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
433 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
434
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
435 // 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
436 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
437 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
438 getLocationValues(),
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
439 this);
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
440 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
441
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
442 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
443 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
444
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
445 container.setMembersMargin(30);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
446
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
447 inputTables = new TabSet();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
448 Tab locations = new Tab(MESSAGES.location());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
449 Tab distances = new Tab(MESSAGES.distance());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
450
272
d3c053420c3b ISSUE 44: Moved the location/range and WQ input tables to the helper panel and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 263
diff changeset
451 inputTables.setWidth100();
d3c053420c3b ISSUE 44: Moved the location/range and WQ input tables to the helper panel and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 263
diff changeset
452 inputTables.setHeight100();
235
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 locations.setPane(locationsTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
455 distances.setPane(distanceTable);
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 inputTables.addTab(locations);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
458 inputTables.addTab(distances);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
459
272
d3c053420c3b ISSUE 44: Moved the location/range and WQ input tables to the helper panel and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 263
diff changeset
460 helperContainer.addChild(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
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 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
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
87a44f8e25cc Added a new widget 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 /**
87a44f8e25cc Added a new widget 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 * 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
468 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
469 * @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
470 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
471 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
472 // 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
473 // '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
474 // 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
475 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
476 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
477 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
478 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
479 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
480 }
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 }
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 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
483 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
484 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
485 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
486 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
487 }
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
488 }
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
489
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
490 return new Data[] { getDataFrom(), getDataTo(), getDataStep() };
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
491 }
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
492
46
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
495 * 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
496 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
497 * @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
498 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
499 protected Data getDataFrom() {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
500 String value = Double.valueOf(getFinalFrom()).toString();
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
501 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
502 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
503 "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
504 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
505
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
508 * 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
509 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
510 * @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
511 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
512 protected Data getDataTo() {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
513 String value = Double.valueOf(getFinalTo()).toString();
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
514 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
515 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
516 "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
517 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
518
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
521 * 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
522 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
523 * @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
524 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
525 protected Data getDataStep() {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
526 String value = Double.valueOf(getFinalStep()).toString();
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
527 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
528 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
529 "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
530 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
531
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
534 * 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
535 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
536 * @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
537 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
538 protected double getFinalFrom() {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
539 if (isLocationMode()) {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
540 double[] values = getLocationValues();
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
541 double value = Double.MAX_VALUE;
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 for (double v: values) {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
544 value = value < v ? value : v;
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
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
547 return value;
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 else {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
550 return getFrom();
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
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
556 * 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
557 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
558 * @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
559 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
560 protected double getFinalTo() {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
561 if (isLocationMode()) {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
562 double[] values = getLocationValues();
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
563 double value = Double.MIN_VALUE;
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 for (double v: values) {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
566 value = value > v ? value : v;
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
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
569 return value;
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 else {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
572 return getTo();
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
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
578 * 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
579 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
580 * @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
581 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
582 protected double getFinalStep() {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
583 if (isLocationMode()) {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
584 // 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
585 // mode
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
586 return 0.0;
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 else {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
589 return getStep();
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
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
595 * Determines the current input mode.
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
596 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
597 * @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
598 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
599 public boolean isLocationMode() {
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
600 String inputMode = mode.getValueAsString("mode");
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
601
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
602 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
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
87a44f8e25cc Added a new widget 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 /**
87a44f8e25cc Added a new widget 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 * 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
608 *
87a44f8e25cc Added a new widget 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 * @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
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 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
612 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
613
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
614 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
615 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
616 }
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
617 if (value.equals(FIELD_LOCATION)) {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
618 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
619 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
620 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
621 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
622
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
623 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
624 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
625 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
626 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
627 }
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
628 Tab t1 = new Tab (MESSAGES.location());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
629 createLocationTable();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
630 t1.setPane(locationsTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
631 inputTables.addTab(t1);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
632 createDistanceTable();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
633 Tab t2 = new Tab (MESSAGES.distance());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
634 t2.setPane(distanceTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
635 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
636 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
637
272
d3c053420c3b ISSUE 44: Moved the location/range and WQ input tables to the helper panel and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 263
diff changeset
638 helperContainer.addChild(inputTables);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
639 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
640 }
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
641 else {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
642 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
643 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
644 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
645 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
646 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
647
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
648 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
649 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
650 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
651 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
652 }
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
653 Tab t1 = new Tab(MESSAGES.location ());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
654 createLocationTableDistance ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
655 t1.setPane(locationDistanceTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
656 inputTables.addTab(t1);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
657 createDistanceTable ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
658 Tab t2 = new Tab(MESSAGES.distance ());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
659 t2.setPane(distanceTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
660 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
661 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
662 updateDistanceInfo(tableData);
1bc787eeb556 Do not update the locations table if no data is cached.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 237
diff changeset
663 }
237
cf25f235b7b6 Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 235
diff changeset
664
272
d3c053420c3b ISSUE 44: Moved the location/range and WQ input tables to the helper panel and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 263
diff changeset
665 helperContainer.addChild(inputTables);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
666 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
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
87a44f8e25cc Added a new widget 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 /**
87a44f8e25cc Added a new widget 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 * 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
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 * @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
675 * 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
676 */
87a44f8e25cc Added a new widget 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 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
678 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
679 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
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 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
682 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
683 }
87a44f8e25cc Added a new widget 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
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
685 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
686 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
687
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
688 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
689 }
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
690 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
691 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
692
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
693 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
694 }
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
695 }
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
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
698
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
699 /**
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 * 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
701 *
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 * @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
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 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
705 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
706
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
707 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
708 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
709 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
710 }
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
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 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
713
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
714
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
715 /**
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
716 * 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
717 *
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 * @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
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 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
721 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
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 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
724 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
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
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 /**
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 * 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
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 * @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
733 * @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
734 */
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 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
736 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
737 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
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
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 /**
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 * 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
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 * @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
746 * @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
747 */
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 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
749 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
750 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
751 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
752 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
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 }
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
755
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
756
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
757 /**
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
758 * 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
759 * 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
760 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
761 * @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
762 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
763 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
764 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
765
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
766 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
767 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
768 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
769
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
770 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
771 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
772 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
773
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
774 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
775 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
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 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
778 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
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 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
781 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
782
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
783 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
784 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
785
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
786
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
787 protected void createDistanceInputPanel() {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
788 Config config = Config.getInstance();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
789 String url = config.getServerUrl();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
790 String locale = config.getLocale ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
791 String river = "";
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 ArtifactDescription adescr = artifact.getArtifactDescription();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
794 DataList[] data = adescr.getOldData();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
795
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
796 if (data != null && data.length > 0) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
797 for (int i = 0; i < data.length; i++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
798 DataList dl = data[i];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
799 if (dl.getState().equals("state.winfo.river")) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
800 for (int j = 0; j < dl.size(); j++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
801 Data d = dl.get(j);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
802 DataItem[] di = d.getItems();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
803 if (di != null && di.length == 1) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
804 river = d.getItems()[0].getStringValue();
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 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
809 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
810
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
811 distanceInfoService.getDistanceInfo(url, locale, river,
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
812 new AsyncCallback<DistanceInfoObject[]>() {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
813 public void onFailure(Throwable caught) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
814 GWT.log("Could not recieve distance informations.");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
815 GWT.log(caught.getMessage());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
816 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
817
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
818 public void onSuccess(DistanceInfoObject[] di) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
819 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
820 GWT.log("Recieved " + num + " distance informations.");
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
821
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
822 if (num == 0) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
823 return;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
824 }
237
cf25f235b7b6 Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 235
diff changeset
825 tableData = di;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
826 updateDistanceInfo(di);
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 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
831
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
832
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
833 protected void updateDistanceInfo(DistanceInfoObject[] di) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
834 int i = 0;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
835 for (DistanceInfoObject dio: di) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
836 if (dio.getTo() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
837 distanceTable.addData(new DistanceInfoRecord(dio));
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
838 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
839 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
840 locationsTable.addData(new DistanceInfoRecord(dio));
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
841 locationDistanceTable.addData(new DistanceInfoRecord(dio));
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 return;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
845 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
846
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
847
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
848 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
849 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
850 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
851
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
852
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
853 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
854 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
855 }
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
856
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
857
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
858 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
859 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
860 }
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
861
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
862
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
863 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
864 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
865 }
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
866
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
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 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
869 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
870 }
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
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 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
874 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
875 }
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
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 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
879 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
880 }
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
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
882
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
883 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
884 this.values = values;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
885 locationPanel.setValues(values);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
886 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
887
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
888
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
889 protected void setDistanceValues (double from, double to) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
890 setFrom(from);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
891 setTo(to);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
892 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
893 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
894 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
895 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org