Search code examples
javagwtgwt-rpcgwt2gwt-ext

Activity Indicator in GWT MAP


What I would like to have is an activity indicator, which is displayed after my app is up and running, but while GWT is making AJAX calls.

For example have a look at following site : http://www.foodtrucksmap.com/#

Any ideas on how to achieve it?


Solution

  • I had to deal with the same kind of stuff few days back. The way I did was, created an Icon and Overlayed on the map.

    Icon icon = Icon.newInstance("loading.gif"); // load you gif as icon
    MarkerOptions options = MarkerOptions.newInstance();
    options.setIcon(icon);
    Marker indicator = new Marker(point, options); 
    

    So before the Async call and after you map is up, just add the icon to the map using

    map.addOverlay(indicator);
    

    and after the Async call remove the overlay using

    map.removeOverlay(indicator);
    

    I am not sure how correct this approach is, but this is what I did and it worked.