You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by shiraz memon <sh...@googlemail.com> on 2009/04/20 10:17:11 UTC

gmap2: info window gets closed while refreshing

Hi

I have a problem in using gmap2 wicket api, when it refreshes the marker and
at the same time if user has opened the infowindow, it immediately shuts it
off (i.e. while setting overlays), which is distracting for the user
experience.

below is the code for more insight:

map.add(new ClickListener() {

  @Override
  protected void onClick(AjaxRequestTarget target, GLatLng latLng,
  GOverlay overlay) {
   try {
    if (overlay.getId() != null) {
     GMarker m = (GMarker) overlay;
     SiteGlueInfo siteInfo = webApp.getListSitesHelper().getSiteInfoById(
     m.getMarkerOptions().getTitle());
     IModel model = new Model();
     model.setObject(siteInfo);
     map.getInfoWindow().open(
     m.getLatLng(),
     new SiteInfoPanel(siteInfo.getSiteId(), model));
   }
  } catch (Exception e) {

  }

  }
  });

map.add(new GMapAutoUpdatingBehavior(Duration.seconds(15)) {

  private static final long serialVersionUID = 1L;

  @Override
  protected void onTimer(AjaxRequestTarget target, GMap2 map) {
  map.setOverlays(createOverlay(map));
  }
  });

Thanks for any help in advance.

Best regards,

Shiraz