List of usage examples for com.google.gwt.maps.client.overlays InfoWindow newInstance
public static final InfoWindow newInstance(InfoWindowOptions options)
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;// ww w. jav a 2s . c o m } 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);/*from ww w. jav a2 s.c o m*/ InfoWindow iw = InfoWindow.newInstance(options); iw.setPosition(position); 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);//from ww w. j ava2s . co m options.setPosition(mapWidget.getCenter()); InfoWindow iw = InfoWindow.newInstance(options); iw.open(mapWidget); }
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 w w .java 2 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);/*from w w w. ja v a 2s . c om*/ }
From source file:com.saveland.ancestry.client.InfoWindowMapWidget.java
License:Apache License
protected void drawInfoWindow(String key, final Marker marker, MouseEvent mouseEvent) { if (marker == null || mouseEvent == null) { return;//from w w w. j a va 2 s . c om } if (iw != null) { iw.close(); } Person person = (Person) cData.peopleKeyMap.get(key); HTML html = new HTML(person.getDisplayName()); VerticalPanel vp = new VerticalPanel(); vp.add(html); options.setContent(vp); 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.vaadin.tapio.googlemaps.client.CustomInfoWindow.java
License:Apache License
public void open(InfoWindowOptions opts, MapWidget map, Marker marker) { window = InfoWindow.newInstance(opts); window.setContent(this.getElement()); if (closeHandler != null) { closeHandlerReg = window.addCloseClickHandler(closeHandler); }//w w w . jav a 2 s . co m if (marker != null) { window.open(map, marker); } else { window.open(map); } }
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);//from w ww.ja va 2 s. com 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 w w w . jav a 2 s. c o m*/ iwo.setContent(sensorInfo.getSensorDescription()); return InfoWindow.newInstance(iwo); }
From source file:net.cbtltd.client.field.MapField.java
/** * Instantiates a new map field.//from w ww. j av a 2s .c om * * @param form is the form or other HasComponents element that contains the field. * @param permission that controls the visibility of the field. * @param tab index of the field. */ public MapField(HasComponents form, short[] permission, int tab) { initialize(panel, form, permission, CSS.cbtMapField()); super.setDefaultValue(LatLng.newInstance(0.0, 0.0)); addressLabel.addStyleName(CSS.cbtMapFieldLabel()); addressBox.addStyleName(CSS.cbtLocationFieldField()); addressBox.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { setName(addressBox.getText()); } }); addressBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { setName(addressBox.getText()); } } }); latitudeLabel.addStyleName(CSS.cbtMapFieldLabel()); latitudeBox.addStyleName(CSS.cbtMapFieldLatLng()); latitudeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { Double latitude = LF.parse(latitudeBox.getText()); if (latitude < -90.0 || latitude > 90.0) { addMessage(Level.ERROR, CONSTANTS.errPositionLatitude(), latitudeBox); } else { setValue(LatLng.newInstance(latitude, marker.getPosition().getLongitude())); } } }); longitudeLabel.addStyleName(CSS.cbtMapFieldLabel()); longitudeBox.addStyleName(CSS.cbtMapFieldLatLng()); longitudeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { Double longitude = LF.parse(longitudeBox.getText()); if (longitude < -180.0 || longitude > 180.0) { addMessage(Level.ERROR, CONSTANTS.errPositionLongitude(), longitudeBox); } else { setValue(LatLng.newInstance(marker.getPosition().getLatitude(), longitude)); } } }); position.addStyleName(CSS.cbtMapFieldTitle()); position.add(addressLabel); position.add(addressBox); position.add(latitudeLabel); position.add(latitudeBox); position.add(longitudeLabel); position.add(longitudeBox); position.add(lock); panel.add(position); MapOptions mapOptions = MapOptions.newInstance(); mapOptions.setDraggableCursor("crosshair"); mapOptions.setDraggingCursor("text"); mapOptions.setCenter(LatLng.newInstance(0.0, 0.0)); mapOptions.setDraggable(true); mapOptions.setDisableDoubleClickZoom(true); // mapOptions.setHeading(heading); mapOptions.setKeyboardShortcuts(false); mapOptions.setMapMaker(true); mapOptions.setMapTypeControl(true); mapOptions.setMapTypeId(mapTypeId); mapOptions.setNoClear(false); mapOptions.setOverviewMapControl(false); // mapOptions.setMapTypeControlOptions(MapTypeControlOptions.) mapOptions.setPanControl(true); // mapOptions.setPanControlOptions(panControlOptions); mapOptions.setRotateControl(false); // mapOptions.setRotateControlOptions(rotateControlOptions) mapOptions.setScaleControl(true); // mapOptions.setScaleControlOptions(scaleControlOptions) mapOptions.setScrollWheel(scrollWheel); // StreetViewPanoramaImpl streetView = StreetViewPanoramaImpl.newInstance(field.getElement(), options); // mapOptions.setStreetView(streetView); mapOptions.setStreetViewControl(streetView); // mapOptions.setStreetViewControlOptions(streetViewControlOptions) // mapOptions.setStyles(styles) mapOptions.setZoom(15); mapOptions.setZoomControl(true); map = MapWidget.newInstance(MapImpl.newInstance(field.getElement(), mapOptions)); map.addClickHandler(new ClickMapHandler() { public void onEvent(ClickMapEvent event) { if (isEnabled()) { setValue(event.getMouseEvent().getLatLng()); fireChange(MapField.this); } } }); panel.add(field); emptyValue.addStyleName(CSS.cbtMapFieldEmpty()); emptyValue.setVisible(false); panel.add(emptyValue); InfoWindowOptions infowindowOpts = InfoWindowOptions.newInstance(); infowindowOpts.setMaxWidth(100); infowindowOpts.setPosition(defaultValue); infoWindow = InfoWindow.newInstance(infowindowOpts); }