annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java @ 4553:fac54b8470d4

Map view in DigitizePanel now shows OSM background, river axis and manual drawn barriers again. Please note that this change requires changes in conf/floodmap.xml in artifact-server.
author Christian Lins <christian.lins@intevation.de>
date Fri, 16 Nov 2012 12:36:10 +0100
parents 099d136b215b
children 32a4651eef93
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.VisibilityChangedEvent;
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
16 import com.smartgwt.client.widgets.events.VisibilityChangedHandler;
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
17 import com.smartgwt.client.widgets.form.DynamicForm;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
18 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
19 import com.smartgwt.client.widgets.form.fields.UploadItem;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
20 import com.smartgwt.client.widgets.layout.VLayout;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
21 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
22 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
23
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
24 import de.intevation.flys.client.client.Config;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
25 import de.intevation.flys.client.client.services.MapInfoService;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
26 import de.intevation.flys.client.client.services.MapInfoServiceAsync;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
27 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
28 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
29 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
30 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
31 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
32 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
33 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
34 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
35
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
36 import java.util.LinkedHashMap;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
37 import java.util.List;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
38
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
39 import org.gwtopenmaps.openlayers.client.Map;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
40 import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
41 import org.gwtopenmaps.openlayers.client.format.GeoJSON;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
42 import org.gwtopenmaps.openlayers.client.layer.WMS;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
43 import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
44 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
45
dcecdd9693a8 Added a UIProvider 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
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
47 public class DigitizePanel
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
48 extends SelectProvider
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
49 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
50
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 4062
diff changeset
51 private static final long serialVersionUID = 3529775660871273314L;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 4062
diff changeset
52
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
53 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
54
dcecdd9693a8 Added a UIProvider 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 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
56
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
57 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
58
dcecdd9693a8 Added a UIProvider 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 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
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
dcecdd9693a8 Added a UIProvider 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 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
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
dcecdd9693a8 Added a UIProvider 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 @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
67 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
68 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
69
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
70 helperContainer.addVisibilityChangedHandler(this);
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
71
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
72 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
73 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
74 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
75 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
76 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
77 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
78 }
dcecdd9693a8 Added a UIProvider 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 }
dcecdd9693a8 Added a UIProvider 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
872
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
81 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
82 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
83 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
84
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
85 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
86
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 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
88 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
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 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
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 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
93 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
94 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
95 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
96 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
97 }
dcecdd9693a8 Added a UIProvider 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 }
dcecdd9693a8 Added a UIProvider 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
873
77a549772aa9 Query MapInfo object for correct river (was hard coded).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 872
diff changeset
100 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
101 mapInfo.getMapInfo(locale, river, new AsyncCallback<MapInfo>() {
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
102 @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
103 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
104 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
105
dcecdd9693a8 Added a UIProvider 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 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
107 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
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
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
110 @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
111 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
112 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
113 }
dcecdd9693a8 Added a UIProvider 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 });
dcecdd9693a8 Added a UIProvider 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 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
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
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
120 /**
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
121 * This method creates the content of the widget.
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 * @param data The {@link DataList} object.
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 * @return a combobox.
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
126 */
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
127 @Override
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
128 protected Canvas createWidget(DataList data) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
129 GWT.log("DigitizePanel - createWidget()");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
130
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
131 VLayout layout = new VLayout();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
132 layout.setAlign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
133 layout.setHeight(25);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
134
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 4062
diff changeset
135 LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>();
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
136
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
137 form = new DynamicForm();
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 int size = data.size();
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 for (int i = 0; i < size; i++) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
142 Data d = data.get(i);
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 Label label = new Label(d.getDescription());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
145 label.setValign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
146 label.setHeight(20);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
147 label.setWidth(400);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
148
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
149 SelectItem combobox = new SelectItem(d.getLabel());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
150 combobox.setWidth(250);
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 LinkedHashMap<String, String> it = new LinkedHashMap<String, String>();
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 boolean defaultSet = false;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
155 boolean first = true;
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 DataItem def = d.getDefault();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
158 String defValue = def != null ? def.getStringValue() : null;
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 if (defValue != null && defValue.length() > 0) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
161 initial.put(d.getLabel(), def.getStringValue());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
162 defaultSet = true;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
163 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
164
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
165 // I was here.
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
166 for (DataItem item: d.getItems()) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
167 if (!defaultSet && first) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
168 initial.put(d.getLabel(), item.getStringValue());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
169 first = false;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
170 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
171
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
172 it.put(item.getStringValue(), item.getLabel());
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
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
175 label.setWidth(50);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
176 combobox.setValueMap(it);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
177 combobox.setShowTitle(false);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
178 form.setItems(combobox);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
179
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
180 HTMLPane frame = new HTMLPane();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
181 frame.setWidth("1px");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
182 frame.setHeight("1px");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
183 frame.setContents("<iframe id='uploadTarget' name='uploadTarget'></iframe>");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
184
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
185 final DynamicForm uploadForm = new DynamicForm();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
186 uploadForm.setAction("flys/fileupload?uuid=" + artifact.getUuid());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
187 uploadForm.setTarget("uploadTarget");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
188 uploadForm.setEncoding(Encoding.MULTIPART);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
189 Label uploadLabel = new Label(MSG.shape_file_upload());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
190 uploadLabel.setHeight(20);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
191 UploadItem uploadItem = new UploadItem();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
192 uploadItem.setShowTitle(false);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
193 uploadForm.setFields(uploadItem);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
194 Button submit = new Button(MSG.upload_file());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
195 submit.addClickHandler(new ClickHandler() {
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
196 @Override
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
197 public void onClick(ClickEvent e) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
198 uploadForm.submitForm();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
199 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
200 });
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
201 layout.addMember(frame);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
202 layout.addMember(label);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
203 layout.addMember(form);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
204 layout.addMember(uploadLabel);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
205 layout.addMember(uploadForm);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
206 layout.addMember(submit);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
207 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
208
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
209 form.setValues(initial);
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 layout.setAlign(VerticalAlignment.TOP);
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 return layout;
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
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
216
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
217 @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
218 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
219 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
220 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
221
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
222 if (floodMap != null) {
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
223 DataItem item = new DefaultDataItem(
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
224 UESK_BARRIERS, UESK_BARRIERS, floodMap.getFeaturesAsGeoJSON());
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
225 total[0] = data[0];
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
226 total[1] = new DefaultData(
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
227 UESK_BARRIERS, null, null, new DataItem[] { item });
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
228 }
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
229 else {
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
230 // Happens when OpenLayers is missing
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
231 GWT.log("floodMap is null -> OpenLayers missing?");
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
232 }
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
233
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234 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
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
dcecdd9693a8 Added a UIProvider 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 public void createMapWidget(MapInfo mapInfo, String geojson) {
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
239 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
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 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
242 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
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 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
245
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
246 parameterList.registerCollectionViewTabHandler(this);
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
247
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
248 WMS axis = getLayer(
4553
fac54b8470d4 Map view in DigitizePanel now shows OSM background, river axis and
Christian Lins <christian.lins@intevation.de>
parents: 4476
diff changeset
249 mapInfo.getWmsUrl(), "FLYS-Map", // FIXME: Make layer name configurable
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
250 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
251 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
252 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
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
4553
fac54b8470d4 Map view in DigitizePanel now shows OSM background, river axis and
Christian Lins <christian.lins@intevation.de>
parents: 4476
diff changeset
255 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
256 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
257
dcecdd9693a8 Added a UIProvider 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 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
259 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
260 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
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
dcecdd9693a8 Added a UIProvider 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 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
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
dcecdd9693a8 Added a UIProvider 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 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
268 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
269 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
270 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
271 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
272
dcecdd9693a8 Added a UIProvider 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 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
274 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
275 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
276 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
277 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
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 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
280 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
281 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
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 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
284 }
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
285
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
286
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
287 @Override
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
288 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
289 if (tse.getTabNum () != 0) {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
290 floodMap.hideBarrierLayer();
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
291 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
292 else {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
293 floodMap.showBarrierLayer();
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 }
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
296
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
297 @Override
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
298 public void onVisibilityChanged(VisibilityChangedEvent vce) {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
299 if (!vce.getIsVisible()) {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
300 floodMap.hideBarrierLayer();
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
301 mapPanel.getMapToolbar().activateDrawFeature(false);
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
302 }
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
303 else {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
304 floodMap.showBarrierLayer();
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 }
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
307 }
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
308 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org