Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java @ 4983:8679d16fe11a
WQInputPanel: Whitespace cosmetics.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 14 Feb 2013 09:34:02 +0100 |
parents | 6aa1b8abe2d3 |
children | 04ccec566689 |
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; |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
5 import com.smartgwt.client.types.Encoding; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
6 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
|
7 import com.smartgwt.client.util.SC; |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
8 import com.smartgwt.client.widgets.Button; |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
9 import com.smartgwt.client.widgets.Canvas; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
10 import com.smartgwt.client.widgets.HTMLPane; |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
11 import com.smartgwt.client.widgets.Label; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
12 import com.smartgwt.client.widgets.events.ClickEvent; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
13 import com.smartgwt.client.widgets.events.ClickHandler; |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
14 import com.smartgwt.client.widgets.events.VisibilityChangedEvent; |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
15 import com.smartgwt.client.widgets.events.VisibilityChangedHandler; |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
16 import com.smartgwt.client.widgets.form.DynamicForm; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
17 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
|
18 import com.smartgwt.client.widgets.form.fields.UploadItem; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
19 import com.smartgwt.client.widgets.layout.VLayout; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
20 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
21 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
|
22 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
23 import de.intevation.flys.client.client.Config; |
4801
6aa1b8abe2d3
MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents:
4632
diff
changeset
|
24 import de.intevation.flys.client.client.FLYS; |
6aa1b8abe2d3
MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents:
4632
diff
changeset
|
25 import de.intevation.flys.client.client.FLYSConstants; |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
26 import de.intevation.flys.client.client.services.MapInfoService; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
27 import de.intevation.flys.client.client.services.MapInfoServiceAsync; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
37 import java.util.LinkedHashMap; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
38 import java.util.List; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
39 |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
40 import org.gwtopenmaps.openlayers.client.Map; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
41 import org.gwtopenmaps.openlayers.client.feature.VectorFeature; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
42 import org.gwtopenmaps.openlayers.client.format.GeoJSON; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
43 import org.gwtopenmaps.openlayers.client.layer.WMS; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
44 import org.gwtopenmaps.openlayers.client.layer.WMSOptions; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
45 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
|
46 |
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 |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
48 public class DigitizePanel |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
49 extends SelectProvider |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
50 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
|
51 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4062
diff
changeset
|
52 private static final long serialVersionUID = 3529775660871273314L; |
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4062
diff
changeset
|
53 |
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
|
54 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
|
55 |
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 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
|
57 |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
58 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
|
59 |
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 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
|
61 |
4801
6aa1b8abe2d3
MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents:
4632
diff
changeset
|
62 /** The message class that provides i18n strings. */ |
6aa1b8abe2d3
MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents:
4632
diff
changeset
|
63 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
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
|
64 |
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 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
|
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 |
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 @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
|
70 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
|
71 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
|
72 |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
73 helperContainer.addVisibilityChangedHandler(this); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
74 |
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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
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 } |
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
|
83 |
872
a7179e3a774e
Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 |
a7179e3a774e
Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
88 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
|
89 |
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 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
|
91 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
|
92 |
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 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
|
94 |
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 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
|
96 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
|
97 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
|
98 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
|
99 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
|
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 } |
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
|
102 |
873
77a549772aa9
Query MapInfo object for correct river (was hard coded).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
872
diff
changeset
|
103 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
|
104 mapInfo.getMapInfo(locale, river, new AsyncCallback<MapInfo>() { |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
105 @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
|
106 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
|
107 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
|
108 |
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 GWT.log("Error while fetching MapInfo: " + msg); |
4801
6aa1b8abe2d3
MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents:
4632
diff
changeset
|
110 SC.warn(FLYS.getExceptionString(MSG, caught)); |
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
|
111 } |
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
|
112 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
113 @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
|
114 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
|
115 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
|
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 |
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 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
|
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 |
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
|
122 |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
123 /** |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
124 * This method creates the content of the widget. |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
125 * |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
126 * @param data The {@link DataList} object. |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
127 * |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
128 * @return a combobox. |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
129 */ |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
130 @Override |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
131 protected Canvas createWidget(DataList data) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
132 GWT.log("DigitizePanel - createWidget()"); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
133 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
134 VLayout layout = new VLayout(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
135 layout.setAlign(VerticalAlignment.TOP); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
136 layout.setHeight(25); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
137 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4062
diff
changeset
|
138 LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); |
2494
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
139 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
140 form = new DynamicForm(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
141 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
142 int size = data.size(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
143 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
144 for (int i = 0; i < size; i++) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
145 Data d = data.get(i); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
146 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
147 Label label = new Label(d.getDescription()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
148 label.setValign(VerticalAlignment.TOP); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
149 label.setHeight(20); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
150 label.setWidth(400); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
151 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
152 SelectItem combobox = new SelectItem(d.getLabel()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
153 combobox.setWidth(250); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
154 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
155 LinkedHashMap<String, String> it = new LinkedHashMap<String, String>(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
156 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
157 boolean defaultSet = false; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
158 boolean first = true; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
159 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
160 DataItem def = d.getDefault(); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
161 String defValue = def != null ? def.getStringValue() : null; |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
162 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
163 if (defValue != null && defValue.length() > 0) { |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
164 initial.put(d.getLabel(), def.getStringValue()); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
165 defaultSet = true; |
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 |
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); |
4574
32a4651eef93
flys-client: Shapefile upload widget readded again (regression).
Christian Lins <christian.lins@intevation.de>
parents:
4553
diff
changeset
|
209 layout.addMember(getNextButton()); |
2494
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 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
212 form.setValues(initial); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
213 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
214 layout.setAlign(VerticalAlignment.TOP); |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
215 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
216 return layout; |
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 |
88b51e6e0334
Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1425
diff
changeset
|
219 |
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
|
220 @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
|
221 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
|
222 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
|
223 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
|
224 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
225 if (floodMap != null) { |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
226 DataItem item = new DefaultDataItem( |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
227 UESK_BARRIERS, UESK_BARRIERS, floodMap.getFeaturesAsGeoJSON()); |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
228 total[0] = data[0]; |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
229 total[1] = new DefaultData( |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
230 UESK_BARRIERS, null, null, new DataItem[] { item }); |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
231 } |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
232 else { |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
233 // Happens when OpenLayers is missing |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
234 GWT.log("floodMap is null -> OpenLayers missing?"); |
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
235 } |
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
|
236 |
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 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
|
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 |
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
|
241 public void createMapWidget(MapInfo mapInfo, String geojson) { |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
242 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
|
243 |
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 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
|
245 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
|
246 |
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.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
|
248 |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
249 parameterList.registerCollectionViewTabHandler(this); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
250 |
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
|
251 WMS axis = getLayer( |
4632
02cf2b1dff84
Make floodmap riveraxis layer name configurable.
Christian Lins <christian.lins@intevation.de>
parents:
4574
diff
changeset
|
252 mapInfo.getWmsUrl(), mapInfo.getWmsLayers(), |
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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 |
4553
fac54b8470d4
Map view in DigitizePanel now shows OSM background, river axis and
Christian Lins <christian.lins@intevation.de>
parents:
4476
diff
changeset
|
258 map.addLayer(back); |
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
|
259 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
|
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 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
|
262 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
|
263 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
|
264 } |
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 |
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 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
|
267 } |
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 |
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 |
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 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
|
271 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
|
272 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
|
273 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
|
274 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
|
275 |
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 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
|
277 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
|
278 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
|
279 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
|
280 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
|
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 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
|
283 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
|
284 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
|
285 |
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 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
|
287 } |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
288 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
289 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
290 @Override |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
291 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
|
292 if (tse.getTabNum () != 0) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
293 floodMap.hideBarrierLayer(); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
294 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
295 else { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
296 floodMap.showBarrierLayer(); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
297 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
873
diff
changeset
|
298 } |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
299 |
4062
145980c21700
Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents:
2494
diff
changeset
|
300 @Override |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
301 public void onVisibilityChanged(VisibilityChangedEvent vce) { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
302 if (!vce.getIsVisible()) { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
303 floodMap.hideBarrierLayer(); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
304 mapPanel.getMapToolbar().activateDrawFeature(false); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
305 } |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
306 else { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
307 floodMap.showBarrierLayer(); |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
308 } |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1322
diff
changeset
|
309 } |
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
|
310 } |
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
|
311 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |