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

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

Introduction

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

Prototype

public static native boolean isBrowserCompatible() ;

Source Link

Document

Returns true if the current browser supports the maps API library.

Usage

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

License:Apache License

public void onModuleLoad() {

    if (!Maps.isLoaded()) {
        Window.alert("The Maps API is not installed."
                + "  The <script> tag that loads the Maps API may be missing or your Maps key may be wrong.");
        return;/* ww w  .j a  v  a 2  s.  co m*/
    }

    if (!Maps.isBrowserCompatible()) {
        Window.alert("The Maps API is not compatible with this browser.");
        return;
    }

    // Load all the MapsDemos.
    loadMapsDemos();

    innerPanel.setStylePrimaryName("hm-mapinnerpanel");
    innerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizPanel = new HorizontalPanel();
    list.setStylePrimaryName("hm-demolistbox");
    horizPanel.add(new Label("Select Demo: "));
    horizPanel.add(list);
    innerPanel.add(horizPanel);
    innerPanel.add(description);
    innerPanel.setSpacing(10);

    History.addHistoryListener(this);

    outerPanel.setStylePrimaryName("hm-outerpanel");
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);

    outerPanel.addCell(0);
    outerPanel.addCell(1);
    outerPanel.addCell(2);
    outerPanel.addCell(3);
    outerPanel.addCell(4);

    outerPanel.setWidget(0, 0,
            new HTML("This Maps-enabled application was built using the Google " + "API Library for GWT, "
                    + "<a href=\"http://code.google.com/p/gwt-google-apis/\">"
                    + "http://code.google.com/p/gwt-google-apis/</a>. "
                    + "The drop down list below allows you to select a scenario that "
                    + "demonstrates a particular capability of the Maps support."));

    outerPanel.setWidget(1, 0, innerPanel);

    DecoratorPanel decorator = new DecoratorPanel();
    decorator.add(outerPanel);

    RootPanel.get("hm-map").add(decorator);

    // Show the initial screen.
    String initToken = History.getToken();
    if (initToken.length() > 0) {
        onHistoryChanged(initToken);
    } else {
        showInfo();
    }
}