Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java @ 783:8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
flys-client/trunk@2274 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 01 Jul 2011 09:11:39 +0000 |
parents | 4a7ece57f44c |
children | 3fa64c796ffc |
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); |
a39c2f531755
Implemented a new panel to enter kilometer ranges (with no option to insert locations).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 |
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 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
|
105 } |
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 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
|
109 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
|
110 |
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 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
|
112 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
|
113 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
|
114 |
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 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
|
116 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
|
117 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
|
118 |
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 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 |
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 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
|
128 } |
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 @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
|
132 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
|
133 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
|
134 |
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 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
|
136 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
|
137 |
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 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
|
139 } |
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 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
|
142 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
|
143 |
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 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
|
145 } |
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 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
|
149 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
|
150 |
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 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
|
152 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
|
153 |
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 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
|
155 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
|
156 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
|
157 |
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 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
|
159 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
|
160 } |
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 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
|
165 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
|
166 |
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 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
|
168 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
|
169 |
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 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
|
171 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
|
172 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
|
173 |
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 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
|
175 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
|
176 } |
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 @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
|
181 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
|
182 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
|
183 |
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 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
|
185 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
|
186 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
|
187 |
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 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
|
189 } |
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 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
|
193 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
|
194 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
|
195 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
|
196 "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
|
197 } |
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 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
|
201 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
|
202 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
|
203 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
|
204 "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
|
205 } |
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 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
|
209 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
|
210 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
|
211 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
|
212 "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
|
213 } |
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 @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
|
217 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
|
218 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
|
219 } |
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 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
|
223 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
|
224 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
|
225 |
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 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
|
227 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
|
228 |
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 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
|
230 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
|
231 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
|
232 } |
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 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
|
234 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
|
235 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
|
236 } |
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 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
|
241 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
|
242 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
|
243 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
|
244 } |
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 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
|
248 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
|
249 |
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 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
|
251 |
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 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
|
253 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
|
254 } |
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 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
|
256 // 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
|
257 } |
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 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
|
260 } |
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 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
|
264 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
|
265 |
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 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
|
267 |
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 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
|
269 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
|
270 } |
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 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
|
272 // 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
|
273 } |
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 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
|
276 } |
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 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
|
280 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
|
281 |
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 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
|
283 |
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 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
|
285 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
|
286 } |
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 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
|
288 // 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
|
289 } |
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 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
|
292 } |
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 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
|
296 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
|
297 { |
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 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
|
299 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
|
300 |
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 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
|
302 } |
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
|
303 |
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 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
|
306 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
|
307 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
|
308 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
|
309 |
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 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
|
311 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
|
312 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
|
313 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
|
314 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
|
315 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
|
316 |
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
|
317 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
|
318 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
|
319 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
|
320 |
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 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
|
322 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
|
323 |
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 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
|
325 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
|
326 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
|
327 } |
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 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
|
329 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
|
330 } |
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 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
|
335 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
|
336 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
|
337 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
|
338 |
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 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
|
340 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
|
341 |
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 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
|
343 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
|
344 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
|
345 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
|
346 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
|
347 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
|
348 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
|
349 } |
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 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
|
352 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
|
353 } |
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 |
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
|
357 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
|
358 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
|
359 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
|
360 |
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 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
|
362 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
|
363 |
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 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
|
365 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
|
366 |
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 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
|
368 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
|
369 |
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 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
|
371 } |
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
|
372 |
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 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
|
375 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
|
376 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
|
377 |
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 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
|
379 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
|
380 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
|
381 |
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 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
|
383 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
|
384 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
|
385 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
|
386 |
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 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
|
388 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
|
389 } |
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 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
|
396 } |
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
|
397 } |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |