GWT地图v2 InfoWindow
有InfoWindowContent
。 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);
我该如何解决?