some code i've took from here:

http://code.google.com/p/gwt-maps3/source/browse/trunk/src/com/googlecode/maps3/client/InfoWindow.java

пятница, 22 июня 2012 г., 11:04:14 UTC+4 пользователь John99 написал:
>
> I have a button on InfoWindow. and ClickEvent doesn't work. I think it 
> because of infowindow doesn't attach this button to DOM correctly. I've 
> made a wraper whis fake panel and now it works ok.
>
> public class NGTInfoWindow {
>
>     static class FakePanel extends ComplexPanel
>     {
>         public FakePanel(Widget w)
>         {
>             // Detach new child from anything it was attached to before.
>             w.removeFromParent();
>             // Adds to our collection
>             getChildren().add(w);
>             // Results in the actual attachment
>             adopt(w);
>         }
>
>         @Override
>         public boolean isAttached()
>         {
>             return true;
>         }
>
>         /** Detaches the widget */
>         public void detachWidget()
>         {
>             this.remove(0);
>         }
>     }
>
>     private static final Logger log = 
> Logger.getLogger(NGTInfoWindow.class.getName());
>
>     private InfoWindow infoWindow;
>
>     private FakePanel widgetAttacher;
>
>     public NGTInfoWindow(InfoWindowOptions options){
>         this.infoWindow = InfoWindow.newInstance(options);
>     }
>
>     private void detachWidget()
>     {
>         if (this.widgetAttacher != null)
>         {
>             this.widgetAttacher.detachWidget();
>             this.widgetAttacher = null;
>
>             log.log(Level.SEVERE, "detachWidget");
>         }
>     }
>
>
>     public void setContent(Widget value)
>     {
>         infoWindow.setContent(value.getElement());
>
>         if (this.widgetAttacher == null)
>         {
>             // Add a hook for the close button click
>             infoWindow.addCloseClickHandler(new CloseClickMapHandler(){
>
>                 @Override
>                 public void onEvent(CloseClickMapEvent closeClickMapEvent) 
> {
>                     detachWidget();
>                 }
>
>             });
>
>
>             /*this.jso.addListener("closeclick", new Runnable() {
>                 @Override
>                 public void run()
>                 {
>                     detachWidget();
>                 }
>             });*/
>             this.widgetAttacher = new FakePanel(value);
>         }
>         else if (this.widgetAttacher.getWidget(0) != value)
>         {
>             this.widgetAttacher.detachWidget();
>             this.widgetAttacher = new FakePanel(value);
>         }
>     }
>
>     public void open(MapWidget mapWidget, MVCObject<?> anchor){
>         infoWindow.open(mapWidget, anchor);
>     }
>
>     public void close(){
>         infoWindow.close();
>     }
>
> }
>
> пятница, 22 июня 2012 г., 6:39:20 UTC+4 пользователь Joseph Lust написал:
>>
>> John99,
>>
>> Which event on 
>> InfoWindow<https://github.com/branflake2267/GWT-Maps-V3-Api/blob/master/Apis_Google_Maps/src/com/google/gwt/maps/client/overlays/InfoWindow.java>is
>>  not working for you. There are five handlers exposed to GWT from the 5 
>> handlers documented for 
>> InfoWindow<https://developers.google.com/maps/documentation/javascript/reference#InfoWindow>in
>>  the GMaps API. Please elaborate.
>>
>>
>> Sincerely,
>> Joseph
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/QUbLDwEaSNgJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to