My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 3: Widgets added to InfoWindow loose handlers
5 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


 
Reported by googelyb...@gmail.com, Mar 16, 2012
I am investigating gwt libraries for Maps V3 and found the following bug which sadly makes it impossible to use your library.

What steps will reproduce the problem?

		InfoWindowOptions options = InfoWindowOptions.newInstance();
		Button button = new Button("click me");
		button.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				Window.alert("Hello Maps");
			}
		});
		options.setContent(button);

		InfoWindow iw = InfoWindow.newInstance(options);
		iw.open(mapWidget, marker);

What is the expected output? What do you see instead?
* Expected: The clickhandler on the button is fired, I get an alert dialog
* IS: Nothing happens when I click on the button

What version of the product are you using? On what operating system?
gwt 2.4

Please provide any additional information below.
All handlers on the widgets added to an InfoWindow are lost. This is because InfoWindowOptions.setContent(Widget) implementation:  setContent(widget.getElement());

I think the Maps V2 library does some extra work here to preserve the handlers, as there it works.

Is there a workaround for this to add a link / button to the InfoWindow?
Mar 30, 2012
#1 z...@comerge.net
Workaround (similar done in v2): Use a 'virtual' panel to attach the content of the InfoWindow and register a close handler to detach the widget when its not needed anymore.

...
private final VirtualPanel fVirtualPanel = new VirtualPanel();
private static class VirtualPanel extends ComplexPanel {

    public void attach(Widget w) {
        w.removeFromParent();
        getChildren().add(w);
        adopt(w);
    }

    @Override
    public boolean isAttached() {
        return true;
    }
}
...
fVirtualPanel.attach(fInfoWindowContent);
...
fInfoWindow.addCloseClickHandler(new CloseClickMapHandler() {
	
	@Override
	public void onEvent(CloseClickMapEvent event) {
		fVirtualPanel.remove(fInfoWindowContent);
	}
});
Jul 24, 2014
#2 niranjan...@gmail.com
i am facing similar problem

Powered by Google Project Hosting