Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java @ 784:3fa64c796ffc
Added the missing 'back'-button to the DistancePanel.
flys-client/trunk@2278 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 04 Jul 2011 07:15:44 +0000 |
parents | 8ebaad41285b |
children | 4e0b73b7113b |
rev | line source |
---|---|
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import com.google.gwt.core.client.GWT; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import com.google.gwt.i18n.client.NumberFormat; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
783
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
9 import com.smartgwt.client.data.Record; |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
10 import com.smartgwt.client.util.SC; |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import com.smartgwt.client.widgets.Canvas; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import com.smartgwt.client.widgets.Label; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; |
783
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
15 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
16 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.layout.HLayout; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import com.smartgwt.client.widgets.layout.VLayout; |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
19 import com.smartgwt.client.widgets.tab.TabSet; |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
20 import com.smartgwt.client.widgets.tab.Tab; |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
22 import de.intevation.flys.client.shared.model.ArtifactDescription; |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.client.shared.model.Data; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.shared.model.DataItem; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.shared.model.DataList; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.client.shared.model.DefaultData; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.client.shared.model.DefaultDataItem; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
29 import de.intevation.flys.client.client.Config; |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.client.client.FLYSConstants; |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
31 import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
32 import de.intevation.flys.client.client.ui.range.RangeTable; |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
33 import de.intevation.flys.client.client.ui.range.LocationsTable; |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public class DistancePanel extends AbstractUIProvider implements BlurHandler { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public static final int DEFAULT_STEP_WIDTH = 100; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
43 protected RangeTable distancesTable; |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
44 protected LocationsTable locationsTable; |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
45 |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 protected DoubleRangePanel distancePanel; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
48 protected TabSet tabs; |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
49 |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 protected double min; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 protected double max; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 public DistancePanel() { |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
55 distancesTable = new RangeTable(); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
56 locationsTable = new LocationsTable(); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
57 distancePanel = new DoubleRangePanel( |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 MSG.unitFrom(), MSG.unitTo(), MSG.unitWidth(), |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 0d, 0d, 0d, 250, this); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 @Override |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 public Canvas create(DataList data) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 VLayout layout = new VLayout(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 layout.setMembersMargin(10); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 Label label = new Label(MSG.distance_state()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 Canvas submit = getNextButton(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 label.setHeight(25); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 distancePanel.setHeight(50); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 layout.addMember(label); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 layout.addMember(distancePanel); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 layout.addMember(submit); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 initMinMaxValues(data); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 initDefaultValues(data); |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
81 initHelperPanel(); |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 return layout; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 @Override |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 public Canvas createOld(DataList dataList) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 String s = getOldSelectionString(dataList); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 String l = dataList.getLabel(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 Label label = new Label(l); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 Label selected = new Label(s); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 HLayout layout = new HLayout(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 layout.setWidth(400); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 label.setWidth(200); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 selected.setWidth(130); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 layout.addMember(label); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 layout.addMember(selected); |
784
3fa64c796ffc
Added the missing 'back'-button to the DistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
783
diff
changeset
|
103 layout.addMember(getBackButton(dataList.getState())); |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 return layout; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 protected String getOldSelectionString(DataList dataList) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 List<Data> items = dataList.getAll(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 Data dFrom = getData(items, "ld_from"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 Data dTo = getData(items, "ld_to"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 Data dStep = getData(items, "ld_step"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 DataItem[] from = dFrom.getItems(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 DataItem[] to = dTo.getItems(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 DataItem[] step = dStep.getItems(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 StringBuilder sb = new StringBuilder(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 sb.append(from[0].getLabel()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 sb.append(" " + MSG.unitFrom() + " "); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 sb.append(to[0].getLabel()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 sb.append(" " + MSG.unitTo() + " "); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 sb.append(step[0].getLabel()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 sb.append(" " + MSG.unitWidth()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 return sb.toString(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 @Override |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 public List<String> validate() { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 List<String> errors = new ArrayList<String>(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 if (!distancePanel.validateForm()) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 errors.add(MSG.wrongFormat()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 return errors; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 validateFrom(errors); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 validateTo(errors); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 return errors; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 protected void validateFrom(List<String> errors) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 double from = distancePanel.getFrom(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 if (from < min || from > max) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 NumberFormat nf = NumberFormat.getDecimalFormat(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 String tmp = MSG.error_validate_lower_range(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 tmp = tmp.replace("$1", nf.format(from)); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 tmp = tmp.replace("$2", nf.format(min)); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 distancePanel.setFrom(min); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 errors.add(tmp); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 protected void validateTo(List<String> errors) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 double to = distancePanel.getTo(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 if (to < min || to > max) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 NumberFormat nf = NumberFormat.getDecimalFormat(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 String tmp = MSG.error_validate_upper_range(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 tmp = tmp.replace("$1", nf.format(to)); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 tmp = tmp.replace("$2", nf.format(max)); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 distancePanel.setTo(max); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 errors.add(tmp); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 @Override |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 public Data[] getData() { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 Data[] data = new Data[3]; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 data[0] = getDataFrom(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 data[1] = getDataTo(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 data[2] = getDataStep(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 return data; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 protected Data getDataFrom() { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 String value = String.valueOf(distancePanel.getFrom()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 DataItem item = new DefaultDataItem("ld_from", "ld_from", value); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 return new DefaultData( |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 "ld_from", null, null, new DataItem[] { item }); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 protected Data getDataTo() { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 String value = String.valueOf(distancePanel.getTo()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 DataItem item = new DefaultDataItem("ld_to", "ld_to", value); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 return new DefaultData( |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 "ld_to", null, null, new DataItem[] { item }); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 protected Data getDataStep() { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 String value = String.valueOf(distancePanel.getStep()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 DataItem item = new DefaultDataItem("ld_step","ld_step", value); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 return new DefaultData( |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 "ld_step", null, null, new DataItem[] { item }); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 @Override |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 public void onBlur(BlurEvent event) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 distancePanel.validateForm(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 protected void initMinMaxValues(DataList data) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 Data f = getData(data.getAll(), "ld_from"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 Data t = getData(data.getAll(), "ld_to"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 DataItem[] fItems = f.getItems(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 DataItem[] tItems = t.getItems(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 try { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 min = Double.valueOf(fItems[0].getStringValue()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 max = Double.valueOf(tItems[0].getStringValue()); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 catch (NumberFormatException nfe) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 min = -Double.MAX_VALUE; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 max = Double.MAX_VALUE; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 protected void initDefaultValues(DataList data) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 initDefaultFrom(data); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 initDefaultTo(data); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 initDefaultStep(data); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 protected void initDefaultFrom(DataList data) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 Data f = getData(data.getAll(), "ld_from"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 double from = min; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 try { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 from = getDefaultValue(f); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 catch (NumberFormatException nfe) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 // do nothing |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 distancePanel.setFrom(from); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 protected void initDefaultTo(DataList data) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 Data t = getData(data.getAll(), "ld_to"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 double to = max; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 try { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 to = getDefaultValue(t); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 catch (NumberFormatException nfe) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 // do nothing |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
276 distancePanel.setTo(to); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 protected void initDefaultStep(DataList data) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 Data s = getData(data.getAll(), "ld_step"); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 double step = (double) DEFAULT_STEP_WIDTH; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 try { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 step = getDefaultValue(s); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 catch (NumberFormatException nfe) { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 // do nothing |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 distancePanel.setStep(step); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
293 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
294 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 protected double getDefaultValue(Data data) |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 throws NumberFormatException |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
298 { |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
299 DataItem def = data.getDefault(); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
300 String defValue = def != null ? def.getStringValue() : null; |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
301 |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
302 return Double.valueOf(defValue); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
303 } |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
304 |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
305 |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
306 protected void initHelperPanel() { |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
307 Config config = Config.getInstance(); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
308 String url = config.getServerUrl(); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
309 String river = getRiverName(); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
310 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
311 distancesTable.setAutoFetchData(true); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
312 locationsTable.setAutoFetchData(true); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
313 distancesTable.setDataSource(new DistanceInfoDataSource( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
314 url, river, "distances")); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
315 locationsTable.setDataSource(new DistanceInfoDataSource( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
316 url, river, "locations")); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
317 |
783
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
318 distancesTable.addRecordClickHandler(new RecordClickHandler() { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
319 public void onRecordClick(RecordClickEvent e) { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
320 Record r = e.getRecord(); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
321 |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
322 String from = r.getAttribute("from"); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
323 String to = r.getAttribute("to"); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
324 |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
325 try { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
326 distancePanel.setFrom(Double.valueOf(from)); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
327 distancePanel.setTo(Double.valueOf(to)); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
328 } |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
329 catch (NumberFormatException nfe) { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
330 SC.warn(MSG.wrongFormat()); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
331 } |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
332 } |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
333 }); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
334 |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
335 locationsTable.addRecordClickHandler(new RecordClickHandler() { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
336 public void onRecordClick(RecordClickEvent e) { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
337 Record r = e.getRecord(); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
338 int field = e.getFieldNum(); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
339 |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
340 try { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
341 String value = r.getAttribute("from"); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
342 |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
343 switch (field) { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
344 case 0: |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
345 distancePanel.setFrom(Double.valueOf(value)); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
346 break; |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
347 case 1: |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
348 distancePanel.setTo(Double.valueOf(value)); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
349 break; |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
350 } |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
351 } |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
352 catch (NumberFormatException nfe) { |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
353 SC.warn(MSG.wrongFormat()); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
354 } |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
355 } |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
356 }); |
8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
782
diff
changeset
|
357 |
781
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
358 tabs = new TabSet(); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
359 tabs.setWidth100(); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
360 tabs.setHeight100(); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
361 |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
362 Tab locations = new Tab(MSG.locations()); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
363 Tab distances = new Tab(MSG.distance()); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
364 |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
365 locations.setPane(locationsTable); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
366 distances.setPane(distancesTable); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
367 |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
368 tabs.addTab(locations, 0); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
369 tabs.addTab(distances, 1); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
370 |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
371 helperContainer.addChild(tabs); |
6653cf54b45d
The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
372 } |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
373 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
374 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
375 protected String getRiverName() { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
376 ArtifactDescription adescr = artifact.getArtifactDescription(); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
377 DataList[] data = adescr.getOldData(); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
378 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
379 if (data != null && data.length > 0) { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
380 for (int i = 0; i < data.length; i++) { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
381 DataList dl = data[i]; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
382 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
383 if (dl.getState().equals("state.winfo.river")) { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
384 for (int j = 0; j < dl.size(); j++) { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
385 Data d = dl.get(j); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
386 DataItem[] di = d.getItems(); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
387 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
388 if (di != null && di.length == 1) { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
389 return d.getItems()[0].getStringValue(); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
390 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
391 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
392 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
393 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
394 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
395 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
396 return null; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
781
diff
changeset
|
397 } |
780
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
398 } |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
399 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |