List of usage examples for com.google.gwt.maps.client.event Event addListener
public static HasMapsEventListener addListener(HasJso instance, String eventName, MouseEventCallback callback)
From source file:com.google.mobile.trippy.web.client.view.MapView.java
License:Apache License
@Override public void setMarkerClickListener(final HasMarker marker, final MarkerClickListener markerClickListener) { Event.addListener(marker, HasMarker.Event.CLICK.getValue(), new MouseEventCallback() { @Override/*w ww .j av a 2s.co m*/ public void callback(HasMouseEvent event) { markerClickListener.onMarkerClick(marker); } }); }
From source file:com.google.mobile.trippy.web.client.view.MapView.java
License:Apache License
@Override public void setMapClickListener(final MapClickListener mapClickListener) { Event.addListener(getMap(), "click", new MouseEventCallback() { @Override//from w ww.j a va2 s .co m public void callback(HasMouseEvent event) { mapClickListener.onMapClick(event.getLatLng()); } }); }
From source file:com.google.mobile.trippy.web.client.widget.InfoWindowView.java
License:Apache License
@Override public void setClickHandler(EventCallback callback) { Event.clearListeners(this, "click"); Event.addListener(this, "click", callback); }
From source file:com.mashery.examples.api.client.weatherbug.WeatherBugOverlayView.java
License:Open Source License
@Override public void onAdd() { Document doc = Document.get(); DivElement div = doc.createDivElement(); div.getStyle().setBorderStyle(BorderStyle.NONE); div.getStyle().setBorderWidth(0d, Unit.PX); div.getStyle().setPosition(Position.ABSOLUTE); div.getStyle().setOpacity(0.4d);/*from ww w . j a v a 2s .c o m*/ this.div = div; getPanes().getOverlayLayer().appendChild(div); boundsChangedListener = Event.addListener(getMap(), "bounds_changed", new EventCallback() { @Override public void callback() { WeatherBugOverlayView.this.draw(); } }); zoomChangedListener = Event.addListener(getMap(), "zoom_changed", new EventCallback() { @Override public void callback() { for (Node child = WeatherBugOverlayView.this.div.getFirstChild(); child != null;) { Node node = child; child = child.getNextSibling(); node.removeFromParent(); } tiles.clear(); } }); }
From source file:es.uem.geoparser.client.view.MapViewImpl.java
License:Apache License
@Override public void addListener(HasJso instance, String eventName, EventCallback callback) { Event.addListener(instance, eventName, callback); }
From source file:org.opendatakit.aggregate.client.popups.VisualizationPopup.java
License:Apache License
private MapWidget createMap() { int latIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LATITUDE_ORDINAL_NUMBER); int lonIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LONGITUDE_ORDINAL_NUMBER); // check to see if we have lat & long, if not display erro if (latIndex < 0 || lonIndex < 0) { String error = "ERROR:"; if (latIndex < 0) { error = error + " The Latitude Coordinate is NOT included in the Filter."; }/*from w w w. j a va 2 s . c o m*/ if (lonIndex < 0) { error = error + " The Longitude Coordinate is NOT included in the Filter."; } Window.alert(error); return null; } // create a center point, stop at the first gps point found LatLng center = new LatLng(0.0, 0.0); for (SubmissionUI sub : submissions) { LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub); if (gpsPoint != null) { center = gpsPoint; break; } } // create mapping area final MapOptions options = new MapOptions(); options.setCenter(center); MapTypeId id = new MapTypeId(); options.setMapTypeId(id.getRoadmap()); options.setZoom(6); options.setMapTypeControl(true); options.setNavigationControl(true); options.setScaleControl(true); final MapWidget mapWidget = new MapWidget(options); mapWidget.setSize("100%", "100%"); final HasMap map = mapWidget.getMap(); // create the markers for (SubmissionUI sub : submissions) { LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub); if (gpsPoint != null) { final Marker marker = new Marker(); marker.setPosition(gpsPoint); marker.setMap(map); // marker needs to be added to the map before calling // InfoWindow.open(marker, ...) final SubmissionUI tmpSub = sub; Event.addListener(marker, "mouseover", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { if (infoWindow != null) { infoWindow.close(); } infoWindow = new InfoWindow(); InfoContentSubmission w = createInfoWindowWidget(tmpSub); HTMLPanel container = new HTMLPanel("<div></div>"); container.add(w); infoWindow.setContent(container.getElement().getInnerHTML()); infoWindow.open(map, marker); } }); Event.addListener(marker, "mouseout", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { if (!mapMarkerClicked) { if (infoWindow != null) { infoWindow.close(); infoWindow = null; } } mapMarkerClicked = false; } }); Event.addListener(marker, "click", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { mapMarkerClicked = true; } }); } } return mapWidget; }