Example usage for com.google.gwt.maps.client.overlays InfoWindowOptions setContent

List of usage examples for com.google.gwt.maps.client.overlays InfoWindowOptions setContent

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.overlays InfoWindowOptions setContent.

Prototype

public final native void setContent(Element content) ;

Source Link

Document

set Content to display in the InfoWindow.

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;//from  www  . j  a  va 2s  .com
    }

    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.ElevationMapWidget.java

License:Apache License

protected void drawInfoWindow(LatLng position, double elevation) {

    NumberFormat format = NumberFormat.getFormat("###");
    String elevationStr = format.format(elevation);
    String latlngStr = "[ " + format.format(position.getLatitude()) + ", "
            + format.format(position.getLongitude()) + " ]";
    String message = "Elevation " + elevationStr + "m @ " + latlngStr;

    HTML html = new HTML(message);
    InfoWindowOptions options = InfoWindowOptions.newInstance();
    options.setContent(html);
    InfoWindow iw = InfoWindow.newInstance(options);
    iw.setPosition(position);/*from  ww  w  . ja  v a 2  s.c o m*/
    iw.open(mapWidget);
}

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

License:Apache License

private void drawInfoWindowOnMapCenter() {
    HTML html = new HTML("Center: " + mapWidget.getCenter().getToString());

    InfoWindowOptions options = InfoWindowOptions.newInstance();
    options.setContent(html);
    options.setPosition(mapWidget.getCenter());

    InfoWindow iw = InfoWindow.newInstance(options);
    iw.open(mapWidget);/*from  www.  j  a  v a 2  s  .c om*/
}

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;//from   w ww. jav  a2 s. c om
    }

    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();
}

From source file:com.google.sampling.experiential.client.ChartPanel.java

License:Open Source License

private void openInfoWindowForMarker(final EventDAO eventRating, final Marker marker) {
    InfoWindowOptions options = InfoWindowOptions.newInstance();
    options.setContent(createInfoWindowForEvent(eventRating));
    InfoWindow iw = InfoWindow.newInstance(options);
    iw.open(map, marker);/*w ww .j a v  a2 s  . co  m*/
}

From source file:gov.nist.spectrumbrowser.client.SensorGroupMarker.java

License:Open Source License

public InfoWindow getInfoWindow(String message) {
    if (infoWindow == null) {
        LatLng northeast = SpectrumBrowserShowDatasets.getMap().getBounds().getNorthEast();
        LatLng southwest = SpectrumBrowserShowDatasets.getMap().getBounds().getSouthWest();
        double delta = northeast.getLatitude() - southwest.getLatitude();
        int height = SpectrumBrowser.MAP_HEIGHT;
        // should be the height of the icon.
        int desiredPixelOffset = 15;
        double latitudeOffset = delta / height * desiredPixelOffset;
        InfoWindowOptions iwo = InfoWindowOptions.newInstance();
        iwo.setPosition(LatLng.newInstance(lat + latitudeOffset, lon));
        iwo.setDisableAutoPan(true);/* ww  w . ja  va2s.  co m*/
        iwo.setContent(message);
        infoWindow = InfoWindow.newInstance(iwo);
    }
    return infoWindow;
}

From source file:gov.nist.spectrumbrowser.client.SensorInfoDisplay.java

License:Open Source License

public InfoWindow getInfoWindow() {
    LatLng northeast = SpectrumBrowserShowDatasets.getMap().getBounds().getNorthEast();
    LatLng southwest = SpectrumBrowserShowDatasets.getMap().getBounds().getSouthWest();
    double delta = northeast.getLatitude() - southwest.getLatitude();
    int height = SpectrumBrowser.MAP_HEIGHT;
    // should be the height of the icon.
    int desiredPixelOffset = 15;
    double latitudeOffset = delta / height * desiredPixelOffset;
    InfoWindowOptions iwo = InfoWindowOptions.newInstance();

    iwo.setPosition(LatLng.newInstance(getLatLng().getLatitude() + latitudeOffset, getLatLng().getLongitude()));
    iwo.setDisableAutoPan(true);/*from   www. jav  a2  s  .c o  m*/
    iwo.setContent(sensorInfo.getSensorDescription());
    return InfoWindow.newInstance(iwo);
}

From source file:org.rebioma.client.MapView.java

License:Apache License

protected void mapGeocoderResult(JsArray<com.google.gwt.maps.client.services.GeocoderResult> results) {
    String address = geocoder.getAddress();
    StringBuilder sb = new StringBuilder();
    LatLng point = null;/*from  ww w .  j av a2 s .  c  om*/
    for (int i = 0; i < results.length(); i++) {
        com.google.gwt.maps.client.services.GeocoderResult geoResult = results.get(i);
        point = geoResult.getGeometry().getLocation();
        MapGeocoderResult result = new MapGeocoderResult(point, address);
        sb.append(result);
        InfoWindowOptions contentOptions = InfoWindowOptions.newInstance();
        contentOptions.setContent(result);
        contentOptions.setPosition(point);
        final InfoWindow content = InfoWindow.newInstance(contentOptions);
        if (geocoderMarkers != null) {
            for (Marker marker : geocoderMarkers) {
                marker.setMap((MapWidget) null);
            }
        }
        Marker geocoderMarker = GeocoderControl.createMarker(point, address);
        geocoderMarker.setMap(map);
        geocoderMarker.addClickHandler(new ClickMapHandler() {
            @Override
            public void onEvent(ClickMapEvent event) {
                closeInfoWindows();
                content.open(map);
                infoWindows.add(content);
            }
        });
        geocoderMarkers.add(geocoderMarker);
    }
    if (results.length() == 1 && point != null) {
        map.setCenter(point);
    }
}

From source file:org.rebioma.client.MapView.java

License:Apache License

private void showWindowInfo(OccurrenceMarkerManager occurrenceMarkerManager) {
    if (summaryContent == null) {
        summaryContent = new OccurrenceSummaryContent();
    }// w w  w  .  j  a  va2  s. c  om
    closeInfoWindows();
    summaryContent.loadOccurrenceInfo(occurrenceMarkerManager.getOccurrence());
    //parent.getAbsoluteLeft();
    InfoWindowOptions infoWindowOptions = InfoWindowOptions.newInstance();
    infoWindowOptions.setPosition(occurrenceMarkerManager.getMarker().getPosition());
    try {
        infoWindowOptions.setContent(summaryContent);
    } catch (JavaScriptException e) {
        //on reessaie
        //TODO determiner pourquoi pour un nombre paire(2ime, 4ime, ...) d'execution, il y a une JavaScriptException
        infoWindowOptions.setContent(summaryContent);
    }

    InfoWindow infoWindow = InfoWindow.newInstance(infoWindowOptions);
    infoWindow.open(map);
    infoWindows.add(infoWindow);
}