annotate flys-client/src/main/java/org/dive4elements/river/client/client/ui/LocationDistancePanel.java @ 5835:821a02bbfb4e

Fixed internal java dependencies
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 13:12:15 +0200
parents f507086aa94b
children
rev   line source
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
1 package org.dive4elements.river.client.client.ui;
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
2
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
562
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
4 import com.google.gwt.i18n.client.NumberFormat;
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
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
6 import com.smartgwt.client.data.AdvancedCriteria;
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
7 import com.smartgwt.client.data.Criteria;
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
8 import com.smartgwt.client.data.Criterion;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
9 import com.smartgwt.client.data.Record;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
10 import com.smartgwt.client.types.Alignment;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
11 import com.smartgwt.client.types.ListGridFieldType;
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
12 import com.smartgwt.client.types.OperatorId;
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
13 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
14 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
15 import com.smartgwt.client.widgets.form.DynamicForm;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
16 import com.smartgwt.client.widgets.form.fields.FormItem;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
17 import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
18 import com.smartgwt.client.widgets.form.fields.SelectItem;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
19 import com.smartgwt.client.widgets.form.fields.StaticTextItem;
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
20 import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
21 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
22 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
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
23 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
24 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
25 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
26 import com.smartgwt.client.widgets.grid.CellFormatter;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
27 import com.smartgwt.client.widgets.grid.ListGrid;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
28 import com.smartgwt.client.widgets.grid.ListGridField;
906
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
29 import com.smartgwt.client.widgets.grid.ListGridRecord;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
30 import com.smartgwt.client.widgets.grid.events.CellClickEvent;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
31 import com.smartgwt.client.widgets.grid.events.CellClickHandler;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
32 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
33 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
34 import com.smartgwt.client.widgets.layout.HLayout;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
35 import com.smartgwt.client.widgets.layout.VLayout;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
36 import com.smartgwt.client.widgets.tab.Tab;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
37 import com.smartgwt.client.widgets.tab.TabSet;
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
38 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
39 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
40
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
41 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
42 import org.dive4elements.river.client.client.FLYSConstants;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
43 import org.dive4elements.river.client.client.event.FilterHandler;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
44 import org.dive4elements.river.client.client.event.RangeFilterEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
45 import org.dive4elements.river.client.client.event.StringFilterEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
46 import org.dive4elements.river.client.client.services.DistanceInfoService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
47 import org.dive4elements.river.client.client.services.DistanceInfoServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
48 import org.dive4elements.river.client.client.ui.range.DistanceInfoDataSource;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
49 import org.dive4elements.river.client.shared.model.ArtifactDescription;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
50 import org.dive4elements.river.client.shared.model.Data;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
51 import org.dive4elements.river.client.shared.model.DataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
52 import org.dive4elements.river.client.shared.model.DataList;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
53 import org.dive4elements.river.client.shared.model.DefaultData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
54 import org.dive4elements.river.client.shared.model.DefaultDataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
55 import org.dive4elements.river.client.shared.model.DistanceInfoObject;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
56
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
57 import java.util.ArrayList;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
58 import java.util.LinkedHashMap;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
59 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
60
87a44f8e25cc Added a new widget 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
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 * 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
64 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 * @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
66 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 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
68 extends AbstractUIProvider
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
69 implements ChangeHandler, BlurHandler, FilterHandler
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
70 {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
71 private static final long serialVersionUID = -10820092176039372L;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
72
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
73 /** 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
74 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
75
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
76 /** The DistanceInfoService used to retrieve locations about rivers. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
77 protected DistanceInfoServiceAsync distanceInfoService =
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
78 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
79
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
80 public static final String FIELD_MODE = "mode";
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
81
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
82 /** 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
83 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
84
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 /** 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
86 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
87
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
88 /** The constant name of the input field to enter locations.*/
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
89 public static final String FIELD_VALUE_LOCATION = "location";
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
90
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
91 /** The constant name of the input field to enter distance.*/
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
92 public static final String FIELD_VALUE_DISTANCE = "distance";
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
93
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
94 /** 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
95 * 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
96 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
97
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
98 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
99
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
100
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 /** 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
102 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
103
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 /** 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
105 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
106
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
107 /** 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
108 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
109
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
110 /** 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
111 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
112
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
113 /** 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
114 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
115
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
116 /** 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
117 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
118
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
119 /** 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
120 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
121
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
122 /** 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
123 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
124
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
125 /** The input panel for locations. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
126 protected DoubleArrayPanel locationPanel;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
127
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
128 /** The input panel for distances. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
129 protected DoubleRangePanel distancePanel;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
130
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
131 /** The tab set containing the location and distance table. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
132 protected TabSet inputTables;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
133
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
134 /** The distance table. */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
135 protected ListGrid distanceTable;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
136
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
137 /** The locations table. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
138 protected ListGrid locationsTable;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
139
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
140 /** The locations table for distance input. */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
141 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
142
237
cf25f235b7b6 Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 235
diff changeset
143 /** 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
144 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
145
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
146 /** The table filter.*/
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
147 protected TableFilter filterDescription;
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
148 protected RangeTableFilter filterRange;
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
149
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
150 /** The Combobox for table filter criteria. */
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
151 protected SelectItem filterCriteria;
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
152 protected StaticTextItem filterResultCount;
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
153 protected ListGrid currentFiltered;
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
154
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 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 * 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
157 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 public LocationDistancePanel() {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
159 distanceTable = new ListGrid();
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
160 distanceTable.setAutoFetchData(true);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
161
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
162 locationsTable = new ListGrid();
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
163 locationsTable.setAutoFetchData(true);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
164
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
165 locationDistanceTable = new ListGrid();
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
166 locationDistanceTable.setAutoFetchData(true);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
167
284
be842e36ce1c ISSUE 46: Removed the table header context menu.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 272
diff changeset
168 locationDistanceTable.setShowHeaderContextMenu(false);
be842e36ce1c ISSUE 46: Removed the table header context menu.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 272
diff changeset
169 distanceTable.setShowHeaderContextMenu(false);
be842e36ce1c ISSUE 46: Removed the table header context menu.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 272
diff changeset
170 locationsTable.setShowHeaderContextMenu(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
171 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 * 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
176 * 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
177 * 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
178 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 * @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
180 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 * @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
182 */
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
183 @Override
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
184 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
185 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
186 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
187
57
246af33f621c Adjusted the look of the 'next' button in the parameter panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 55
diff changeset
188 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
189 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
190 Canvas submit = getNextButton();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
191 createDistanceInputPanel();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
192
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
193 initDefaults(data);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
194
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
195 createLocationTableDistance ();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
196 createDistanceTable();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
197 createLocationTable();
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
198
83
4784ca718476 Improved the positioning of helper widgets and some layout specific stuff.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 59
diff changeset
199 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
200 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
201
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 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
203 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
204 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
205
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
206 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
207 }
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
208
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
209
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
210 /**
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
211 * 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
212 */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
213 protected void createDistanceTable() {
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
214
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
215 String baseUrl = GWT.getHostPageBaseURL();
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
216
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
217 distanceTable.setWidth100();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
218 distanceTable.setShowRecordComponents(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
219 distanceTable.setShowRecordComponentsByCell(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
220 distanceTable.setHeight100();
876
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 871
diff changeset
221 distanceTable.setEmptyMessage(MESSAGES.empty_filter());
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 871
diff changeset
222 distanceTable.setCanReorderFields(false);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
223
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
224 CellFormatter cf = new CellFormatter() {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
225 @Override
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
226 public String format(
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
227 Object value,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
228 ListGridRecord record,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
229 int rowNum, int colNum) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
230 if (value == null) return null;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
231 try {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
232 NumberFormat nf;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
233 double v = Double.parseDouble((String)value);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
234 nf = NumberFormat.getFormat("###0.00##");
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
235 return nf.format(v);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
236 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
237 catch (Exception e) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
238 return value.toString();
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
239 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
240 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
241 };
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
242
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
243 ListGridField addDistance = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
244 addDistance.setType (ListGridFieldType.ICON);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
245 addDistance.setWidth (20);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
246 addDistance.addRecordClickHandler (new RecordClickHandler () {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
247 @Override
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
248 public void onRecordClick (RecordClickEvent e) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
249 if (!isLocationMode ()) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
250 Record r = e.getRecord();
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
251 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
252 double min = Double.parseDouble(r.getAttribute("from"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
253 double max = Double.parseDouble(r.getAttribute("to"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
254 setDistanceValues(min, max);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
255 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
256 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
257 // Is there anything to do?
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
258 }
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
259 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
260 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
261 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
262 Record r = e.getRecord();
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
263 double min = 0, max = 0;
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
264 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
265 min = Double.parseDouble(r.getAttribute("from"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
266 max = Double.parseDouble(r.getAttribute("to"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
267 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
268 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
269 // Is there anything to do?
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
270 }
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
271 if (getLocationValues() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
272 double[] val = getLocationValues();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
273 selected = new double[val.length + 2];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
274 for(int i = 0; i < val.length; i++){
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
275 selected[i] = val[i];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
276 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
277 selected[val.length] = min;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
278 selected[val.length + 1] = max;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
279 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
280 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
281 selected = new double[2];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
282 selected[0] = min;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
283 selected[1] = max;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
284 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
285 setLocationValues(selected);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
286 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
287 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
288 });
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
289 addDistance.setCellIcon(baseUrl + MESSAGES.markerGreen());
235
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 ListGridField ddescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
292 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
293 ddescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
294 ddescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
295 ListGridField from = new ListGridField("from", MESSAGES.from());
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
296 from.setCellFormatter(cf);
906
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
297
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
298 from.setWidth("12%");
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
299 ListGridField to = new ListGridField("to", MESSAGES.to());
903
dd702348b878 Changed columns to the correct type for most tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 893
diff changeset
300 to.setType(ListGridFieldType.FLOAT);
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
301 to.setCellFormatter(cf);
906
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
302
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
303 to.setWidth("12%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
304 to.setAlign(Alignment.LEFT);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
305 ListGridField dside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
306 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
307 dside.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
308 dside.setWidth("12%");
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
309
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
310 ListGridField bottom =
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
311 new ListGridField("bottom", MESSAGES.bottom_edge());
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
312 bottom.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
313 bottom.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
314 bottom.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
315
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
316 ListGridField top =
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
317 new ListGridField("top", MESSAGES.top_edge());
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
318 top.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
319 top.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
320 top.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
321
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
322 distanceTable.setFields(
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
323 addDistance, ddescr, from, to, dside, bottom, top);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
324 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
325
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
326
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
327 /**
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
328 * 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
329 */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
330 protected void createLocationTable() {
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
331
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
332 String baseUrl = GWT.getHostPageBaseURL();
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
333
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
334 locationsTable.setWidth100();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
335 locationsTable.setShowRecordComponents(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
336 locationsTable.setShowRecordComponentsByCell(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
337 locationsTable.setHeight100();
876
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 871
diff changeset
338 locationsTable.setEmptyMessage(MESSAGES.empty_filter());
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 871
diff changeset
339 locationsTable.setCanReorderFields(false);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
340
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
341 CellFormatter cf = new CellFormatter() {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
342 @Override
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
343 public String format(
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
344 Object value,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
345 ListGridRecord record,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
346 int rowNum, int colNum) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
347 if (value == null) return null;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
348 try {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
349 NumberFormat nf;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
350 double v = Double.parseDouble((String)value);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
351 nf = NumberFormat.getFormat("###0.00##");
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
352 return nf.format(v);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
353 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
354 catch (Exception e) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
355 return value.toString();
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
356 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
357 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
358 };
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
359
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
360
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
361
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
362 ListGridField addLocation = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
363 addLocation.setType (ListGridFieldType.ICON);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
364 addLocation.setWidth (20);
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
365
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
366 addLocation.addRecordClickHandler (new RecordClickHandler () {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
367 @Override
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
368 public void onRecordClick (RecordClickEvent e) {
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
369 Record record = e.getRecord();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
370 double[] selected;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
371 if (getLocationValues() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
372 double[] val = getLocationValues();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
373 selected = new double[val.length + 1];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
374 for(int i = 0; i < val.length; i++){
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
375 selected[i] = val[i];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
376 }
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
377 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
378 selected[val.length] =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
379 Double.parseDouble(record.getAttribute("from"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
380 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
381 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
382 // Is there anything to do here?
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
383 }
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
384 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
385 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
386 selected = new double[1];
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
387 selected[0] =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
388 Double.parseDouble(record.getAttribute("from"));
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
389 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
390 setLocationValues(selected);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
391 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
392 });
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
393 addLocation.setCellIcon (baseUrl + MESSAGES.markerGreen ());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
394
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
395 ListGridField ldescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
396 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
397 ldescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
398 ldescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
399 ListGridField lside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
400 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
401 lside.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
402 lside.setWidth("12%");
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
403 ListGridField loc = new ListGridField("from", MESSAGES.locations());
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
404 loc.setAlign(Alignment.LEFT);
903
dd702348b878 Changed columns to the correct type for most tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 893
diff changeset
405 loc.setType(ListGridFieldType.FLOAT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
406 loc.setWidth("12%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
407 loc.setCellFormatter(cf);
615
ba1b27b7d282 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 588
diff changeset
408
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
409 ListGridField bottom =
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
410 new ListGridField("bottom", MESSAGES.bottom_edge());
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
411 bottom.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
412 bottom.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
413 bottom.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
414
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
415 ListGridField top =
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
416 new ListGridField("top", MESSAGES.top_edge());
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
417 top.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
418 top.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
419 top.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
420
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
421 locationsTable.setFields(addLocation, ldescr, loc, lside, bottom, top);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
422 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
423
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
424
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
425 /**
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
426 * 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
427 */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
428 protected void createLocationTableDistance (){
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
429
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
430 String baseUrl = GWT.getHostPageBaseURL();
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
431
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
432 locationDistanceTable.setWidth100();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
433 locationDistanceTable.setShowRecordComponents(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
434 locationDistanceTable.setShowRecordComponentsByCell(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
435 locationDistanceTable.setHeight100();
876
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 871
diff changeset
436 locationDistanceTable.setEmptyMessage(MESSAGES.empty_filter());
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 871
diff changeset
437 locationDistanceTable.setCanReorderFields(false);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
438
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
439 CellFormatter cf = new CellFormatter() {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
440 @Override
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
441 public String format(
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
442 Object value,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
443 ListGridRecord record,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
444 int rowNum, int colNum) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
445 if (value == null) return null;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
446 try {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
447 NumberFormat nf;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
448 double v = Double.parseDouble((String)value);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
449 nf = NumberFormat.getFormat("###0.00##");
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
450 return nf.format(v);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
451 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
452 catch (Exception e) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
453 return value.toString();
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
454 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
455 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
456 };
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
457
3712
738010779c74 Add "to" and "from" strings to table columns.
Christian Lins <christian.lins@intevation.de>
parents: 3542
diff changeset
458 ListGridField addfrom = new ListGridField ("from", MESSAGES.from());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
459 addfrom.setType (ListGridFieldType.ICON);
3712
738010779c74 Add "to" and "from" strings to table columns.
Christian Lins <christian.lins@intevation.de>
parents: 3542
diff changeset
460 addfrom.setWidth (30);
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
461 addfrom.setCellIcon(baseUrl + MESSAGES.markerGreen());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
462
3712
738010779c74 Add "to" and "from" strings to table columns.
Christian Lins <christian.lins@intevation.de>
parents: 3542
diff changeset
463 ListGridField addto2 = new ListGridField ("to", MESSAGES.to());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
464 addto2.setType (ListGridFieldType.ICON);
3712
738010779c74 Add "to" and "from" strings to table columns.
Christian Lins <christian.lins@intevation.de>
parents: 3542
diff changeset
465 addto2.setWidth (30);
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
466 addto2.setCellIcon(baseUrl + MESSAGES.markerRed());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
467
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
468 locationDistanceTable.addCellClickHandler (new CellClickHandler () {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
469 @Override
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
470 public void onCellClick (CellClickEvent e) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
471 if (e.getColNum() == 0) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
472 Record r = e.getRecord ();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
473 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
474 double fromvalue =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
475 Double.parseDouble(r.getAttribute("from"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
476 double tovalue = getTo ();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
477 setDistanceValues (fromvalue, tovalue);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
478 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
479 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
480 // Is there anything to do in here?
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
481 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
482 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
483 else if (e.getColNum() == 1) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
484 Record r = e.getRecord ();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
485 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
486 double fromvalue = getFrom ();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
487 double tovalue =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
488 Double.parseDouble(r.getAttribute("from"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
489 setDistanceValues (fromvalue, tovalue);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
490 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
491 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
492 // Is there anything to do in here?
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
493 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
494 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
495 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
496 });
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
497 ListGridField bottom =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
498 new ListGridField("bottom", MESSAGES.bottom_edge());
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
499 bottom.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
500 bottom.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
501 bottom.setCellFormatter(cf);
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
502
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
503 ListGridField top =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
504 new ListGridField("top", MESSAGES.top_edge());
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
505 top.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
506 top.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
507 top.setCellFormatter(cf);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
508
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
509 ListGridField ldescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
510 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
511 ldescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
512 ldescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
513 ListGridField lside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
514 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
515 lside.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
516 lside.setWidth("12%");
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
517 ListGridField loc = new ListGridField("from", MESSAGES.locations());
903
dd702348b878 Changed columns to the correct type for most tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 893
diff changeset
518 loc.setType(ListGridFieldType.FLOAT);
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
519 loc.setAlign(Alignment.LEFT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
520 loc.setWidth("12%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
521 loc.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
522
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
523 locationDistanceTable.setFields(
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
524 addfrom, addto2, ldescr, loc, lside, bottom, top);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
525 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
526
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
527
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
528 @Override
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
529 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
530 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
531
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
532 Data dMode = getData(items, "ld_mode");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
533 DataItem[] dItems = dMode.getItems();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
534
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
535 boolean rangeMode = true;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
536 if (dItems != null && dItems[0] != null) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
537 rangeMode = FIELD_VALUE_DISTANCE.equals(dItems[0].getStringValue());
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
538 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
539
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
540 HLayout layout = new HLayout();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
541 layout.setWidth("400px");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
542
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
543 Label label = new Label(dataList.getLabel());
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
544 label.setWidth("200px");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
545
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
546 Canvas back = getBackButton(dataList.getState());
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
547
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
548 layout.addMember(label);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
549
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
550 if (rangeMode) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
551 layout.addMember(getOldRangeSelection(dataList));
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
552 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
553 else {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
554 layout.addMember(getOldLocationSelection(dataList));
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
555 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
556
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
557 layout.addMember(back);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
558
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
559 return layout;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
560 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
561
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
562
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
563 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
564 * Creates a label for the selected range.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
565 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
566 * @param dataList The DataList containing all values for this state.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
567 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
568 * @return A label displaying the selected values.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
569 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
570 protected Label getOldRangeSelection(DataList dataList) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
571 List<Data> items = dataList.getAll();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
572
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
573 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
574 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
575 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
576
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
577 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
578 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
579 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
580
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
581 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
582 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
583 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
584 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
585 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
586 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
587 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
588
91
0d8203594bb4 Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 83
diff changeset
589 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
590 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
591
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
592 return selected;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
593 }
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
594
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
595
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
596 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
597 * Creates a label for the selected locations.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
598 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
599 * @param dataList The DataList containing all values for this state.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
600 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
601 * @return A label displaying the selected values.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
602 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
603 protected Label getOldLocationSelection(DataList dataList) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
604 List<Data> items = dataList.getAll();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
605
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
606 Data dLocations = getData(items, "ld_locations");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
607 DataItem[] lItems = dLocations.getItems();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
608
3542
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
609 String[] splitted = lItems[0].getStringValue().split(" ");
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
610 String value = "";
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
611 for (int i = 0; i < splitted.length; i++) {
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
612 try {
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
613 NumberFormat nf = NumberFormat.getDecimalFormat();
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
614 double dv = Double.parseDouble(splitted[i]);
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
615 value += nf.format(dv) + " ";
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
616 }
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
617 catch(NumberFormatException nfe) {
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
618 value += splitted[i] + " ";
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
619 }
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
620 }
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
621
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
622 Label selected = new Label(value);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
623 selected.setWidth(130);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
624
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
625 return selected;
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
626 }
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
627
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
628
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
629 /**
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
630 * 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
631 * 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
632 *
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
633 * @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
634 */
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
635 protected void initDefaults(DataList list) {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
636 Data m = getData(list.getAll(), "ld_mode");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
637 Data l = getData(list.getAll(), "ld_locations");
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
638 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
639 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
640 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
641
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
642 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
643 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
644 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
645
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
646 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
647 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
648 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
649
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
650 DataItem mDef = m.getDefault();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
651 DataItem lDef = l.getDefault();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
652 DataItem fDef = f.getDefault();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
653 DataItem tDef = t.getDefault();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
654 DataItem sDef = s.getDefault();
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
655
517
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
656 String mDefValue = mDef != null ? mDef.getStringValue() : null;
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
657 String theMode = mDefValue != null && mDefValue.length() > 0
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
658 ? mDef.getStringValue()
588
809756dda091 #132 Set the initial mode of the location/distance panel to 'distance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 582
diff changeset
659 : FIELD_VALUE_DISTANCE;
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
660
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
661 mode.setValue(FIELD_MODE, theMode);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
662
517
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
663 String fDefValue = fDef != null ? fDef.getStringValue() : null;
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
664 setFrom(fDefValue != null && fDefValue.length() > 0
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
665 ? Double.valueOf(fDef.getStringValue())
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
666 : min);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
667
517
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
668 String tDefValue = tDef != null ? tDef.getStringValue() : null;
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
669 setTo(tDefValue != null && tDefValue.length() > 0
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
670 ? Double.valueOf(tDef.getStringValue())
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
671 : max);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
672
517
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
673 String sDefValue = sDef != null ? sDef.getStringValue() : null;
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
674 setStep(sDefValue != null && sDefValue.length() > 0
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
675 ? Double.valueOf(sDef.getStringValue())
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
676 : step);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
677
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
678 if (lDef != null) {
517
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
679 String lDefValue = lDef != null ? lDef.getStringValue() : null;
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
680
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
681 if (lDefValue != null && lDefValue.length() > 0) {
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
682 setLocationValues(lDef.getStringValue());
ec965bf8dfef Take care on empty Data objects while initializing default values in Location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 516
diff changeset
683 }
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
684 }
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
685
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
686 if (theMode.equals(FIELD_VALUE_DISTANCE)) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
687 enableDistancePanel();
588
809756dda091 #132 Set the initial mode of the location/distance panel to 'distance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 582
diff changeset
688 inputTables.selectTab(1);
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
689 }
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
690 currentFiltered = (ListGrid)inputTables.getSelectedTab().getPane();
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
691 }
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
692
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
693
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
694 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
695 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
696 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
697 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
698
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
699 // 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
700 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
701 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
702 getLocationValues(),
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
703 this);
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
704 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
705
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
706 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
707 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
708
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
709 container.setMembersMargin(30);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
710
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
711 inputTables = new TabSet();
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
712 inputTables.addTabSelectedHandler(new TabSelectedHandler() {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
713 @Override
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
714 public void onTabSelected(TabSelectedEvent evt) {
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
715 filterDescription.clear();
1537
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
716 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
717 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
718
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
719 Canvas c = evt.getTabPane();
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
720 if(c instanceof ListGrid) {
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
721 currentFiltered = (ListGrid)c;
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
722 }
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
723 }
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
724 });
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
725
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
726 Tab locations = new Tab(MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
727 Tab distances = new Tab(MESSAGES.distance());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
728
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
729 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
730 inputTables.setHeight100();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
731
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
732 locations.setPane(locationDistanceTable);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
733 distances.setPane(distanceTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
734
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
735 inputTables.addTab(locations);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
736 inputTables.addTab(distances);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
737
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
738 filterResultCount = new StaticTextItem(MESSAGES.resultCount());
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
739 filterResultCount.setTitleAlign(Alignment.LEFT);
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
740 filterResultCount.setTitleStyle("color: #000");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
741
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
742 filterDescription = new TableFilter();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
743 filterDescription.setHeight("30px");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
744 filterDescription.addFilterHandler(this);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
745
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
746 filterRange = new RangeTableFilter();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
747 filterRange.setHeight("30px");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
748 filterRange.addFilterHandler(this);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
749 filterRange.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
750
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
751 filterCriteria = new SelectItem();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
752 filterCriteria.setShowTitle(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
753 filterCriteria.setWidth(100);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
754 filterCriteria.addChangedHandler(new ChangedHandler() {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
755 @Override
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
756 public void onChanged(ChangedEvent e) {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
757 if(e.getValue().toString().equals("range")) {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
758 filterRange.setVisible(true);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
759 filterDescription.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
760 filterDescription.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
761 filterResultCount.setValue("");
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
762 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
763 else {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
764 filterRange.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
765 filterRange.clear();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
766 filterDescription.setVisible(true);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
767 filterResultCount.setValue("");
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
768 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
769 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
770 });
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
771
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
772 LinkedHashMap<String, String> filterMap =
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
773 new LinkedHashMap<String, String>();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
774 filterMap.put("description", MESSAGES.description());
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
775 filterMap.put("range", MESSAGES.range());
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
776 filterCriteria.setValueMap(filterMap);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
777 filterCriteria.setValue("description");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
778
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
779 DynamicForm form = new DynamicForm();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
780 form.setFields(filterCriteria);
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
781 inputTables.setHeight("*");
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
782 DynamicForm form2 = new DynamicForm();
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
783 form2.setFields(filterResultCount);
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
784
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
785 VLayout helper = new VLayout();
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
786 HLayout filterLayout = new HLayout();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
787
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
788 filterLayout.addMember(form);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
789 filterLayout.addMember(filterDescription);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
790 filterLayout.addMember(filterRange);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
791 filterLayout.setHeight("30px");
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
792 helper.addMember(inputTables);
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
793 helper.addMember(filterLayout);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
794 helper.addMember(form2);
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
795 helper.setHeight100();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
796 helper.setWidth100();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
797
869
94d9c8353ca9 Fixed the filter function and the helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 863
diff changeset
798 helperContainer.addMember(helper);
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
799 filterLayout.setWidth("200");
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
800
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
801 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
802 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
803
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
804
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
805 @Override
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
806 public void onFilterCriteriaChanged(StringFilterEvent event) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
807 String search = event.getFilter();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
808
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
809 if (search != null && search.length() > 0) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
810 Criteria c = new Criteria("description", search);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
811
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
812 locationsTable.filterData(c);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
813 distanceTable.filterData(c);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
814 locationDistanceTable.filterData(c);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
815 filterResultCount.setValue(currentFiltered.getRecords().length);
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
816 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
817 else {
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
818 locationsTable.clearCriteria();
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
819 distanceTable.clearCriteria();
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
820 locationDistanceTable.clearCriteria();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
821 filterResultCount.setValue("");
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
822 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
823 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
824
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
825
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
826 @Override
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
827 public void onFilterCriteriaChanged(RangeFilterEvent event) {
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
828 Float from = event.getFrom() - 0.001f;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
829 Float to = event.getTo() + 0.001f;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
830 GWT.log("filtering range: " + from + " to " + to);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
831
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
832
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
833 Criterion combinedFilter = null;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
834 Criterion locationFilter = null;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
835 if (from.equals(Float.NaN) && to.equals(Float.NaN)) {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
836 locationsTable.clearCriteria();
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
837 distanceTable.clearCriteria();
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
838 locationDistanceTable.clearCriteria();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
839 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
840 return;
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
841 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
842 else if (from.equals(Float.NaN)) {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
843 combinedFilter = new Criterion("to", OperatorId.LESS_OR_EQUAL, to);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
844 locationFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
845 new Criterion("from", OperatorId.LESS_OR_EQUAL, to);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
846 locationsTable.filterData(locationFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
847 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
848 locationDistanceTable.filterData(combinedFilter);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
849 filterResultCount.setValue(currentFiltered.getRecords().length);
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
850 return;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
851 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
852 else if (to.equals(Float.NaN)) {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
853 combinedFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
854 new Criterion("from", OperatorId.GREATER_OR_EQUAL, from);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
855 locationsTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
856 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
857 locationDistanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
858 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
859 else {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
860 AdvancedCriteria c1 =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
861 new AdvancedCriteria(OperatorId.AND, new Criterion[] {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
862 new Criterion("from", OperatorId.GREATER_OR_EQUAL, from),
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
863 new Criterion("from", OperatorId.LESS_OR_EQUAL, to)
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
864 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
865
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
866 AdvancedCriteria c2 =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
867 new AdvancedCriteria(OperatorId.AND, new Criterion[] {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
868 new Criterion("to", OperatorId.GREATER_OR_EQUAL, from),
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
869 new Criterion("to", OperatorId.LESS_OR_EQUAL, to)
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
870 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
871
1537
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
872 AdvancedCriteria c3 =
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
873 new AdvancedCriteria(OperatorId.AND, new Criterion[] {
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
874 new Criterion("from", OperatorId.LESS_OR_EQUAL, to),
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
875 new Criterion("to", OperatorId.GREATER_OR_EQUAL, from)
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
876 });
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
877
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
878 combinedFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
879 new AdvancedCriteria(OperatorId.OR, new Criterion[] {
1537
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
880 c1, c2, c3
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
881 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
882 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
883 locationsTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
884 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
885 locationDistanceTable.filterData(combinedFilter);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
886 filterResultCount.setValue(currentFiltered.getRecords().length);
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
887 }
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
888
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
889
562
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
890 @Override
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
891 public List<String> validate() {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
892 if (isLocationMode()) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
893 return validateLocations();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
894 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
895 else {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
896 return validateRange();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
897 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
898 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
899
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
900
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
901 protected List<String> validateLocations() {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
902 List<String> errors = new ArrayList<String>();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
903 NumberFormat nf = NumberFormat.getDecimalFormat();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
904
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
905 try {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
906 saveLocationValues(locationPanel);
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
907 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
908 catch (Exception e) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
909 errors.add(MESSAGES.wrongFormat());
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
910 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
911
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
912 double[] values = getLocationValues();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
913 double[] good = new double[values.length];
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
914 int idx = 0;
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
915
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
916 for (double value: values) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
917 if (value < min || value > max) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
918 String tmp = MESSAGES.error_validate_range();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
919 tmp = tmp.replace("$1", nf.format(value));
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
920 tmp = tmp.replace("$2", nf.format(min));
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
921 tmp = tmp.replace("$3", nf.format(max));
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
922 errors.add(tmp);
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
923 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
924 else {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
925 good[idx++] = value;
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
926 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
927 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
928
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
929 double[] justGood = new double[idx];
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
930 for (int i = 0; i < justGood.length; i++) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
931 justGood[i] = good[i];
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
932 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
933
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
934 if (!errors.isEmpty()) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
935 locationPanel.setValues(justGood);
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
936 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
937
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
938 return errors;
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
939 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
940
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
941
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
942 protected List<String> validateRange() {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
943 List<String> errors = new ArrayList<String>();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
944 NumberFormat nf = NumberFormat.getDecimalFormat();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
945
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
946 try {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
947 saveDistanceValues(distancePanel);
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
948 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
949 catch (Exception e) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
950 errors.add(MESSAGES.wrongFormat());
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
951 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
952
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
953 double from = getFrom();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
954 double to = getTo();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
955 double step = getStep();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
956
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
957 if (from < min || from > max) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
958 String tmp = MESSAGES.error_validate_lower_range();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
959 tmp = tmp.replace("$1", nf.format(from));
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
960 tmp = tmp.replace("$2", nf.format(min));
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
961 errors.add(tmp);
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
962 from = min;
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
963 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
964
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
965 if (to < min || to > max) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
966 String tmp = MESSAGES.error_validate_upper_range();
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
967 tmp = tmp.replace("$1", nf.format(to));
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
968 tmp = tmp.replace("$2", nf.format(max));
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
969 errors.add(tmp);
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
970 to = max;
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
971 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
972
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
973 if (!errors.isEmpty()) {
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
974 distancePanel.setValues(from, to, step);
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
975 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
976
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
977 return errors;
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
978 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
979
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
980
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
981 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
982 * 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
983 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
984 * @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
985 */
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
986 @Override
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
987 public Data[] getData() {
1277
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
988 List<Data> data = new ArrayList<Data>();
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
989
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
990 // If we have entered a value and click right afterwards on the
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
991 // '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
992 // 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
993 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
994 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
995 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
996 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
997 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
998 }
1277
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
999
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1000 Data dLocations = getDataLocations();
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1001 DataItem dFrom = new DefaultDataItem("ld_from", "ld_from", "");
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1002 DataItem dTo = new DefaultDataItem("ld_to", "ld_to", "");
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1003 DataItem dStep = new DefaultDataItem("ld_step", "ld_step", "");
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1004
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1005 data.add(dLocations);
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1006 data.add(new DefaultData(
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1007 "ld_from", null, null, new DataItem[] { dFrom } ));
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1008 data.add(new DefaultData(
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1009 "ld_to", null, null, new DataItem[] { dTo } ));
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1010 data.add(new DefaultData(
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1011 "ld_step", null, null, new DataItem[] { dStep } ));
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
1012 }
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
1013 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
1014 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
1015 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
1016 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
1017 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
1018 }
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
1019
1277
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1020 Data dFrom = getDataFrom();
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1021 Data dTo = getDataTo();
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1022 Data dStep = getDataStep();
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1023 DataItem loc = new DefaultDataItem("ld_locations", "ld_locations","");
520
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1024
1277
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1025 data.add(dFrom);
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1026 data.add(dTo);
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1027 data.add(dStep);
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1028 data.add(new DefaultData(
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1029 "ld_locations", null, null, new DataItem[] { loc } ));
520
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1030 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1031
1277
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1032 Data dMode = getDataMode();
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1033 if (dMode != null) {
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
1034 data.add(dMode);
520
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1035 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1036
3379
0de61fc9d281 Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1589
diff changeset
1037 return data.toArray(new Data[data.size()]);
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1038 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1039
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1040
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1041 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1042 * Returns the Data object for the 'mode' attribute.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1043 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1044 * @return the Data object for the 'mode' attribute.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1045 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1046 protected Data getDataMode() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1047 String value = mode.getValueAsString(FIELD_MODE);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1048 DataItem item = new DefaultDataItem("ld_mode", "ld_mode", value);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1049 return new DefaultData("ld_mode", null, null, new DataItem[] { item });
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1050 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1051
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1052
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1053 protected Data getDataLocations() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1054 double[] locations = getLocationValues();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1055 boolean first = true;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1056
520
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1057 if (locations == null) {
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1058 return null;
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1059 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1060
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1061 StringBuilder sb = new StringBuilder();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1062
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1063 for (double l: locations) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1064 if (!first) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1065 sb.append(" ");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1066 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1067
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1068 sb.append(l);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1069
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1070 first = false;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1071 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1072
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1073 DataItem item = new DefaultDataItem(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1074 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1075 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1076 sb.toString());
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1077
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1078 return new DefaultData(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1079 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1080 null,
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1081 null,
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1082 new DataItem[] { item });
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1083 }
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
1084
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1085
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1086 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1087 * 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
1088 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1089 * @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
1090 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1091 protected Data getDataFrom() {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1092 String value = Double.valueOf(getFrom()).toString();
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1093 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
1094 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
1095 "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
1096 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1097
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1098
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1099 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1100 * 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
1101 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1102 * @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
1103 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1104 protected Data getDataTo() {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1105 String value = Double.valueOf(getTo()).toString();
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1106 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
1107 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
1108 "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
1109 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1110
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1111
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1112 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1113 * 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
1114 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1115 * @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
1116 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1117 protected Data getDataStep() {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1118 String value = Double.valueOf(getStep()).toString();
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1119 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
1120 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
1121 "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
1122 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1123
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1124
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1125 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1126 * Determines the current input mode.
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1127 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1128 * @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
1129 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1130 public boolean isLocationMode() {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1131 String inputMode = mode.getValueAsString(FIELD_MODE);
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1132
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1133 return inputMode.equals(FIELD_VALUE_LOCATION) ? true : false;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1134 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1135
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1136
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1137 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1138 * Activates the location panel.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1139 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1140 protected void enableLocationPanel() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1141 locationPanel = new DoubleArrayPanel(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1142 MESSAGES.unitLocation(),
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1143 getLocationValues(),
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1144 this);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1145
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1146 container.removeMembers(container.getMembers());
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1147 container.addMember(locationPanel);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1148 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1149
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1150
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1151 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1152 * Activates the distance panel.
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1153 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1154 protected void enableDistancePanel() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1155 distancePanel = new DoubleRangePanel(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1156 MESSAGES.unitFrom(), MESSAGES.unitTo(), MESSAGES.unitWidth(),
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1157 getFrom(), getTo(), getStep(),
1491
2a00f4849738 Modified width of DoubleRangePanel in LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1401
diff changeset
1158 400,
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1159 this);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1160
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1161 container.removeMembers(container.getMembers());
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1162 container.addMember(distancePanel);
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
1163 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1164
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1165
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1166 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1167 * 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
1168 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1169 * @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
1170 */
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
1171 @Override
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
1172 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
1173 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
1174
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1175 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
1176 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
1177 }
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1178 if (value.equals(FIELD_VALUE_LOCATION)) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1179 enableLocationPanel();
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
1180 filterDescription.clear();
1537
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
1181 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1182 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1183
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1184 // Remove the tab containing the locationDistanceTable.
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1185 // The 'updateTab()' avoids the tab content to be destroyed.
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1186 inputTables.updateTab(0, null);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1187 inputTables.removeTab(0);
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
1188
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1189 // Create a new tab containing the locationTable
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
1190 Tab t1 = new Tab (MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1191 t1.setPane(locationsTable);
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1192 inputTables.addTab(t1, 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
1193
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1194 // Bring this tab to front.
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1195 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
1196 }
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
1197 else {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1198 enableDistancePanel();
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
1199 filterDescription.clear();
1537
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
1200 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1201 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1202
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1203 // Remove the tab containing the locationTable.
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1204 // The 'updateTab()' avoids the tab content to be destroyed.
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1205 inputTables.updateTab(0, null);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1206 inputTables.removeTab(0);
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
1207
5334
b296d435fc69 Doc and whitespace fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4131
diff changeset
1208 // Create a new tab containing the locationDistanceTable.
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
1209 Tab t1 = new Tab(MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1210 t1.setPane(locationDistanceTable);
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1211 inputTables.addTab(t1, 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
1212
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1213 // Bring the distanceTable tab to front.
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1214 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
1215 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1216 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1217
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1218
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1219 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1220 * 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
1221 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1222 * @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
1223 * 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
1224 */
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
1225 @Override
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
1226 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
1227 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
1228 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
1229
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1230 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
1231 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
1232 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1233
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
1234 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
1235 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
1236
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
1237 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
1238 }
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
1239 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
1240 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
1241
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
1242 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
1243 }
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
1244 }
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
1245
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
1246
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1247
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
1248 /**
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
1249 * 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
1250 *
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
1251 * @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
1252 */
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
1253 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
1254 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
1255
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
1256 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
1257 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
1258 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
1259 }
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
1260 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1261 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1262
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1263
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1264 /**
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
1265 * 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
1266 *
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
1267 * @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
1268 */
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
1269 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
1270 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
1271
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
1272 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
1273 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
1274 }
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
1275 }
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
1276
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
1277
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
1278 /**
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
1279 * 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
1280 *
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
1281 * @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
1282 * @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
1283 */
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
1284 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
1285 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
1286 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
1287 }
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
1288 }
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
1289
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
1290
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
1291 /**
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
1292 * 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
1293 *
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
1294 * @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
1295 * @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
1296 */
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
1297 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
1298 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
1299 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
1300 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
1301 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
1302 }
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
1303 }
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
1304
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
1305
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
1306 /**
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
1307 * 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
1308 * 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
1309 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1310 * @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
1311 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1312 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
1313 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
1314
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1315 RadioGroupItem radio = new RadioGroupItem(FIELD_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
1316 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
1317 radio.setVertical(false);
1394
819ce433243c Issue 339.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1393
diff changeset
1318 radio.setWrap(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
1319
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
1320 LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1321 values.put(FIELD_VALUE_LOCATION, MESSAGES.location());
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1322 values.put(FIELD_VALUE_DISTANCE, MESSAGES.distance());
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
1323
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3712
diff changeset
1324 LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>();
588
809756dda091 #132 Set the initial mode of the location/distance panel to 'distance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 582
diff changeset
1325 initial.put(FIELD_MODE, FIELD_VALUE_DISTANCE);
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
1326
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
1327 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
1328 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
1329
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
1330 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
1331 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
1332
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
1333 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
1334 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1335
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1336
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1337 protected void createDistanceInputPanel() {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1338 Config config = Config.getInstance();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1339 String url = config.getServerUrl();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1340 String river = "";
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1341
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1342 ArtifactDescription adescr = artifact.getArtifactDescription();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1343 DataList[] data = adescr.getOldData();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1344
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1345 if (data != null && data.length > 0) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1346 for (int i = 0; i < data.length; i++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1347 DataList dl = data[i];
3526
02d18d38fca7 Use river data in all states not only winfo in location/distance ui provider.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3379
diff changeset
1348 if (dl.getState().endsWith("river")) {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1349 for (int j = 0; j < dl.size(); j++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1350 Data d = dl.get(j);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1351 DataItem[] di = d.getItems();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1352 if (di != null && di.length == 1) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1353 river = d.getItems()[0].getStringValue();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1354 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1355 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1356 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1357 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1358 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1359
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1360 distanceTable.setDataSource(new DistanceInfoDataSource(
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1361 url, river, "distances"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1362 locationsTable.setDataSource(new DistanceInfoDataSource(
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1363 url, river, "locations"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1364 locationDistanceTable.setDataSource(new DistanceInfoDataSource(
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1365 url, river, "locations"));
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1366 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1367
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1368
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
1369 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
1370 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
1371 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1372
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1373
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
1374 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
1375 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
1376 }
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
1377
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1378
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
1379 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
1380 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
1381 }
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
1382
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1383
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
1384 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
1385 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
1386 }
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
1387
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
1388
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
1389 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
1390 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
1391 }
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
1392
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
1393
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
1394 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
1395 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
1396 }
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
1397
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
1398
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
1399 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
1400 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
1401 }
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
1402
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
1403
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
1404 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
1405 this.values = values;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1406 locationPanel.setValues(values);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1407 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1408
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1409
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1410 protected void setLocationValues(String values) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1411 String[] vs = values.split(" ");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1412
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1413 if (vs == null) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1414 return;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1415 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1416
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1417 double[] ds = new double[vs.length];
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1418 int idx = 0;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1419
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1420 for (String s: vs) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1421 try {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1422 ds[idx++] = Double.valueOf(s);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1423 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1424 catch (NumberFormatException nfe) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1425 // do nothing
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1426 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1427 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1428
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1429 setLocationValues(ds);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1430 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1431
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1432
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1433 protected void setDistanceValues (double from, double to) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1434 setFrom(from);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1435 setTo(to);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1436 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
1437 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1438 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1439 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org