annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java @ 2494:88b51e6e0334

Issue 657. Added UI and service for shapefile upload. flys-client/trunk@4294 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 25 Apr 2012 07:58:58 +0000
parents bc06a671ef60
children 145980c21700
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 java.util.List;
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
4 import java.util.LinkedHashMap;
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
5
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 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
7 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
8
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.util.SC;
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.widgets.Canvas;
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
11 import com.smartgwt.client.widgets.Button;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
12 import com.smartgwt.client.widgets.Label;
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
13 import com.smartgwt.client.widgets.events.ResizedEvent;
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import com.smartgwt.client.widgets.events.ResizedHandler;
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
15 import com.smartgwt.client.widgets.events.ClickEvent;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
16 import com.smartgwt.client.widgets.events.ClickHandler;
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
17 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
18 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
19 import com.smartgwt.client.widgets.events.VisibilityChangedHandler;
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
20 import com.smartgwt.client.widgets.events.VisibilityChangedEvent;
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
21 import com.smartgwt.client.widgets.layout.VLayout;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
22 import com.smartgwt.client.widgets.form.DynamicForm;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
23 import com.smartgwt.client.widgets.form.fields.UploadItem;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
24 import com.smartgwt.client.widgets.form.fields.SelectItem;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
25 import com.smartgwt.client.types.VerticalAlignment;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
26 import com.smartgwt.client.widgets.HTMLPane;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
27 import com.smartgwt.client.types.Encoding;
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
28
dcecdd9693a8 Added a UIProvider 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 org.gwtopenmaps.openlayers.client.Map;
dcecdd9693a8 Added a UIProvider 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 org.gwtopenmaps.openlayers.client.feature.VectorFeature;
dcecdd9693a8 Added a UIProvider 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 org.gwtopenmaps.openlayers.client.format.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
32 import org.gwtopenmaps.openlayers.client.layer.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
33 import org.gwtopenmaps.openlayers.client.layer.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
34 import org.gwtopenmaps.openlayers.client.layer.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
35
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 import de.intevation.flys.client.shared.model.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
37 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
38 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
39 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
40 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
41 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
42
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 import de.intevation.flys.client.client.Config;
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 import de.intevation.flys.client.client.ui.map.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
45 import de.intevation.flys.client.client.ui.map.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
46 import de.intevation.flys.client.client.services.MapInfoService;
dcecdd9693a8 Added a UIProvider 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 import de.intevation.flys.client.client.services.MapInfoServiceAsync;
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
50 public class DigitizePanel
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
51 extends SelectProvider
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
52 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
53
dcecdd9693a8 Added a UIProvider 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
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 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
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
dcecdd9693a8 Added a UIProvider 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 @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
68 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
69 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
70
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
71 helperContainer.addVisibilityChangedHandler(this);
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
72
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
73 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
74 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
75 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
76 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
77 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
78 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
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 }
dcecdd9693a8 Added a UIProvider 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
872
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
82 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
83 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
84 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
85
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
86 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
87
dcecdd9693a8 Added a UIProvider 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 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
89 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
90
dcecdd9693a8 Added a UIProvider 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 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
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 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
94 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
95 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
96 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
97 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
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 }
dcecdd9693a8 Added a UIProvider 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
873
77a549772aa9 Query MapInfo object for correct river (was hard coded).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 872
diff changeset
101 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
102 mapInfo.getMapInfo(locale, river, new AsyncCallback<MapInfo>() {
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
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 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
111 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
112 }
dcecdd9693a8 Added a UIProvider 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 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
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
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
119 /**
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
120 * This method creates the content of the widget.
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
121 *
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
122 * @param data The {@link DataList} object.
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 * @return a combobox.
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 protected Canvas createWidget(DataList data) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
127 GWT.log("DigitizePanel - createWidget()");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
128
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
129 VLayout layout = new VLayout();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
130 layout.setAlign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
131 layout.setHeight(25);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
132
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
133 LinkedHashMap initial = new LinkedHashMap();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
134
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
135 form = new DynamicForm();
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 int size = data.size();
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 for (int i = 0; i < size; i++) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
140 Data d = data.get(i);
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 Label label = new Label(d.getDescription());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
143 label.setValign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
144 label.setHeight(20);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
145 label.setWidth(400);
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 SelectItem combobox = new SelectItem(d.getLabel());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
148 combobox.setWidth(250);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
149
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
150 LinkedHashMap<String, String> it = new LinkedHashMap<String, String>();
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 boolean defaultSet = false;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
153 boolean first = true;
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 DataItem def = d.getDefault();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
156 String defValue = def != null ? def.getStringValue() : null;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
157
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
158 if (defValue != null && defValue.length() > 0) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
159 initial.put(d.getLabel(), def.getStringValue());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
160 defaultSet = true;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
161 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
162
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
163 // I was here.
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
164 for (DataItem item: d.getItems()) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
165 if (!defaultSet && first) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
166 initial.put(d.getLabel(), item.getStringValue());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
167 first = false;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
168 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
169
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
170 it.put(item.getStringValue(), item.getLabel());
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
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
173 label.setWidth(50);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
174 combobox.setValueMap(it);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
175 combobox.setShowTitle(false);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
176 form.setItems(combobox);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
177
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
178 HTMLPane frame = new HTMLPane();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
179 frame.setWidth("1px");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
180 frame.setHeight("1px");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
181 frame.setContents("<iframe id='uploadTarget' name='uploadTarget'></iframe>");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
182
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
183 final DynamicForm uploadForm = new DynamicForm();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
184 uploadForm.setAction("flys/fileupload?uuid=" + artifact.getUuid());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
185 uploadForm.setTarget("uploadTarget");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
186 uploadForm.setEncoding(Encoding.MULTIPART);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
187 Label uploadLabel = new Label(MSG.shape_file_upload());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
188 uploadLabel.setHeight(20);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
189 UploadItem uploadItem = new UploadItem();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
190 uploadItem.setShowTitle(false);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
191 uploadForm.setFields(uploadItem);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
192 Button submit = new Button(MSG.upload_file());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
193 submit.addClickHandler(new ClickHandler() {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
194 public void onClick(ClickEvent e) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
195 uploadForm.submitForm();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
196 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
197 });
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
198 layout.addMember(frame);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
199 layout.addMember(label);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
200 layout.addMember(form);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
201 layout.addMember(uploadLabel);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
202 layout.addMember(uploadForm);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
203 layout.addMember(submit);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
204 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
205
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
206 form.setValues(initial);
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 layout.setAlign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
209
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
210 return layout;
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
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
213
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
214 @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
215 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
216 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
217 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
218
dcecdd9693a8 Added a UIProvider 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 DataItem item = new 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
220 UESK_BARRIERS, UESK_BARRIERS, floodMap.getFeaturesAsGeoJSON());
dcecdd9693a8 Added a UIProvider 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
dcecdd9693a8 Added a UIProvider 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 total[0] = data[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
223 total[1] = new 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
224 UESK_BARRIERS, null, null, new DataItem[] { item });
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226 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
227 }
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230 public void createMapWidget(MapInfo mapInfo, String geojson) {
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
231 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
232
dcecdd9693a8 Added a UIProvider 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 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
234 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
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 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
237 helperContainer.addResizedHandler(new ResizedHandler() {
dcecdd9693a8 Added a UIProvider 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 onResized(ResizedEvent e) {
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 Integer height = helperContainer.getHeight();
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 Integer width = helperContainer.getWidth();
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241
dcecdd9693a8 Added a UIProvider 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 height = height * 99 / 100;
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 width = width * 99 / 100;
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244
dcecdd9693a8 Added a UIProvider 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 String w = String.valueOf(width) + "px";
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246 String h = String.valueOf(height) + "px";
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247
dcecdd9693a8 Added a UIProvider 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 mapPanel.getFloodMap().setSize(w, h);
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 }
dcecdd9693a8 Added a UIProvider 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 });
dcecdd9693a8 Added a UIProvider 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
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
252 parameterList.registerCollectionViewTabHandler(this);
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
253
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
254 WMS axis = getLayer(
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 mapInfo.getWmsUrl(), "riveraxis",
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
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 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
258 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
259 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
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 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
262 map.addLayer(back);
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263
dcecdd9693a8 Added a UIProvider 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 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
265 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
266 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
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 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
270 }
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272
dcecdd9693a8 Added a UIProvider 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 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
274 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
275 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
276 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
277 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
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 WMSOptions opts = new WMSOptions();
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.setTransitionEffect("null");
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 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
282 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
283 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
284 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
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 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
287 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
288 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
289
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290 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
291 }
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
292
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
293
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
294 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
295 if (tse.getTabNum () != 0) {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
296 floodMap.hideBarrierLayer();
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 else {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
299 floodMap.showBarrierLayer();
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
300 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
301 }
1389
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 public void onVisibilityChanged(VisibilityChangedEvent vce) {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
304 if (!vce.getIsVisible()) {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
305 floodMap.hideBarrierLayer();
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
306 mapPanel.getMapToolbar().activateDrawFeature(false);
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
307 }
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
308 else {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
309 floodMap.showBarrierLayer();
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
310 }
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
311 }
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
312 }
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org