I use Gwt 2.6.1 (with Activities and Places framework) and gwt-openlayers 1.0
The problem comes when i use a google layer (Google or GoogleV3 instance) as base layer. The map appears but i can't zoom or drag and the openlayers controls are missing from the display (zoom buttons, layer switcher, scale line). After hitting F5 (refresh), the problems are gone and everything works fine. With Bing baselayer these problems aren't occurred.
The situation is complex but it can be reproduced: You need 3 pages.
You can see the welcome page, when you open your application in the browser. Then type the token of the second page after the url (#secondPage). After the second page is displayed, type the token of the third page after the base url (#mapPage). If you follow this scenario, the mentioned problems will come.
The ui.xml of the third page:
<gxt:ContentPanel headerVisible="false" borders="false" bodyBorder="false" height="500px" width="500px"/>
The View of the third page:
...
@Override
public Widget asWidget() {
this.widget = TestView.uiBinder.createAndBindUi(this);
((ContentPanel) TestView.this.widget).add(TestGoogle.getMap());
return this.widget;
}
...
TestGoogle class:
public class TestGoogle {
public static MapWidget getMap() {
MapOptions defaultMapOptions = new MapOptions();
defaultMapOptions.setNumZoomLevels(16);
MapWidget mapWidget = new MapWidget("100%", "100%", defaultMapOptions);
GoogleV3Options gHybridOptions = new GoogleV3Options();
gHybridOptions.setIsBaseLayer(true);
gHybridOptions.setType(GoogleV3MapType.G_NORMAL_MAP);
GoogleV3 gHybrid = new GoogleV3("Google Hybrid", gHybridOptions);
Map map = mapWidget.getMap();
map.addLayer(gHybrid);
map.addControl(new LayerSwitcher());
map.addControl(new OverviewMap());
map.addControl(new ScaleLine());
LonLat lonLat = new LonLat(6.95, 50.94);
lonLat.transform(ProjectionCode.LONGLAT.getEpsgCode(), map.getProjection());
map.setCenter(lonLat, 12);
return mapWidget;
}
}
I've found the problem. I included the google maps api script in the host page twice.