annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 3526:02d18d38fca7

Use river data in all states not only winfo in location/distance ui provider. flys-client/trunk@5326 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Aug 2012 11:19:29 +0000
parents 0de61fc9d281
children 9647a6548320
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
1580
0dad8ab80005 #469 Use correct I18N string to display inserted locations in LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1567
diff changeset
604 String value = lItems[0].getLabel();
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
605
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
606 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
607 selected.setWidth(130);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
608
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
609 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
610 }
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
611
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
612
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
613 /**
55
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
614 * 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
615 * 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
616 *
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
617 * @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
618 */
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
619 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
620 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
621 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
622 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
623 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
624 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
625
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
626 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
627 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
628 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
629
4439f642f632 Read min/max values for the distance mode in the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 53
diff changeset
630 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
631 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
632 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
633
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
634 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
635 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
636 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
637 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
638 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
639
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
640 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
641 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
642 ? 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
643 : 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
644
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
645 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
646
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
647 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
648 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
649 ? 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
650 : min);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
651
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
652 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
653 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
654 ? 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
655 : max);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
656
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
657 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
658 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
659 ? 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
660 : step);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
661
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
662 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
663 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
664
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
665 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
666 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
667 }
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
668 }
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
669
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
670 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
671 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
672 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
673 }
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
674 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
675 }
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
676
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
677
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
678 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
679 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
680 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
681 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
682
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
683 // 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
684 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
685 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
686 getLocationValues(),
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
687 this);
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
688 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
689
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
690 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
691 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
692
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
693 container.setMembersMargin(30);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
694
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
695 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
696 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
697 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
698 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
699 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
700 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
701
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
702 Canvas c = evt.getTabPane();
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
703 if(c instanceof ListGrid) {
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
704 currentFiltered = (ListGrid)c;
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
705 }
893
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
706 }
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
707 });
89c01218172b Clear the table filter on tab selection change and input method change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
708
570
85d7cc0f2bab #88 Modified strings in the location/distance panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 568
diff changeset
709 Tab locations = new Tab(MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
710 Tab distances = new Tab(MESSAGES.distance());
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
711
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
712 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
713 inputTables.setHeight100();
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
714
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
715 locations.setPane(locationDistanceTable);
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
716 distances.setPane(distanceTable);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
717
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
718 inputTables.addTab(locations);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
719 inputTables.addTab(distances);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
720
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
721 filterResultCount = new StaticTextItem(MESSAGES.resultCount());
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
722 filterResultCount.setTitleAlign(Alignment.LEFT);
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
723 filterResultCount.setTitleStyle("color: #000");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
724
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
725 filterDescription = new TableFilter();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
726 filterDescription.setHeight("30px");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
727 filterDescription.addFilterHandler(this);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
728
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
729 filterRange = new RangeTableFilter();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
730 filterRange.setHeight("30px");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
731 filterRange.addFilterHandler(this);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
732 filterRange.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
733
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
734 filterCriteria = new SelectItem();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
735 filterCriteria.setShowTitle(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
736 filterCriteria.setWidth(100);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
737 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
738 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
739 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
740 filterRange.setVisible(true);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
741 filterDescription.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
742 filterDescription.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
743 filterResultCount.setValue("");
1534
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 else {
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
746 filterRange.setVisible(false);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
747 filterRange.clear();
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
748 filterDescription.setVisible(true);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
749 filterResultCount.setValue("");
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
750 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
751 }
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
752 });
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
753
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
754 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
755 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
756 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
757 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
758 filterCriteria.setValueMap(filterMap);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
759 filterCriteria.setValue("description");
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
760
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
761 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
762 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
763 inputTables.setHeight("*");
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
764 DynamicForm form2 = new DynamicForm();
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
765 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
766
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
767 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
768 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
769
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
770 filterLayout.addMember(form);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
771 filterLayout.addMember(filterDescription);
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
772 filterLayout.addMember(filterRange);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
773 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
774 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
775 helper.addMember(filterLayout);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
776 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
777 helper.setHeight100();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
778 helper.setWidth100();
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
779
869
94d9c8353ca9 Fixed the filter function and the helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 863
diff changeset
780 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
781 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
782
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
783 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
784 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
785
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
786
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
787 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
788 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
789
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
790 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
791 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
792
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
793 locationsTable.filterData(c);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
794 distanceTable.filterData(c);
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
795 locationDistanceTable.filterData(c);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
796 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
797 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
798 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
799 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
800 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
801 locationDistanceTable.clearCriteria();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
802 filterResultCount.setValue("");
863
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 }
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
805
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
806
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
807 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
808 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
809 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
810 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
811
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
812
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
813 Criterion combinedFilter = null;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
814 Criterion locationFilter = null;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
815 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
816 locationsTable.clearCriteria();
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
817 distanceTable.clearCriteria();
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
818 locationDistanceTable.clearCriteria();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
819 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
820 return;
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
821 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
822 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
823 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
824 locationFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
825 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
826 locationsTable.filterData(locationFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
827 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
828 locationDistanceTable.filterData(combinedFilter);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
829 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
830 return;
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
831 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
832 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
833 combinedFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
834 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
835 locationsTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
836 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
837 locationDistanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
838 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
839 else {
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
840 AdvancedCriteria c1 =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
841 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
842 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
843 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
844 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
845
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
846 AdvancedCriteria c2 =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
847 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
848 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
849 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
850 });
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
851
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
852 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
853 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
854 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
855 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
856 });
2b104fa094e2 Added filter criterion and clear filter on tab selection changed and input mode
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1536
diff changeset
857
1536
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
858 combinedFilter =
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
859 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
860 c1, c2, c3
1536
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 }
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
863 locationsTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
864 distanceTable.filterData(combinedFilter);
4f4d29404dba Filter the helper input tables using the range filter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1534
diff changeset
865 locationDistanceTable.filterData(combinedFilter);
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
866 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
867 }
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
868
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
869
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
870 @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
871 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
872 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
873 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
874 }
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
875 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
876 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
877 }
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
878 }
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
879
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
880
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 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
882 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
883 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
884
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 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
886 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
887 }
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 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
889 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
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 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
893 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
894 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
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 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
897 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
898 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
899 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
900 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
901 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
902 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
903 }
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 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
905 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
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 }
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
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 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
910 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
911 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
912 }
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
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 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
915 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
916 }
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 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
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
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
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 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
923 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
924 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
925
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 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
927 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
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 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
930 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
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 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
934 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
935 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
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 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
938 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
939 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
940 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
941 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
942 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
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
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 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
946 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
947 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
948 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
949 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
950 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
951 }
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
952
9f16ac843dda Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 520
diff changeset
953 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
954 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
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
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 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
958 }
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
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
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
961 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
962 * 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
963 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
964 * @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
965 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
966 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
967 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
968
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
969 // 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
970 // '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
971 // 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
972 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
973 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
974 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
975 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
976 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
977 }
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
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 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
980 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
981 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
982 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
983
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
984 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
985 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
986 "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
987 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
988 "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
989 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
990 "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
991 }
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
992 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
993 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
994 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
995 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
996 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
997 }
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
998
1277
ee55a8ab5f5e Bugfix: #211 Reset values of km range mode if single km mode is selected and the other way arround.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 906
diff changeset
999 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
1000 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
1001 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
1002 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
1003
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
1004 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
1005 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
1006 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
1007 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
1008 "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
1009 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1010
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
1011 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
1012 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
1013 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
1014 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1015
3379
0de61fc9d281 Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1589
diff changeset
1016 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
1017 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1018
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1019
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1020 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1021 * 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
1022 *
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1023 * @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
1024 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1025 protected Data getDataMode() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1026 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
1027 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
1028 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
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 protected Data getDataLocations() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1033 double[] locations = getLocationValues();
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1034 boolean first = true;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1035
520
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1036 if (locations == null) {
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1037 return null;
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1038 }
9e2b151770bd Bugfix in the range/location panel - avoid NullPointerExceptions in getData().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 517
diff changeset
1039
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1040 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
1041
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1042 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
1043 if (!first) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1044 sb.append(" ");
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1045 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1046
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1047 sb.append(l);
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1048
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1049 first = false;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1050 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1051
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1052 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
1053 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1054 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1055 sb.toString());
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 return new DefaultData(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1058 "ld_locations",
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1059 null,
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1060 null,
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1061 new DataItem[] { item });
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1062 }
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
1063
46
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1064
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1065 /**
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1066 * 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
1067 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1068 * @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
1069 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1070 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
1071 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
1072 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
1073 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
1074 "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
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
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 * 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
1080 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1081 * @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
1082 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1083 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
1084 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
1085 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
1086 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
1087 "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
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
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 * 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
1093 *
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1094 * @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
1095 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1096 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
1097 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
1098 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
1099 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
1100 "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
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
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 * Determines the current input mode.
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 * @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
1108 */
0d4795b4f284 Implemented the getData() method of the LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
1109 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
1110 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
1111
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1112 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
1113 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1114
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1115
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1116 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1117 * 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
1118 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1119 protected void enableLocationPanel() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1120 locationPanel = new DoubleArrayPanel(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1121 MESSAGES.unitLocation(),
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1122 getLocationValues(),
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1123 this);
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 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
1126 container.addMember(locationPanel);
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
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 /**
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1131 * 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
1132 */
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1133 protected void enableDistancePanel() {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1134 distancePanel = new DoubleRangePanel(
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1135 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
1136 getFrom(), getTo(), getStep(),
1491
2a00f4849738 Modified width of DoubleRangePanel in LocationDistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1401
diff changeset
1137 400,
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1138 this);
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 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
1141 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
1142 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1143
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1144
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1145 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1146 * 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
1147 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1148 * @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
1149 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1150 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
1151 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
1152
87a44f8e25cc Added a new widget 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 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
1154 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
1155 }
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1156 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
1157 enableLocationPanel();
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
1158 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
1159 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1160 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1161
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1162 // 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
1163 // 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
1164 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
1165 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
1166
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1167 // 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
1168 Tab t1 = new Tab (MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1169 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
1170 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
1171
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1172 // Bring this tab to front.
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1173 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
1174 }
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
1175 else {
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1176 enableDistancePanel();
1534
98123d34529b Added UI parts and event for filtering distances and locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1491
diff changeset
1177 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
1178 filterRange.clear();
1567
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1179 filterResultCount.setValue("");
7e738bc8ed75 Show hit count in filtered input helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1548
diff changeset
1180
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1181 // 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
1182 // 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
1183 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
1184 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
1185
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1186 //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
1187 Tab t1 = new Tab(MESSAGES.locations());
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1188 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
1189 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
1190
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1191 // Bring the distanceTable tab to front.
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1192 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
1193 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1194 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1195
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1196
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1197 /**
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1198 * 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
1199 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1200 * @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
1201 * 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
1202 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1203 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
1204 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
1205 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
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 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
1208 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
1209 }
87a44f8e25cc Added a new widget 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
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
1211 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
1212 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
1213
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
1214 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
1215 }
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
1216 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
1217 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
1218
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
1219 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
1220 }
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1221 }
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1222
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1223
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
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 /**
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1226 * 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
1227 *
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1228 * @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
1229 */
a3d235c63195 Save the data explicitly in 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 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
1231 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
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 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
1234 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
1235 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
1236 }
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
1237 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1238 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1239
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1240
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1241 /**
59
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1242 * 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
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 * @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
1245 */
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1246 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
1247 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
1248
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1249 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
1250 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
1251 }
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1252 }
a3d235c63195 Save the data explicitly in the LocationDistancePanel and WQInputPanel before returning the user input to avoid a nullpointer exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 58
diff changeset
1253
a3d235c63195 Save the data explicitly in 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 /**
a3d235c63195 Save the data explicitly in 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 * 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
1257 *
a3d235c63195 Save the data explicitly in 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 * @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
1259 * @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
1260 */
a3d235c63195 Save the data explicitly in 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 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
1262 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
1263 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
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
a3d235c63195 Save the data explicitly in 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 * 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
1270 *
a3d235c63195 Save the data explicitly in 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 * @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
1272 * @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
1273 */
a3d235c63195 Save the data explicitly in 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 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
1275 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
1276 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
1277 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
1278 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
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 }
a3d235c63195 Save the data explicitly in 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
a3d235c63195 Save the data explicitly in 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 /**
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
1284 * 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
1285 * 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
1286 *
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1287 * @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
1288 */
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1289 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
1290 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
1291
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1292 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
1293 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
1294 radio.setVertical(false);
1394
819ce433243c Issue 339.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1393
diff changeset
1295 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
1296
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
1297 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
1298 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
1299 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
1300
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 43
diff changeset
1301 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
1302 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
1303
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
1304 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
1305 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
1306
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
1307 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
1308 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
1309
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
1310 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
1311 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1312
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1313
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1314 protected void createDistanceInputPanel() {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1315 Config config = Config.getInstance();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1316 String url = config.getServerUrl();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1317 String locale = config.getLocale ();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1318 String river = "";
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1319
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1320 ArtifactDescription adescr = artifact.getArtifactDescription();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1321 DataList[] data = adescr.getOldData();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1322
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1323 if (data != null && data.length > 0) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1324 for (int i = 0; i < data.length; i++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1325 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
1326 if (dl.getState().endsWith("river")) {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1327 for (int j = 0; j < dl.size(); j++) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1328 Data d = dl.get(j);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1329 DataItem[] di = d.getItems();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1330 if (di != null && di.length == 1) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1331 river = d.getItems()[0].getStringValue();
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1332 }
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 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1335 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1336 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1337
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1338 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
1339 url, river, "distances"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1340 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
1341 url, river, "locations"));
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1342 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
1343 url, river, "locations"));
235
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
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1347 /* protected void updateDistanceInfo(DistanceInfoObject[] di) {
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1348 int i = 0;
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1349 for (DistanceInfoObject dio: di) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1350 if (dio.getTo() != null) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1351 distanceTable.addData(new DistanceInfoRecord(dio));
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1352 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1353 else {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1354 locationsTable.addData(new DistanceInfoRecord(dio));
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1355 locationDistanceTable.addData(new DistanceInfoRecord(dio));
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1356 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1357 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1358 return;
863
9bb8b7a751ec Added filter for the "description" row of helper input tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 838
diff changeset
1359 }*/
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1360
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1361
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
1362 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
1363 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
1364 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1365
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1366
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
1367 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
1368 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
1369 }
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
1370
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1371
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
1372 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
1373 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
1374 }
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
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
1377 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
1378 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
1379 }
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
1380
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
1381
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1382 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
1383 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
1384 }
6bcd8e3f21a7 Refactored the LocationDistancePanel, 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
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1386
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1387 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
1388 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
1389 }
6bcd8e3f21a7 Refactored the LocationDistancePanel, 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
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1391
6bcd8e3f21a7 Refactored the LocationDistancePanel, so that is uses the DoubleArrayPanel and DoubleRangePanel from the last commit as well.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 41
diff changeset
1392 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
1393 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
1394 }
6bcd8e3f21a7 Refactored the LocationDistancePanel, 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 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
1398 this.values = values;
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1399 locationPanel.setValues(values);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1400 }
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1401
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1402
516
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1403 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
1404 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
1405
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1406 if (vs == null) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1407 return;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1408 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1409
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1410 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
1411 int idx = 0;
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1412
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1413 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
1414 try {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1415 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
1416 }
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1417 catch (NumberFormatException nfe) {
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1418 // do nothing
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
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1422 setLocationValues(ds);
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
ba606e575663 ISSUE-85 (part II/III) Repaired broken location/range panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 284
diff changeset
1425
235
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1426 protected void setDistanceValues (double from, double to) {
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1427 setFrom(from);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1428 setTo(to);
d3f8d6966c20 Added location and distance tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
1429 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
1430 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1431 }
87a44f8e25cc Added a new widget that enables the user to enter a location or a distance in a single step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1432 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org