GWT映射v3单击处理程序在InfoWindow中不起作用

时间:2012-03-05 20:44:11

标签: gwt button google-maps-api-3 infowindow

GWT地图v2 InfoWindowInfoWindowContent。 GWT地图v3 InfoWindow没有InfoWindowContent。我找到了这段代码,但点击处理程序无效:

InfoWindow info = new InfoWindow();
VerticalPanel verticalPanel = new VerticalPanel();
Label addressLabel = new Label("Address: " + address);
Label coordinatesLabel = new Label("Position: " + gLatLng.toUrlValue());
verticalPanel.add(addressLabel);
verticalPanel.add(coordinatesLabel);
HorizontalPanel horizontalPanel = new HorizontalPanel();
Button newAsociation = new Button("Add house");
Button deleteMarker = new Button("Delete");
newAsociation.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
    System.out.println("Add house");                        
}
});
horizontalPanel.add(newAsociation);
horizontalPanel.add(deleteMarker);
verticalPanel.add(horizontalPanel);
info.setContent(verticalPanel.getElement().toString());
info.open(mapWidget.getMap(), marker);

我该如何解决?

1 个答案:

答案 0 :(得分:0)

如果您使用gwt-google-apis中的地图v3,则可以找到解决方案here