Example usage for com.google.gwt.maps.client InfoWindow close

List of usage examples for com.google.gwt.maps.client InfoWindow close

Introduction

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

Prototype

public void close() 

Source Link

Document

Closes the info window.

Usage

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

License:Apache License

private InfoWindowContent newLocationCreateForm(final LatLng point, final LocationHandler handler,
        final InfoWindow info) {
    final TextBox titleBox = new TextBox();
    final TextArea descriptionBox = new TextArea();
    Button saveButton = new Button("Save");
    saveButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            titleBox.setReadOnly(true);/*  w  w w.  j ava  2  s  . com*/
            descriptionBox.setReadOnly(true);
            Location loc = Location.newInstance();
            loc.setTitle(titleBox.getText());
            loc.setDescription(descriptionBox.getText());
            loc.setLatitude(point.getLatitude());
            loc.setLongitude(point.getLongitude());
            loc.setMilis(Long.toString(new Date().getTime()));
            handler.handle(loc);
            info.close();
            map.addOverlay(createMarker(loc));
        }
    });

    VerticalPanel panel = new VerticalPanel();
    panel.add(new HTML("title:"));
    panel.add(titleBox);
    panel.add(new HTML("description"));
    panel.add(descriptionBox);
    panel.add(saveButton);
    panel.setCellHorizontalAlignment(saveButton, HasHorizontalAlignment.ALIGN_RIGHT);
    return new InfoWindowContent(panel);
}

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

License:Apache License

private InfoWindowContent newLocationDescription(final Location location, final InfoWindow info,
        final Marker marker) {
    VerticalPanel panel = new VerticalPanel();
    panel.setSpacing(3);/* www .  ja va2 s.c o  m*/
    panel.setWidth("100%");
    Label title = new Label(location.getTitle());
    title.setStylePrimaryName("location-title");
    Label desc = new Label(location.getDescription());
    desc.setStylePrimaryName("location-desc");
    Label date = new Label("Added " + location.getDate());
    date.setStylePrimaryName("location-date");
    panel.add(title);
    panel.add(desc);
    panel.add(date);
    Button deleteButton;
    if (deleteHandler != null) {
        deleteButton = new Button("Delete");
        deleteButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                map.removeOverlay(marker);
                deleteHandler.handle(location);
                info.close();
            }
        });
        panel.add(deleteButton);
        panel.setCellHorizontalAlignment(deleteButton, HasHorizontalAlignment.ALIGN_RIGHT);
    }
    return new InfoWindowContent(panel);
}

From source file:com.google.livingstories.client.lsp.views.contentitems.LocationView.java

License:Apache License

private MapWidget createMap() {
    final String description = location.getDescription();
    LatLng latLng = LatLng.newInstance(location.getLatitude(), location.getLongitude());

    final MapWidget map = new MapWidget(latLng, MAPS_ZOOM);
    map.setSize(MAPS_WIDTH + "px", MAPS_HEIGHT + "px");
    map.addControl(new SmallMapControl());
    map.setDoubleClickZoom(true);/*from   w  w w .j a  v a2s .  c o m*/
    map.setDraggable(true);
    map.setScrollWheelZoomEnabled(true);
    if (!description.isEmpty()) {
        final Marker marker = new Marker(latLng);
        map.addOverlay(marker);
        final InfoWindowContent iwc = new InfoWindowContent(description);
        marker.addMarkerClickHandler(new MarkerClickHandler() {
            @Override
            public void onClick(MarkerClickEvent event) {
                InfoWindow infoWindow = map.getInfoWindow();
                if (infoWindow.isVisible()) {
                    infoWindow.close();
                } else {
                    infoWindow.open(marker, iwc);
                }
            }
        });
        map.setTitle(description);
    }
    return map;
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.ActiveResultPresenter.java

License:Apache License

private void hideInfoWindow() {
    // Hide that info window if need be
    MapWidget map = _mapOverlayManager.getMapWidget();
    InfoWindow window = map.getInfoWindow();
    window.close();
}