Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java @ 4269:0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
The new ui classes are using the new extracted base class InfoPanel and InfoTree
which are in common with the gauge info.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 26 Oct 2012 12:22:06 +0200 |
parents | 360e22afb98b |
children | 099d136b215b |
rev | line source |
---|---|
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import com.google.gwt.user.client.rpc.AsyncCallback; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
6 import com.smartgwt.client.types.Encoding; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
7 import com.smartgwt.client.types.VerticalAlignment; |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import com.smartgwt.client.util.SC; |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
9 import com.smartgwt.client.widgets.Button; |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
10 import com.smartgwt.client.widgets.Canvas; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
11 import com.smartgwt.client.widgets.HTMLPane; |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
12 import com.smartgwt.client.widgets.Label; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
13 import com.smartgwt.client.widgets.events.ClickEvent; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
14 import com.smartgwt.client.widgets.events.ClickHandler; |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
15 import com.smartgwt.client.widgets.events.ResizedEvent; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
16 import com.smartgwt.client.widgets.events.ResizedHandler; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
17 import com.smartgwt.client.widgets.events.VisibilityChangedEvent; |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
18 import com.smartgwt.client.widgets.events.VisibilityChangedHandler; |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
19 import com.smartgwt.client.widgets.form.DynamicForm; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
20 import com.smartgwt.client.widgets.form.fields.SelectItem; |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
21 import com.smartgwt.client.widgets.form.fields.UploadItem; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
22 import com.smartgwt.client.widgets.layout.VLayout; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
23 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
24 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
26 import de.intevation.flys.client.client.Config; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
27 import de.intevation.flys.client.client.services.MapInfoService; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
28 import de.intevation.flys.client.client.services.MapInfoServiceAsync; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
29 import de.intevation.flys.client.client.ui.map.FloodMap; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
30 import de.intevation.flys.client.client.ui.map.MapPanel; |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.flys.client.shared.model.Data; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.flys.client.shared.model.DataItem; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 import de.intevation.flys.client.shared.model.DataList; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 import de.intevation.flys.client.shared.model.DefaultData; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 import de.intevation.flys.client.shared.model.DefaultDataItem; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 import de.intevation.flys.client.shared.model.MapInfo; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
38 import java.util.LinkedHashMap; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
39 import java.util.List; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
40 |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
41 import org.gwtopenmaps.openlayers.client.Map; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
42 import org.gwtopenmaps.openlayers.client.feature.VectorFeature; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
43 import org.gwtopenmaps.openlayers.client.format.GeoJSON; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
44 import org.gwtopenmaps.openlayers.client.layer.WMS; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
45 import org.gwtopenmaps.openlayers.client.layer.WMSOptions; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
46 import org.gwtopenmaps.openlayers.client.layer.WMSParams; |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
49 public class DigitizePanel |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
50 extends SelectProvider |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
51 implements TabSelectedHandler, VisibilityChangedHandler { |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4062
diff
changeset
|
53 private static final long serialVersionUID = 3529775660871273314L; |
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4062
diff
changeset
|
54 |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 protected MapInfoServiceAsync mapInfo = GWT.create(MapInfoService.class); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 protected FloodMap floodMap; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
59 protected MapPanel mapPanel; |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 public static final String UESK_BARRIERS = "uesk.barriers"; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 public DigitizePanel() { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 @Override |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 public Canvas create(DataList list) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 List<Data> data = list.getAll(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
72 helperContainer.addVisibilityChangedHandler(this); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
73 |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 Data barriers = null; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 for (int i = data.size()-1; i >= 0; i--) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 Data d = data.get(i); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 if (d.getLabel().equals(UESK_BARRIERS)) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 barriers = d; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 data.remove(d); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
872
a7179e3a774e
Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
83 DataList clone = (DataList) list.clone(); |
a7179e3a774e
Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
84 List<Data> all = clone.getAll(); |
a7179e3a774e
Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
85 all.remove(UESK_BARRIERS); |
a7179e3a774e
Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
86 |
a7179e3a774e
Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
87 Canvas selectBox = super.create(clone); |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 final Config cfg = Config.getInstance(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 final String locale = cfg.getLocale(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 DataItem[] obj = barriers.getItems(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 final String[] geojson = new String[1]; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 for (DataItem item: obj) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 if (item.getLabel().equals(UESK_BARRIERS)) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 geojson[0] = item.getStringValue(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 break; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
873
77a549772aa9
Query MapInfo object for correct river (was hard coded).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
872
diff
changeset
|
102 String river = getDataValue("state.winfo.river", "river"); |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1389
diff
changeset
|
103 mapInfo.getMapInfo(locale, river, new AsyncCallback<MapInfo>() { |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
104 @Override |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 public void onFailure(Throwable caught) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 String msg = caught.getMessage(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 GWT.log("Error while fetching MapInfo: " + msg); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 SC.warn(MSG.getString(msg)); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
112 @Override |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 public void onSuccess(MapInfo info) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 createMapWidget(info, geojson[0]); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 }); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 return selectBox; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
122 /** |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
123 * This method creates the content of the widget. |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
124 * |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
125 * @param data The {@link DataList} object. |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
126 * |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
127 * @return a combobox. |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
128 */ |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
129 @Override |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
130 protected Canvas createWidget(DataList data) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
131 GWT.log("DigitizePanel - createWidget()"); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
132 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
133 VLayout layout = new VLayout(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
134 layout.setAlign(VerticalAlignment.TOP); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
135 layout.setHeight(25); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
136 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4062
diff
changeset
|
137 LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
138 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
139 form = new DynamicForm(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
140 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
141 int size = data.size(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
142 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
143 for (int i = 0; i < size; i++) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
144 Data d = data.get(i); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
145 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
146 Label label = new Label(d.getDescription()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
147 label.setValign(VerticalAlignment.TOP); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
148 label.setHeight(20); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
149 label.setWidth(400); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
150 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
151 SelectItem combobox = new SelectItem(d.getLabel()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
152 combobox.setWidth(250); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
153 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
154 LinkedHashMap<String, String> it = new LinkedHashMap<String, String>(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
155 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
156 boolean defaultSet = false; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
157 boolean first = true; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
158 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
159 DataItem def = d.getDefault(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
160 String defValue = def != null ? def.getStringValue() : null; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
161 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
162 if (defValue != null && defValue.length() > 0) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
163 initial.put(d.getLabel(), def.getStringValue()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
164 defaultSet = true; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
165 } |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
166 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
167 // I was here. |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
168 for (DataItem item: d.getItems()) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
169 if (!defaultSet && first) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
170 initial.put(d.getLabel(), item.getStringValue()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
171 first = false; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
172 } |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
173 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
174 it.put(item.getStringValue(), item.getLabel()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
175 } |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
176 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
177 label.setWidth(50); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
178 combobox.setValueMap(it); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
179 combobox.setShowTitle(false); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
180 form.setItems(combobox); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
181 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
182 HTMLPane frame = new HTMLPane(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
183 frame.setWidth("1px"); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
184 frame.setHeight("1px"); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
185 frame.setContents("<iframe id='uploadTarget' name='uploadTarget'></iframe>"); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
186 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
187 final DynamicForm uploadForm = new DynamicForm(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
188 uploadForm.setAction("flys/fileupload?uuid=" + artifact.getUuid()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
189 uploadForm.setTarget("uploadTarget"); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
190 uploadForm.setEncoding(Encoding.MULTIPART); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
191 Label uploadLabel = new Label(MSG.shape_file_upload()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
192 uploadLabel.setHeight(20); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
193 UploadItem uploadItem = new UploadItem(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
194 uploadItem.setShowTitle(false); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
195 uploadForm.setFields(uploadItem); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
196 Button submit = new Button(MSG.upload_file()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
197 submit.addClickHandler(new ClickHandler() { |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
198 @Override |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
199 public void onClick(ClickEvent e) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
200 uploadForm.submitForm(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
201 } |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
202 }); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
203 layout.addMember(frame); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
204 layout.addMember(label); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
205 layout.addMember(form); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
206 layout.addMember(uploadLabel); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
207 layout.addMember(uploadForm); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
208 layout.addMember(submit); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
209 } |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
210 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
211 form.setValues(initial); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
212 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
213 layout.setAlign(VerticalAlignment.TOP); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
214 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
215 return layout; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
216 } |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
217 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
218 |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 @Override |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 protected Data[] getData() { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 Data[] data = super.getData(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 Data[] total = new Data[2]; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
224 if (floodMap != null) { |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
225 DataItem item = new DefaultDataItem( |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
226 UESK_BARRIERS, UESK_BARRIERS, floodMap.getFeaturesAsGeoJSON()); |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
227 total[0] = data[0]; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
228 total[1] = new DefaultData( |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
229 UESK_BARRIERS, null, null, new DataItem[] { item }); |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
230 } |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
231 else { |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
232 // Happens when OpenLayers is missing |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
233 GWT.log("floodMap is null -> OpenLayers missing?"); |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
234 } |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 return total; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 public void createMapWidget(MapInfo mapInfo, String geojson) { |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
241 mapPanel = new MapPanel(mapInfo, true); |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 floodMap = mapPanel.getFloodMap(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 Map map = floodMap.getMap(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 helperContainer.addMember(mapPanel); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 helperContainer.addResizedHandler(new ResizedHandler() { |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
248 @Override |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 public void onResized(ResizedEvent e) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 Integer height = helperContainer.getHeight(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 Integer width = helperContainer.getWidth(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 height = height * 99 / 100; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 width = width * 99 / 100; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 String w = String.valueOf(width) + "px"; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 String h = String.valueOf(height) + "px"; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 mapPanel.getFloodMap().setSize(w, h); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 }); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
263 parameterList.registerCollectionViewTabHandler(this); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
264 |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 WMS axis = getLayer( |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 mapInfo.getWmsUrl(), "riveraxis", |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 mapInfo.getProjection(), false); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 WMS back = getLayer( |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 mapInfo.getBackgroundWmsUrl(), mapInfo.getBackgroundWmsLayers(), |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 mapInfo.getProjection(), false); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 map.addLayer(axis); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 map.addLayer(back); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 if (geojson != null && geojson.length() > 0) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
276 VectorFeature[] features = new GeoJSON().read(geojson); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 floodMap.getBarrierLayer().addFeatures(features); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 map.zoomToMaxExtent(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 protected WMS getLayer(String url, String layers, String proj, boolean x) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 WMSParams params = new WMSParams(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 params.setLayers(layers); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 params.setFormat("image/png"); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 params.setIsTransparent(!x); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 WMSOptions opts = new WMSOptions(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 opts.setProjection(proj); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 opts.setSingleTile(true); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
293 opts.setRatio(1); |
1302
17e7d5e437fb
Bumped OpenLayers to version 2.11 and GWT-OpenLayers to version 0.6
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
294 opts.setBuffer(0); |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 WMS wms = new WMS(layers, url, params, opts); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 wms.setIsVisible(true); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
298 wms.setIsBaseLayer(x); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
299 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
300 return wms; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
301 } |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
302 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
303 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
304 @Override |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
305 public void onTabSelected(TabSelectedEvent tse) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
306 if (tse.getTabNum () != 0) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
307 floodMap.hideBarrierLayer(); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
308 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
309 else { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
310 floodMap.showBarrierLayer(); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
311 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
312 } |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
313 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
314 @Override |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
315 public void onVisibilityChanged(VisibilityChangedEvent vce) { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
316 if (!vce.getIsVisible()) { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
317 floodMap.hideBarrierLayer(); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
318 mapPanel.getMapToolbar().activateDrawFeature(false); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
319 } |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
320 else { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
321 floodMap.showBarrierLayer(); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
322 } |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
323 } |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
324 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
325 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |