annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 3542:9647a6548320

Issue 664. Made old value an i18n formated string. flys-client/trunk@5355 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 04 Sep 2012 11:08:15 +0000
parents 02d18d38fca7
children 738010779c74
rev   line source
41
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui;
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
520
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
3 import java.util.ArrayList;
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
4 import java.util.LinkedHashMap;
53
3d5d7788d471 The widgets in the static part of the parameter panel are created using UIProviders now. The ParameterList does not build widgets any longer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 51
diff changeset
5 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
6
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import com.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
8 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
9
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
10 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
11 import com.smartgwt.client.data.Criterion;
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.data.AdvancedCriteria;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
13 import com.smartgwt.client.types.OperatorId;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
14
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
15 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
16 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
17 import com.smartgwt.client.widgets.form.DynamicForm;
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
22 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
23 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
24
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
25 import com.smartgwt.client.widgets.form.fields.FormItem;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
26 import com.smartgwt.client.widgets.form.fields.SelectItem;
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
27 import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
28 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
29 import com.smartgwt.client.widgets.layout.HLayout;
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 import com.smartgwt.client.widgets.layout.VLayout;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
31 import com.smartgwt.client.widgets.grid.ListGrid;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
32 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
33 import com.smartgwt.client.widgets.grid.ListGridRecord;
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
34 import com.smartgwt.client.widgets.grid.CellFormatter;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
35 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
36 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
37 import com.smartgwt.client.widgets.grid.events.CellClickHandler;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
38 import com.smartgwt.client.widgets.grid.events.CellClickEvent;
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
39 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
40 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
41
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
42 import com.smartgwt.client.widgets.tab.TabSet;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
43 import com.smartgwt.client.widgets.tab.Tab;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
44 import com.smartgwt.client.data.Record;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
45
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
46 import com.smartgwt.client.types.ListGridFieldType;
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
47 import com.smartgwt.client.types.Alignment;
41
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 import de.intevation.flys.client.shared.model.Data;
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
50 import de.intevation.flys.client.shared.model.DataItem;
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 49
diff changeset
51 import de.intevation.flys.client.shared.model.DataList;
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
52 import de.intevation.flys.client.shared.model.DefaultData;
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
53 import de.intevation.flys.client.shared.model.DefaultDataItem;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
54 import de.intevation.flys.client.shared.model.DistanceInfoObject;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
55 import de.intevation.flys.client.shared.model.ArtifactDescription;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
56
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
57 import de.intevation.flys.client.client.services.DistanceInfoService;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
58 import de.intevation.flys.client.client.services.DistanceInfoServiceAsync;
211
b92281182c6b Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 101
diff changeset
59 import de.intevation.flys.client.client.FLYSConstants;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
60 import de.intevation.flys.client.client.Config;
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
61 import de.intevation.flys.client.client.event.FilterHandler;
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
62 import de.intevation.flys.client.client.event.StringFilterEvent;
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
63 import de.intevation.flys.client.client.event.RangeFilterEvent;
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
64 import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource;
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
65
87a44f8e25cc Added a new widget 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 /**
87a44f8e25cc Added a new widget 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 * 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
69 *
87a44f8e25cc Added a new widget 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 * @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
71 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 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
73 extends AbstractUIProvider
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
74 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
75 {
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
76 /** 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
77 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
78
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
79 /** 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
80 protected DistanceInfoServiceAsync distanceInfoService =
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
81 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
82
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
83 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
84
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
85 /** 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
86 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
87
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 /** The 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
89 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
90
516
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 locations.*/
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_LOCATION = "location";
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
93
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
94 /** 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
95 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
96
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
97 /** 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
98 * 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
99 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
100
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
101 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
102
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 /** 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
105 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
106
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 /** 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
108 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
109
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
110 /** 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
111 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
112
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
113 /** 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
114 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
115
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
116 /** 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
117 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
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 '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
120 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
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 '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
123 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
124
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
125 /** 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
126 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
127
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
128 /** The input panel for locations. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
129 protected DoubleArrayPanel locationPanel;
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 input panel for distances. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
132 protected DoubleRangePanel distancePanel;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
133
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
134 /** 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
135 protected TabSet inputTables;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
136
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
137 /** The distance table. */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
138 protected ListGrid distanceTable;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
139
838
a5e96a36478c Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 788
diff changeset
140 /** The locations table. */
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
141 protected ListGrid locationsTable;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
142
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
143 /** The locations table for distance input. */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
144 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
145
237
cf25f235b7b6 Cash the table data and rebuild the location table on distance selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 235
diff changeset
146 /** 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
147 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
148
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
149 /** 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
150 protected TableFilter filterDescription;
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
151 protected RangeTableFilter filterRange;
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
152
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
153 /** 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
154 protected SelectItem filterCriteria;
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
155 protected StaticTextItem filterResultCount;
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
156 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
157
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
158 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 * 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
160 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 public LocationDistancePanel() {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
162 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
163 distanceTable.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 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
166 locationsTable.setAutoFetchData(true);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
167
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
168 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
169 locationDistanceTable.setAutoFetchData(true);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
170
284
be842e36ce1c ISSUE 46: Removed the table header context menu.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 272
diff changeset
171 locationDistanceTable.setShowHeaderContextMenu(false);
be842e36ce1c ISSUE 46: Removed the table header context menu.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 272
diff changeset
172 distanceTable.setShowHeaderContextMenu(false);
be842e36ce1c ISSUE 46: Removed the table header context menu.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 272
diff changeset
173 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
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
87a44f8e25cc Added a new widget 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
87a44f8e25cc Added a new widget 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 /**
87a44f8e25cc Added a new widget 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 * 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
179 * 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
180 * 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
181 *
87a44f8e25cc Added a new widget 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 * @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
183 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 * @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
185 */
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
186 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
187 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
188 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
189
57
246af33f621c Adjusted the look of the 'next' button in the parameter panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 55
diff changeset
190 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
191 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
192 Canvas submit = getNextButton();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
193 createDistanceInputPanel();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
194
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
195 initDefaults(data);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
196
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
197 createLocationTableDistance ();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
198 createDistanceTable();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
199 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
200
83
4784ca718476 Improved the positioning of helper widgets and some layout specific stuff.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 59
diff changeset
201 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
202 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
203
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 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
205 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
206 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
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 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
209 }
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
210
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
211
235
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 * 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
214 */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
215 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
216
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
217 String baseUrl = GWT.getHostPageBaseURL();
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
218
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
219 distanceTable.setWidth100();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
220 distanceTable.setShowRecordComponents(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
221 distanceTable.setShowRecordComponentsByCell(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
222 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
223 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
224 distanceTable.setCanReorderFields(false);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
225
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
226 CellFormatter cf = new CellFormatter() {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
227 public String format(
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
228 Object value,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
229 ListGridRecord record,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
230 int rowNum, int colNum) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
231 if (value == null) return null;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
232 try {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
233 NumberFormat nf;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
234 double v = Double.parseDouble((String)value);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
235 nf = NumberFormat.getFormat("###0.00##");
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
236 return nf.format(v);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
237 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
238 catch (Exception e) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
239 return value.toString();
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 };
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
243
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
244 ListGridField addDistance = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
245 addDistance.setType (ListGridFieldType.ICON);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
246 addDistance.setWidth (20);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
247 addDistance.addRecordClickHandler (new RecordClickHandler () {
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() {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
342 public String format(
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
343 Object value,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
344 ListGridRecord record,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
345 int rowNum, int colNum) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
346 if (value == null) return null;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
347 try {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
348 NumberFormat nf;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
349 double v = Double.parseDouble((String)value);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
350 nf = NumberFormat.getFormat("###0.00##");
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
351 return nf.format(v);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
352 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
353 catch (Exception e) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
354 return value.toString();
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
355 }
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
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
361 ListGridField addLocation = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
362 addLocation.setType (ListGridFieldType.ICON);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
363 addLocation.setWidth (20);
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
364
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
365 addLocation.addRecordClickHandler (new RecordClickHandler () {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
366 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
367 Record record = e.getRecord();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
368 double[] selected;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
369 if (getLocationValues() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
370 double[] val = getLocationValues();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
371 selected = new double[val.length + 1];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
372 for(int i = 0; i < val.length; i++){
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
373 selected[i] = val[i];
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
374 }
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
375 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
376 selected[val.length] =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
377 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
378 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
379 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
380 // 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
381 }
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
382 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
383 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
384 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
385 selected[0] =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
386 Double.parseDouble(record.getAttribute("from"));
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
387 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
388 setLocationValues(selected);
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 });
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
391 addLocation.setCellIcon (baseUrl + MESSAGES.markerGreen ());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
392
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
393 ListGridField ldescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
394 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
395 ldescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
396 ldescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
397 ListGridField lside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
398 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
399 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
400 lside.setWidth("12%");
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
401 ListGridField loc = new ListGridField("from", MESSAGES.locations());
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
402 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
403 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
404 loc.setWidth("12%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
405 loc.setCellFormatter(cf);
615
ba1b27b7d282 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 588
diff changeset
406
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
407 ListGridField bottom =
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
408 new ListGridField("bottom", MESSAGES.bottom_edge());
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
409 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
410 bottom.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
411 bottom.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
412
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
413 ListGridField top =
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
414 new ListGridField("top", MESSAGES.top_edge());
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
415 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
416 top.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
417 top.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
418
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
419 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
420 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
421
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 * 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
425 */
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
426 protected void createLocationTableDistance (){
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
427
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
428 String baseUrl = GWT.getHostPageBaseURL();
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
429
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
430 locationDistanceTable.setWidth100();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
431 locationDistanceTable.setShowRecordComponents(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
432 locationDistanceTable.setShowRecordComponentsByCell(true);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
433 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
434 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
435 locationDistanceTable.setCanReorderFields(false);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
436
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
437 CellFormatter cf = new CellFormatter() {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
438 public String format(
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
439 Object value,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
440 ListGridRecord record,
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
441 int rowNum, int colNum) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
442 if (value == null) return null;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
443 try {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
444 NumberFormat nf;
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
445 double v = Double.parseDouble((String)value);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
446 nf = NumberFormat.getFormat("###0.00##");
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
447 return nf.format(v);
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
448 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
449 catch (Exception e) {
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
450 return value.toString();
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 }
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
453 };
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
454
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
455 ListGridField addfrom = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
456 addfrom.setType (ListGridFieldType.ICON);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
457 addfrom.setWidth (20);
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
458 addfrom.setCellIcon(baseUrl + MESSAGES.markerGreen());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
459
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
460 ListGridField addto2 = new ListGridField ("", "");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
461 addto2.setType (ListGridFieldType.ICON);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
462 addto2.setWidth (20);
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1394
diff changeset
463 addto2.setCellIcon(baseUrl + MESSAGES.markerRed());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
464
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
465 locationDistanceTable.addCellClickHandler (new CellClickHandler () {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
466 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
467 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
468 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
469 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
470 double fromvalue =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
471 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
472 double tovalue = getTo ();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
473 setDistanceValues (fromvalue, tovalue);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
474 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
475 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
476 // 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
477 }
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 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
480 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
481 try {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
482 double fromvalue = getFrom ();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
483 double tovalue =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
484 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
485 setDistanceValues (fromvalue, tovalue);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
486 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
487 catch(NumberFormatException nfe) {
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
488 // 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
489 }
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 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
492 });
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
493 ListGridField bottom =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
494 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
495 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
496 bottom.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
497 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
498
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
499 ListGridField top =
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
500 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
501 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
502 top.setWidth("10%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
503 top.setCellFormatter(cf);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
504
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
505 ListGridField ldescr = new ListGridField("description",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
506 MESSAGES.description());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
507 ldescr.setType(ListGridFieldType.TEXT);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
508 ldescr.setWidth("*");
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
509 ListGridField lside = new ListGridField("riverside",
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
510 MESSAGES.riverside());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
511 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
512 lside.setWidth("12%");
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
513 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
514 loc.setType(ListGridFieldType.FLOAT);
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
515 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
516 loc.setWidth("12%");
1390
13d07b7daa89 Issue 342.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1318
diff changeset
517 loc.setCellFormatter(cf);
568
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
518
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
519 locationDistanceTable.setFields(
1d20533a4ae3 Bring Oberkante and Unterkante into UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
520 addfrom, addto2, ldescr, loc, lside, bottom, top);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
521 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
522
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
523
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
524 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
525 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
526
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
527 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
528 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
529
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
530 boolean rangeMode = true;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
531 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
532 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
533 }
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 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
536 layout.setWidth("400px");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
537
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
538 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
539 label.setWidth("200px");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
540
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
541 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
542
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
543 layout.addMember(label);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
544
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
545 if (rangeMode) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
546 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
547 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
548 else {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
549 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
550 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
551
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
552 layout.addMember(back);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
553
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
554 return layout;
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
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 * 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
560 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
561 * @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
562 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
563 * @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
564 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
565 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
566 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
567
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
568 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
569 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
570 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
571
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
572 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
573 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
574 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
575
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 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
577 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
578 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
579 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
580 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
581 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
582 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
583
91
0d8203594bb4 Resized CollectionView and set the content size to have a tabled style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 83
diff changeset
584 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
585 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
586
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
587 return selected;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
588 }
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
589
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
590
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
591 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
592 * 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
593 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
594 * @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
595 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
596 * @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
597 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
598 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
599 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
600
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
601 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
602 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
603
3542
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
604 String[] splitted = lItems[0].getStringValue().split(" ");
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
605 String value = "";
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
606 for (int i = 0; i < splitted.length; i++) {
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
607 try {
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
608 NumberFormat nf = NumberFormat.getDecimalFormat();
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
609 double dv = Double.parseDouble(splitted[i]);
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
610 value += nf.format(dv) + " ";
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
611 }
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
612 catch(NumberFormatException nfe) {
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
613 value += splitted[i] + " ";
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
614 }
9647a6548320 Issue 664.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3526
diff changeset
615 }
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
616
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
617 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
618 selected.setWidth(130);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
619
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
620 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
621 }
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
622
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
623
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
624 /**
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
625 * 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
626 * 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
627 *
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
628 * @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
629 */
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
630 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
631 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
632 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
633 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
634 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
635 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
636
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
637 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
638 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
639 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
640
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
641 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
642 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
643 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
644
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
645 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
646 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
647 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
648 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
649 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
650
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
651 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
652 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
653 ? 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
654 : 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
655
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
656 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
657
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
658 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
659 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
660 ? 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
661 : min);
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 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
664 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
665 ? 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
666 : max);
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 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
669 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
670 ? 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
671 : step);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
672
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
673 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
674 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
675
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
676 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
677 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
678 }
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
679 }
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
680
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
681 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
682 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
683 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
684 }
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
685 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
686 }
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
687
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
688
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
689 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
690 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
691 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
692 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
693
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
694 // 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
695 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
696 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
697 getLocationValues(),
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
698 this);
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
699 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
700
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
701 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
702 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
703
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
704 container.setMembersMargin(30);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
705
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
706 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
707 inputTables.addTabSelectedHandler(new TabSelectedHandler() {
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
708 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
709 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
710 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
711 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
712
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
713 Canvas c = evt.getTabPane();
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
714 if(c instanceof ListGrid) {
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
715 currentFiltered = (ListGrid)c;
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
716 }
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
717 }
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
718 });
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
719
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
720 Tab locations = new Tab(MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
721 Tab distances = new Tab(MESSAGES.distance());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
722
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
723 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
724 inputTables.setHeight100();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
725
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
726 locations.setPane(locationDistanceTable);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
727 distances.setPane(distanceTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
728
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
729 inputTables.addTab(locations);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
730 inputTables.addTab(distances);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
731
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
732 filterResultCount = new StaticTextItem(MESSAGES.resultCount());
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
733 filterResultCount.setTitleAlign(Alignment.LEFT);
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
734 filterResultCount.setTitleStyle("color: #000");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
735
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
736 filterDescription = new TableFilter();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
737 filterDescription.setHeight("30px");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
738 filterDescription.addFilterHandler(this);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
739
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
740 filterRange = new RangeTableFilter();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
741 filterRange.setHeight("30px");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
742 filterRange.addFilterHandler(this);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
743 filterRange.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
744
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
745 filterCriteria = new SelectItem();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
746 filterCriteria.setShowTitle(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
747 filterCriteria.setWidth(100);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
748 filterCriteria.addChangedHandler(new ChangedHandler() {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
749 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
750 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
751 filterRange.setVisible(true);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
752 filterDescription.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
753 filterDescription.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
754 filterResultCount.setValue("");
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
755 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
756 else {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
757 filterRange.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
758 filterRange.clear();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
759 filterDescription.setVisible(true);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
760 filterResultCount.setValue("");
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
761 }
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 });
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
764
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
765 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
766 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
767 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
768 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
769 filterCriteria.setValueMap(filterMap);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
770 filterCriteria.setValue("description");
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 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
773 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
774 inputTables.setHeight("*");
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
775 DynamicForm form2 = new DynamicForm();
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
776 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
777
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
778 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
779 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
780
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
781 filterLayout.addMember(form);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
782 filterLayout.addMember(filterDescription);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
783 filterLayout.addMember(filterRange);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
784 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
785 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
786 helper.addMember(filterLayout);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
787 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
788 helper.setHeight100();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
789 helper.setWidth100();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
790
869
94d9c8353ca9 Fixed the filter function and the helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 863
diff changeset
791 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
792 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
793
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
794 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
795 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
796
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
797
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
798 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
799 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
800
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
801 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
802 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
803
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
804 locationsTable.filterData(c);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
805 distanceTable.filterData(c);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
806 locationDistanceTable.filterData(c);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
807 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
808 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
809 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
810 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
811 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
812 locationDistanceTable.clearCriteria();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
813 filterResultCount.setValue("");
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
814 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
815 }
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
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
818 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
819 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
820 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
821 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
822
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
823
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
824 Criterion combinedFilter = null;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
825 Criterion locationFilter = null;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
826 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
827 locationsTable.clearCriteria();
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
828 distanceTable.clearCriteria();
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
829 locationDistanceTable.clearCriteria();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
830 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
831 return;
1536
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 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
834 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
835 locationFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
836 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
837 locationsTable.filterData(locationFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
838 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
839 locationDistanceTable.filterData(combinedFilter);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
840 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
841 return;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
842 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
843 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
844 combinedFilter =
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.GREATER_OR_EQUAL, from);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
846 locationsTable.filterData(combinedFilter);
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);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
849 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
850 else {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
851 AdvancedCriteria c1 =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
852 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
853 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
854 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
855 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
856
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
857 AdvancedCriteria c2 =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
858 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
859 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
860 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
861 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
862
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
863 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
864 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
865 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
866 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
867 });
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
868
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
869 combinedFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
870 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
871 c1, c2, c3
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
872 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
873 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
874 locationsTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
875 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
876 locationDistanceTable.filterData(combinedFilter);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
877 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
878 }
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
879
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
880
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
881 @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
882 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
883 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
884 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
885 }
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
886 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
887 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
888 }
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
889 }
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
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
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 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
893 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
894 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
895
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 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
897 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
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 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
900 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
901 }
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
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 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
904 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
905 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
906
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 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
908 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
909 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
910 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
911 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
912 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
913 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
914 }
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 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
916 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
917 }
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 }
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
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 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
921 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
922 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
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
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 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
926 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
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 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
930 }
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
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 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
934 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
935 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
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 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
938 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
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 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
941 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
942 }
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
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 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
945 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
946 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
947
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 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
949 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
950 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
951 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
952 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
953 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
954 }
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
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 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
957 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
958 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
959 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
960 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
961 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
962 }
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 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
965 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
966 }
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
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 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
969 }
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
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
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
972 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
973 * 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
974 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
975 * @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
976 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
977 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
978 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
979
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
980 // XXX If we have entered a value and click right afterwards on the
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
981 // '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
982 // 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
983 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
984 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
985 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
986 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
987 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
988 }
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
989
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
990 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
991 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
992 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
993 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
994
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
995 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
996 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
997 "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
998 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
999 "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
1000 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
1001 "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
1002 }
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
1003 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
1004 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
1005 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
1006 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
1007 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
1008 }
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
1009
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
1010 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
1011 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
1012 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
1013 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
1014
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
1015 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
1016 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
1017 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
1018 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
1019 "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
1020 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1021
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
1022 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
1023 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
1024 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
1025 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1026
3379
0de61fc9d281 Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1589
diff changeset
1027 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
1028 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1029
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1030
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1031 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1032 * 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
1033 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1034 * @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
1035 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1036 protected Data getDataMode() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1037 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
1038 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
1039 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
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
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1043 protected Data getDataLocations() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1044 double[] locations = getLocationValues();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1045 boolean first = true;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1046
520
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1047 if (locations == null) {
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1048 return null;
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1049 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1050
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1051 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
1052
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1053 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
1054 if (!first) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1055 sb.append(" ");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1056 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1057
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1058 sb.append(l);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1059
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1060 first = false;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1061 }
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 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
1064 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1065 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1066 sb.toString());
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 return new DefaultData(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1069 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1070 null,
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1071 null,
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1072 new DataItem[] { item });
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1073 }
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
1074
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1075
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1076 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1077 * 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
1078 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1079 * @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
1080 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1081 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
1082 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
1083 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
1084 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
1085 "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
1086 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1087
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1090 * 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
1091 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1092 * @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
1093 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1094 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
1095 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
1096 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
1097 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
1098 "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
1099 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1100
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1103 * 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
1104 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1105 * @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
1106 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1107 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
1108 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
1109 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
1110 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
1111 "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
1112 }
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1113
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 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1116 * Determines the current input mode.
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1117 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1118 * @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
1119 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1120 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
1121 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
1122
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1123 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
1124 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1125
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1126
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1127 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1128 * 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
1129 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1130 protected void enableLocationPanel() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1131 locationPanel = new DoubleArrayPanel(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1132 MESSAGES.unitLocation(),
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1133 getLocationValues(),
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1134 this);
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 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
1137 container.addMember(locationPanel);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1138 }
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
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1141 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1142 * 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
1143 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1144 protected void enableDistancePanel() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1145 distancePanel = new DoubleRangePanel(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1146 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
1147 getFrom(), getTo(), getStep(),
1491
2a00f4849738 Modified width of DoubleRangePanel in LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1401
diff changeset
1148 400,
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1149 this);
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 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
1152 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
1153 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1154
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1155
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1156 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1157 * 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
1158 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1159 * @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
1160 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1161 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
1162 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
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 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
1165 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
1166 }
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1167 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
1168 enableLocationPanel();
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
1169 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
1170 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1171 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1172
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1173 // 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
1174 // 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
1175 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
1176 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
1177
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1178 // 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
1179 Tab t1 = new Tab (MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1180 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
1181 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
1182
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1183 // Bring this tab to front.
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1184 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
1185 }
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
1186 else {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1187 enableDistancePanel();
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
1188 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
1189 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1190 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1191
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1192 // 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
1193 // 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
1194 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
1195 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
1196
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1197 //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
1198 Tab t1 = new Tab(MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1199 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
1200 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
1201
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1202 // Bring the distanceTable tab to front.
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1203 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
1204 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1205 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1206
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1207
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1208 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1209 * 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
1210 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1211 * @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
1212 * 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
1213 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1214 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
1215 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
1216 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
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 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
1219 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
1220 }
87a44f8e25cc Added a new widget 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
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
1222 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
1223 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
1224
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
1225 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
1226 }
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
1227 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
1228 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
1229
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
1230 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
1231 }
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
1232 }
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
1233
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
1234
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1235
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
1236 /**
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 * 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
1238 *
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
1239 * @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
1240 */
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
1241 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
1242 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
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 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
1245 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
1246 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
1247 }
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
1248 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1249 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1250
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1251
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1252 /**
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
1253 * 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
1254 *
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 * @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
1256 */
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 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
1258 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
1259
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
1260 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
1261 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
1262 }
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
1263 }
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
1264
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
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 * 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
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 * @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
1270 * @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
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 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
1273 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
1274 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
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 /**
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 * 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
1281 *
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 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
1283 * @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
1284 */
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 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
1286 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
1287 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
1288 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
1289 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
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
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 /**
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
1295 * 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
1296 * 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
1297 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1298 * @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
1299 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1300 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
1301 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
1302
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1303 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
1304 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
1305 radio.setVertical(false);
1394
819ce433243c Issue 339.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1393
diff changeset
1306 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
1307
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
1308 LinkedHashMap values = new LinkedHashMap();
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1309 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
1310 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
1311
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
1312 LinkedHashMap initial = new LinkedHashMap();
588
809756dda091 #132 Set the initial mode of the location/distance panel to 'distance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 582
diff changeset
1313 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
1314
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
1315 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
1316 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
1317
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
1318 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
1319 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
1320
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
1321 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
1322 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1323
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1324
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1325 protected void createDistanceInputPanel() {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1326 Config config = Config.getInstance();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1327 String url = config.getServerUrl();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1328 String locale = config.getLocale ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1329 String river = "";
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1330
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1331 ArtifactDescription adescr = artifact.getArtifactDescription();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1332 DataList[] data = adescr.getOldData();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1333
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1334 if (data != null && data.length > 0) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1335 for (int i = 0; i < data.length; i++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1336 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
1337 if (dl.getState().endsWith("river")) {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1338 for (int j = 0; j < dl.size(); j++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1339 Data d = dl.get(j);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1340 DataItem[] di = d.getItems();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1341 if (di != null && di.length == 1) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1342 river = d.getItems()[0].getStringValue();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1343 }
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 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1346 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1347 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1348
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1349 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
1350 url, river, "distances"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1351 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
1352 url, river, "locations"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1353 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
1354 url, river, "locations"));
235
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
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1358 /* protected void updateDistanceInfo(DistanceInfoObject[] di) {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1359 int i = 0;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1360 for (DistanceInfoObject dio: di) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1361 if (dio.getTo() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1362 distanceTable.addData(new DistanceInfoRecord(dio));
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1363 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1364 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1365 locationsTable.addData(new DistanceInfoRecord(dio));
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1366 locationDistanceTable.addData(new DistanceInfoRecord(dio));
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 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1369 return;
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1370 }*/
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1371
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1372
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
1373 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
1374 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
1375 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1376
87a44f8e25cc Added a new widget 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
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
1378 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
1379 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
1380 }
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
1381
87a44f8e25cc Added a new widget 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
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
1383 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
1384 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
1385 }
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
1386
87a44f8e25cc Added a new widget 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 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
1389 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
1390 }
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
1391
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
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 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
1394 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
1395 }
6bcd8e3f21a7 Refactored the LocationDistancePanel, 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 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
1399 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
1400 }
6bcd8e3f21a7 Refactored the LocationDistancePanel, 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 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
1404 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
1405 }
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1406
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1407
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1408 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
1409 this.values = values;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1410 locationPanel.setValues(values);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1411 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1412
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1413
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1414 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
1415 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
1416
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1417 if (vs == null) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1418 return;
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
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1421 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
1422 int idx = 0;
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 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
1425 try {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1426 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
1427 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1428 catch (NumberFormatException nfe) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1429 // do nothing
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
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1433 setLocationValues(ds);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1434 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1435
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1436
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1437 protected void setDistanceValues (double from, double to) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1438 setFrom(from);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1439 setTo(to);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1440 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
1441 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1442 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1443 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org