List of usage examples for com.google.gwt.maps.client InfoWindowContent InfoWindowContent
private InfoWindowContent(int type)
From source file:at.ait.dme.yuma.client.map.annotation.GoogleMapsComposite.java
License:EUPL
/** * draw the overlay/* w ww . j a va 2 s . c o m*/ * * @param coords * @param shape * @return overlay */ private void drawOverlay(List<LatLng> coords, ImageAnnotation annotation) { Shape shape = annotation.getFragment().getShape(); if (!coords.isEmpty()) { LatLng center = coords.remove(coords.size() - 1); map.setCenter(center); map.getInfoWindow().open(center, new InfoWindowContent(annotation.getTitle())); } if (shape instanceof Polyline) { map.addOverlay(new com.google.gwt.maps.client.overlay.Polyline(coords.toArray(new LatLng[0]), shape.getColor().toRGBString(), shape.getStrokeWidth(), 0.5d)); } else { map.addOverlay(new com.google.gwt.maps.client.overlay.Polygon(coords.toArray(new LatLng[0]), shape.getColor().toRGBString(), shape.getStrokeWidth(), 0.5d, shape.getColor().toRGBString(), 0.5d)); } }
From source file:at.ait.dme.yuma.suite.apps.map.client.widgets.GoogleMapsComposite.java
License:EUPL
/** * draw the overlay/*from w w w . j a v a 2 s . com*/ * * @param coords * @param shape * @return overlay */ private void drawOverlay(List<LatLng> coords, ImageAnnotation annotation) { Shape shape = ((ImageFragment) annotation.getFragment()).getShape(); if (!coords.isEmpty()) { LatLng center = coords.remove(coords.size() - 1); map.setCenter(center); map.getInfoWindow().open(center, new InfoWindowContent(annotation.getTitle())); } if (shape instanceof Polyline) { map.addOverlay(new com.google.gwt.maps.client.overlay.Polyline(coords.toArray(new LatLng[0]), shape.getColor().toRGBString(), shape.getStrokeWidth(), 0.5d)); } else { map.addOverlay(new com.google.gwt.maps.client.overlay.Polygon(coords.toArray(new LatLng[0]), shape.getColor().toRGBString(), shape.getStrokeWidth(), 0.5d, shape.getColor().toRGBString(), 0.5d)); } }
From source file:com.apress.progwt.client.map.MyCollegeMap.java
License:Apache License
private Marker createMarker(final School school) { LatLng point = new LatLng(school.getLatitude(), school.getLongitude()); if (point.getLatitude() == -1 && point.getLongitude() == -1) { return null; }//w ww .j a va 2 s . c om final Marker marker = new Marker(point); marker.addMarkerClickListener(new MarkerClickListener() { public void onClick(Marker sender) { InfoWindow info = map.getInfoWindow(); info.open(sender, new InfoWindowContent(new SchoolLink(school))); } public void onDoubleClick(Marker sender) { } }); return marker; }
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);/*from w ww.j a v a2s . c o m*/ 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);/*from www . j av a 2s .c om*/ 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.gwt.maps.sample.hellomaps.client.DragMarkerDemo.java
License:Apache License
@Override public void onShow() { map.clearOverlays();/* w ww . j ava 2 s . com*/ MarkerOptions options = MarkerOptions.newInstance(); options.setDraggable(true); final Marker marker = new Marker(map.getCenter(), options); final InfoWindow info = map.getInfoWindow(); marker.addMarkerDragEndHandler(new MarkerDragEndHandler() { public void onDragEnd(MarkerDragEndEvent event) { info.open(marker, new InfoWindowContent("Just bouncing along...")); } }); marker.addMarkerDragStartHandler(new MarkerDragStartHandler() { public void onDragStart(MarkerDragStartEvent event) { info.setVisible(false); } }); map.addOverlay(marker); }
From source file:com.google.gwt.maps.sample.hellomaps.client.Geocoder2Demo.java
License:Apache License
private void showAddress(final String address) { final InfoWindow info = map.getInfoWindow(); geocoder.getLocations(address, new LocationCallback() { public void onFailure(int statusCode) { Window.alert("Sorry, we were unable to geocode that address"); }//from ww w. j a v a2 s . c om public void onSuccess(JsArray<Placemark> locations) { Placemark place = locations.get(0); Marker marker = new Marker(place.getPoint()); map.addOverlay(marker); String message = place.getAddress() + "<br>" + "<b>Country code:</b> " + place.getCountry(); info.open(marker, new InfoWindowContent(message)); } }); }
From source file:com.google.gwt.maps.sample.hellomaps.client.GeocoderDemo.java
License:Apache License
private void showAddress(final String address) { final InfoWindow info = map.getInfoWindow(); geocoder.getLatLng(address, new LatLngCallback() { public void onFailure() { Window.alert(address + " not found"); }//from w ww. j a v a2s . c om public void onSuccess(LatLng point) { map.setCenter(point, 13); Marker marker = new Marker(point); map.addOverlay(marker); info.open(marker, new InfoWindowContent(address)); displayLatLng(point); } }); }
From source file:com.google.gwt.maps.sample.hellomaps.client.IconClassDemo.java
License:Apache License
/** * Creates a marker whose info window displays the letter corresponding to the * given index.//from w w w .java 2s . c o m */ private Marker createMarker(LatLng point, int index) { // Create a lettered icon for this point using our icon class final char letter = (char) ('A' + index); Icon icon = Icon.newInstance(baseIcon); icon.setImageURL("http://www.google.com/mapfiles/marker" + letter + ".png"); MarkerOptions options = MarkerOptions.newInstance(); options.setIcon(icon); final Marker marker = new Marker(point, options); marker.addMarkerClickHandler(new MarkerClickHandler() { public void onClick(MarkerClickEvent event) { InfoWindow info = map.getInfoWindow(); info.open(event.getSender(), new InfoWindowContent("Marker <b>" + letter + "</b>")); } }); return marker; }
From source file:com.google.gwt.maps.sample.hellomaps.client.InfoWindowDemo.java
License:Apache License
/** * Display one of the info Window test cases. *//*from ww w . j av a 2 s . c o m*/ private void displayInfoWindow() { // pop down the existing info window. if (info != null) { info.close(); } info = map.getInfoWindow(); String selection = actionListBox.getItemText(actionListBox.getSelectedIndex()); if (selection == null) { return; } InfoWindowContent content; if (selection.equals(TEST_MAX_CONTENT)) { // Demonstrate the use of the maxTitle and maxContent properties HTML htmlWidget = new HTML( "<h1>ATTENTION PLEASE</h1>" + "<p> I have a few things to say to you (click maximize.)</p>"); content = new InfoWindowContent(htmlWidget); content.setMaxContent("<p>Now is the time for all good men to come to the" + " aid of their country because we hold these truths to be self" + " evident, that I have a dream, that one day our children and our" + " children's children will tear down this wall!</p>" + "<p>Now is the time for all good men to come to the" + " aid of their country because we hold these truths to be self" + " evident, that I have a dream, that one day our children and our" + " children's children will tear down this wall!</p>"); content.setMaxTitle("ATTENTION PLEASE"); } else if (selection.equals(TEST_IMAGE)) { // An image that isn't loaded yet doesn't work well sometimes // Specify the width and height to work around this. HTML htmlWidget = new HTML("<img src=\"boot.jpg\" width=\"235\" height=\"287\">"); content = new InfoWindowContent(htmlWidget); } else if (selection.equals(TEST_NO_CLICK)) { // Demonstrates setting the info window to stay "sticky" and not // automatically close when the user clicks on the maps window. HTML htmlWidget = new HTML("<h1>STICKY INFO WINDOW</h1>" + "<p> Click if you must, you won't get rid of me that easily.</p>"); content = new InfoWindowContent(htmlWidget); content.setNoCloseOnClick(true); } else if (selection.equals(TEST_TABS)) { // Display tabs in the InfoWindow content = displayInfoWindowTabs(); } else if (selection.equals(TEST_MAX_TITLE_CONTENT_WIDGET)) { // Display the maximized content using widgets instead of strings. content = displayInfoWindowMaxWidget(); } else if (selection.equals(TEST_MAP_BLOWUP)) { // Display a Map Blowup Window content = new InfoWindowContent.MapBlowupContent(); } else { // The default case Tree tree = new Tree(); TreeItem foo = new TreeItem("Foo"); tree.addItem(foo); TreeItem bar = new TreeItem("bar"); foo.addItem(bar); bar.addItem("baz"); bar.addItem("gwt"); // max-height must be set in advance so info window is sized appropriately tree.setSize("217px", "104px"); content = new InfoWindowContent(tree); } info.open(map.getCenter(), content); }