Example usage for com.google.gwt.maps.client MapUIOptions setDoubleClick

List of usage examples for com.google.gwt.maps.client MapUIOptions setDoubleClick

Introduction

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

Prototype

public final native MapUIOptions setDoubleClick(boolean value) ;

Source Link

Document

When set to true, this method specifies that zooming with double-clicks should be enabled.

Usage

From source file:com.google.gwt.gadgets.sample.traveler.client.TravelMap.java

License:Apache License

private TravelMap(boolean doubleClickToZoom) {
    map = new MapWidget();
    map.setSize("100%", "100%");
    map.setCenter(zero, 0);/*from   www  .ja  v  a 2 s .c  om*/
    MapUIOptions options = MapUIOptions.newInstance(Size.newInstance(200, 200));
    options.setDoubleClick(doubleClickToZoom);
    map.setUI(options);
    DockLayoutPanel panel = new DockLayoutPanel(Unit.PCT);
    panel.add(map);
    initWidget(panel);
}

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

License:Apache License

public ReverseGeocoderDemo() {
    VerticalPanel outer = new VerticalPanel();
    map = new MapWidget(LatLng.newInstance(0, 0), 1);
    outer.add(map);/*from ww w.j  a v a2s. c  om*/
    map.setSize("500px", "300px");
    initWidget(outer);
    // Workaround for bug with click handler & setUItoDefaults() - see issue 260
    MapUIOptions opts = map.getDefaultUI();
    opts.setDoubleClick(false);
    map.setUI(opts);

    map.addMapClickHandler(new MapClickHandler() {

        public void onClick(final MapClickEvent event) {
            // Do not mis-interpret clicks on the info window and marker as
            // map click events to be reverse geocoded.
            if (event.getOverlay() != null) {
                return;
            }
            final Marker marker = new Marker(event.getLatLng());
            final VerticalPanel panel = new VerticalPanel();
            final InfoWindowContent content = new InfoWindowContent(panel);
            panel.add(new Label("LatLng: " + event.getLatLng().toString()));

            // Do a reverse geocode of this position
            geocoder.getLocations(event.getLatLng(), new LocationCallback() {

                public void onFailure(int statusCode) {
                    Window.alert("Failed to geocode position " + event.getLatLng() + ". Status: " + statusCode
                            + " " + StatusCodes.getName(statusCode));
                }

                public void onSuccess(JsArray<Placemark> locations) {
                    for (int i = 0; i < locations.length(); ++i) {
                        Placemark location = locations.get(i);
                        StringBuilder value = new StringBuilder();
                        if (location.getAddress() != null) {
                            value.append(location.getAddress());
                        } else {
                            if (location.getCity() != null) {
                                value.append(location.getCity());
                            }
                            if (location.getAdministrativeArea() != null) {
                                value.append(location.getAdministrativeArea() + ", ");
                            }
                            if (location.getCountry() != null) {
                                value.append(location.getCountry());
                            }
                        }
                        int ordinal = (i + 1);
                        panel.add(new Label("  " + ordinal + ") " + value.toString()));
                    }
                    map.addOverlay(marker);
                    map.getInfoWindow().open(marker, content);
                }
            });
            marker.addMarkerClickHandler(new MarkerClickHandler() {

                public void onClick(MarkerClickEvent markerClickEvent) {
                    if (!map.getInfoWindow().isVisible()) {
                        map.getInfoWindow().open(marker, content);
                    }
                }
            });
        }

    });
    geocoder = new Geocoder();
}