Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java @ 4402:c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
The OpenLayers Map widget is now resized and positioned manually by a
ResizeHandler method. The automatic HorizontalLayout was obviously
broken in combination with the OpenLayers widget.
This should fix various layout issues with the OpenLayers Map.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 05 Nov 2012 15:17:58 +0100 |
parents | 61020a61ed38 |
children | 6fb4e29a2a9b |
rev | line source |
---|---|
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui.map; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.user.client.ui.HorizontalPanel; |
4064
61020a61ed38
Show river map only once.
Christian Lins <christian.lins@intevation.de>
parents:
3347
diff
changeset
|
4 |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.smartgwt.client.widgets.Canvas; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import com.smartgwt.client.widgets.layout.VLayout; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.client.shared.model.BBox; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.client.shared.model.MapInfo; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
11 import org.gwtopenmaps.openlayers.client.Bounds; |
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
12 |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 public class MapPanel extends VLayout { |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 protected MapToolbar toolbar; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 protected HorizontalPanel mapArea; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 protected FloodMap floodMap; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 protected boolean digitizeEnabled; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 public MapPanel(MapInfo mapInfo, boolean digitizeEnabled) { |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 super(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 BBox bbox = mapInfo.getBBox(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 this.digitizeEnabled = digitizeEnabled; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 this.floodMap = new FloodMap( |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 String.valueOf(mapInfo.getSrid()), |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 new Bounds( |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 bbox.getLowerX(), |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 bbox.getLowerY(), |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 bbox.getUpperX(), |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4064
diff
changeset
|
35 bbox.getUpperY()), |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4064
diff
changeset
|
36 "100%", "100%"); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 initLayout(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 private void initLayout() { |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 setWidth100(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 setHeight100(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 mapArea = new HorizontalPanel(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 mapArea.setWidth("99%"); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 mapArea.setHeight("99%"); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 mapArea.add(floodMap.getMapWidget()); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 Canvas wrapper = new Canvas(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 wrapper.setWidth100(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 wrapper.setHeight100(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 wrapper.addChild(mapArea); |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4064
diff
changeset
|
55 wrapper.setRedrawOnResize(true); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
1386 | 57 toolbar = new MapToolbar(floodMap, digitizeEnabled); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 addMember(toolbar); |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
60 addMember(wrapper); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 public FloodMap getFloodMap() { |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 return floodMap; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 } |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
67 |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
68 public MapToolbar getMapToolbar () { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
69 return toolbar; |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
70 } |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |