Here is the background:
Exception:
@com.google.gwt.maps.client.overlays.Marker::setMapImpl(Lcom/google/gwt/maps/client/MapImpl;)([JavaScript object(34)]): Invalid value for property <map>: [object Object]
public class MapView extends Composite {
private final VerticalPanel verticalPanel;
private MapWidget mapWidget;
private List<Marker> markers;
public MapView() {
verticalPanel = new VerticalPanel();
markers = new ArrayList<Marker>();
initWidget(verticalPanel);
draw();
}
private void draw() {
verticalPanel.clear();
MapOptions opts = MapOptions.newInstance();
opts.setZoom(4);
opts.setCenter(App.createWashingtonMonumentLatLng());
opts.setMapTypeId(MapTypeId.ROADMAP);
mapWidget = new MapWidget(opts);
verticalPanel.add(mapWidget);
mapWidget.setSize("600px", "400px");
}
// Calling addMarker after the map has loaded by clicking on another UI element
private void addMarker(final Node node) {
if (node.getCoordinate() == null) return;
LatLng center = node.getCoordinate().toLatLng();
MarkerOptions options = MarkerOptions.newInstance();
options.setPosition(center);
options.setTitle(node.getName());
final Marker marker = Marker.newInstance(options);
marker.setMap(mapWidget); // blows up here
marker.addClickHandler(new ClickMapHandler() {
@Override
public void onEvent(ClickMapEvent event) {
notifyListeners(new NodeChangeEvent(node));
}
});
markers.add(marker);
}
}
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment