Example usage for com.google.gwt.maps.client.events MouseEvent getLatLng

List of usage examples for com.google.gwt.maps.client.events MouseEvent getLatLng

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.events MouseEvent getLatLng.

Prototype

public final LatLng getLatLng() 

Source Link

Document

The latitude/longitude that was below the cursor when the event occurred.

Usage

From source file:com.google.gwt.maps.testing.client.maps.BasicMapWidget.java

License:Apache License

protected void drawInfoWindow(Marker marker, MouseEvent mouseEvent) {
    if (marker == null || mouseEvent == null) {
        return;// w w w.jav a2  s. c  om
    }

    HTML html = new HTML("You clicked on: " + mouseEvent.getLatLng().getToString());

    InfoWindowOptions options = InfoWindowOptions.newInstance();
    options.setContent(html);
    InfoWindow iw = InfoWindow.newInstance(options);
    iw.open(mapWidget, marker);
}

From source file:com.google.gwt.maps.testing.client.maps.InfoWindowMapWidget.java

License:Apache License

protected void drawInfoWindow(final Marker marker, MouseEvent mouseEvent) {
    if (marker == null || mouseEvent == null) {
        return;/*www  .  j  av a  2 s.c o m*/
    }

    HTML html = new HTML(
            "Why did you click on me? <br/> You clicked on: " + mouseEvent.getLatLng().getToString());

    Button b1 = new Button("b1");
    b1.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("b1 clicked");
        }
    });

    Button b2 = new Button("b2");
    b2.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("b2 clicked");
        }
    });

    VerticalPanel vp = new VerticalPanel();
    vp.add(html);
    vp.add(b1);
    vp.add(b2);

    InfoWindowOptions options = InfoWindowOptions.newInstance();
    options.setContent(vp);

    InfoWindow iw = InfoWindow.newInstance(options);
    iw.open(mapWidget, marker);

    // If you want to clear widgets, Use options.clear() to remove the widgets
    // from map
    // options.clear();
}