annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LocationDistancePanel.java @ 7941:48d8dba891f6

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

http://dive4elements.wald.intevation.org