Example usage for com.google.gwt.maps.client Maps getVersion

List of usage examples for com.google.gwt.maps.client Maps getVersion

Introduction

In this page you can find the example usage for com.google.gwt.maps.client Maps getVersion.

Prototype

public static native String getVersion() ;

Source Link

Document

Return the Maps API Version currently loaded.

Usage

From source file:com.google.gwt.maps.sample.hellomaps.client.HelloMaps.java

License:Apache License

public void show(MapsDemoInfo info, boolean affectHistory) {
    // Don't bother re-displaying the existing MapsDemo. This can be an issue
    // in practice, because when the history context is set, our
    // onHistoryChanged() handler will attempt to show the currently-visible
    // MapsDemo./*from w ww .  j  a v a 2s . c o m*/
    if (info == curInfo) {
        return;
    }
    curInfo = info;

    // Remove the old MapsDemo from the display area.
    if (curMapsDemo != null) {
        innerPanel.remove(curMapsDemo);
    }

    // Get the new MapsDemo instance, and display its description in the
    // MapsDemo list.
    curMapsDemo = info.getInstance();
    list.setMapsDemoSelection(info.getName());

    // If affectHistory is set, create a new item on the history stack. This
    // will ultimately result in onHistoryChanged() being called. It will call
    // show() again, but nothing will happen because it will request the exact
    // same MapsDemo we're already showing.
    if (affectHistory) {
        History.newItem(info.getName());
    }

    // Display the new MapsDemo and update the description panel.
    innerPanel.add(curMapsDemo);
    outerPanel.setWidget(2, 0, info.getDescriptionHTML());

    outerPanel.setWidget(3, 0,
            new HTML("These concepts behind these demos" + " are explained in the "
                    + "<a href=\"http://www.google.com/apis/maps/documentation/index.html\">"
                    + "Google Maps API Concepts</a> document."));

    // info is an inner class of the class we want to display. Strip off the
    // generated anonymous class name.
    String strippedClassName = info.getClass().getName();
    int lastIndex = strippedClassName.lastIndexOf('$');
    if (lastIndex > 0) {
        strippedClassName = strippedClassName.substring(0, lastIndex);
    }

    outerPanel.setWidget(4, 0, new HTML("<h5> See source in " + strippedClassName
            + "</h5><h5>Maps API version: " + Maps.getVersion() + "</h5>"));

    curMapsDemo.onShow();
}