Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java @ 4475:6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
This should fix parts of Flys/#802.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 12 Nov 2012 10:53:32 +0100 |
parents | c84630d544a1 |
children | 099d136b215b |
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 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
4064
61020a61ed38
Show river map only once.
Christian Lins <christian.lins@intevation.de>
parents:
3347
diff
changeset
|
4 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
5 import com.smartgwt.client.widgets.events.ResizedEvent; |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
6 import com.smartgwt.client.widgets.events.ResizedHandler; |
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
|
7 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
|
8 |
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.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
|
10 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
|
11 |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
12 import org.gwtopenmaps.openlayers.client.Bounds; |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
13 import org.gwtopenmaps.openlayers.client.MapWidget; |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
14 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
15 /** |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
16 * Panel that contains a MapWidget and a MapToolbar. |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
17 * This panel is used by the flood map calculation input helper. |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
18 */ |
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
|
19 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
|
20 |
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 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
|
22 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
23 protected FloodMap floodMap; |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
24 protected MapWidget floodMapWidget; |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
25 protected boolean 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
|
26 |
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 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
|
28 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
|
29 |
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 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 bbox.getUpperX(), |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4064
diff
changeset
|
37 bbox.getUpperY()), |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4064
diff
changeset
|
38 "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
|
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 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
|
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 |
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 |
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 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
|
45 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
|
46 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
|
47 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
48 floodMapWidget = floodMap.getMapWidget(); |
1386 | 49 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
|
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 addMember(toolbar); |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
52 addMember(floodMapWidget); |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
53 |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
54 addResizedHandler(new ResizedHandler() { |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
55 |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
56 @Override |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
57 public void onResized(ResizedEvent event) { |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
58 doLayout(); |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
59 } |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
60 }); |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
61 } |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
62 |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
63 |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
64 protected void doLayout() { |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
65 GWT.log("MapPanel.size: " + getWidth() + "x" + getHeight()); |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
66 |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
67 this.floodMapWidget.setWidth(getWidthAsString()); |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
68 this.floodMapWidget.setHeight(getHeightAsString()); |
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
|
69 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
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 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
|
73 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
|
74 } |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
75 |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
76 public MapToolbar getMapToolbar () { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
77 return toolbar; |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
78 } |
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
|
79 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |