List of usage examples for com.google.gwt.maps.client.control SmallMapControl SmallMapControl
public SmallMapControl()
From source file:com.google.gwt.maps.sample.hellomaps.client.MapEventDemo.java
License:Apache License
public MapEventDemo() { VerticalPanel vp = new VerticalPanel(); // Center the new map on Midtown Atlanta map = new MapWidget(ATLANTA, 13); map.setSize("500px", "300px"); map.addControl(new SmallMapControl()); map.addControl(new MapTypeControl()); MarkerOptions opt = MarkerOptions.newInstance(); opt.setDraggable(true);/*from ww w .jav a 2 s . co m*/ marker = new Marker(ATLANTA, opt); Panel hp1 = createActionButtons(); HorizontalPanel hp2 = createListenerListBox(); // Make a spacer HorizontalPanel hp3 = new HorizontalPanel(); hp3.add(new Label(" ")); hp3.setSize("1em", "1em"); handlerTable = new FlexTable(); clearListenerTable(); vp.add(map); vp.add(hp1); vp.add(hp2); vp.add(hp3); vp.add(handlerTable); initWidget(vp); }
From source file:com.google.gwt.maps.sample.hellomaps.client.MarkerInfoWindowDemo.java
License:Apache License
public MarkerInfoWindowDemo() { map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13); map.setSize("500px", "300px"); initWidget(map);/*from www . j a v a2s .c o m*/ map.addControl(new SmallMapControl()); map.addControl(new MapTypeControl()); }
From source file:com.google.gwt.maps.sample.hellomaps.client.OverlayDemo.java
License:Apache License
public OverlayDemo() { VerticalPanel vertPanel = new VerticalPanel(); vertPanel.setStyleName("hm-panel"); actionListBox = new ListBox(); for (OverlayDemos od : OverlayDemos.values()) { actionListBox.addItem(od.valueOf()); }//ww w. j a va 2s . c om actionListBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { displayOverlay(); } }); HorizontalPanel horizPanel = new HorizontalPanel(); horizPanel.add(new Label("Choose Action:")); horizPanel.add(actionListBox); horizPanel.setSpacing(10); vertPanel.add(horizPanel); map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13); map.setSize("500px", "300px"); map.addControl(new SmallMapControl()); map.addControl(new MapTypeControl()); vertPanel.add(map); initWidget(vertPanel); }
From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java
License:Apache License
private Widget createLocationPanel() { final VerticalPanel locationPanel = new VerticalPanel(); // show a map based on geocoded or manually-inputted lat-long combination HorizontalPanel descriptionPanel = new HorizontalPanel(); descriptionPanel.add(new HTML("Location name (displayed to readers):")); locationDescriptionTextArea = new TextArea(); locationDescriptionTextArea.setCharacterWidth(50); locationDescriptionTextArea.setHeight("60px"); descriptionPanel.add(locationDescriptionTextArea); Label geocodingOptions = new Label("Geocode based on:"); useDisplayedLocation = new RadioButton("geoGroup", "The displayed location name"); useDisplayedLocation.setValue(true); useAlternateLocation = new RadioButton("geoGroup", "An alternate location that geocodes better: "); alternateTextBox = new TextBox(); alternateTextBox.setEnabled(false);//w w w . j a va 2 s. co m HorizontalPanel alternatePanel = new HorizontalPanel(); alternatePanel.add(useAlternateLocation); alternatePanel.add(alternateTextBox); useManualLatLong = new RadioButton("geoGroup", "Manually entered latitude and longitude numbers (enter these below)"); HorizontalPanel latLongPanel = new HorizontalPanel(); latLongPanel.add(new HTML("Latitude: ")); latitudeTextBox = new TextBox(); latitudeTextBox.setEnabled(false); latLongPanel.add(latitudeTextBox); latLongPanel.add(new HTML(" Longitude: ")); longitudeTextBox = new TextBox(); longitudeTextBox.setEnabled(false); latLongPanel.add(longitudeTextBox); HorizontalPanel buttonPanel = new HorizontalPanel(); geocodeButton = new Button("Geocode location"); geocodeButton.setEnabled(false); buttonPanel.add(geocodeButton); geocoderStatus = new Label(""); buttonPanel.add(geocoderStatus); AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setOtherParms(mapsKey + "&sensor=false"); AjaxLoader.loadApi("maps", "2", new Runnable() { @Override public void run() { map = new MapWidget(); map.setSize(MAP_WIDTH + "px", MAP_HEIGHT + "px"); map.addControl(new SmallMapControl()); map.setDoubleClickZoom(true); map.setDraggable(true); map.setScrollWheelZoomEnabled(true); map.setZoomLevel(MAP_ZOOM); map.setVisible(false); locationPanel.add(map); createLocationHandlers(); } }, options); locationPanel.add(descriptionPanel); locationPanel.add(geocodingOptions); locationPanel.add(useDisplayedLocation); locationPanel.add(alternatePanel); locationPanel.add(useManualLatLong); locationPanel.add(latLongPanel); locationPanel.add(buttonPanel); locationPanel.add(new Label("Tip: once the map is visible, right-click a point on the map to indicate that" + " this is the precise location you want")); DisclosurePanel locationZippy = new DisclosurePanel("Location"); locationZippy.add(locationPanel); return locationZippy; }
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 va2s . co 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:com.google.livingstories.plugins.wordpress.livingstorypropertymanager.client.ui.LocationInput.java
License:Apache License
private Widget createLocationPanel(final Location location) { final VerticalPanel locationPanel = new VerticalPanel(); if (mapsKeyExists) { HorizontalPanel descriptionPanel = new HorizontalPanel(); descriptionPanel.add(new HTML("Location name (displayed to readers):")); locationDescriptionTextArea = new TextArea(); locationDescriptionTextArea.setName("lsp_location_description"); locationDescriptionTextArea.setCharacterWidth(50); locationDescriptionTextArea.setHeight("60px"); descriptionPanel.add(locationDescriptionTextArea); Label geocodingOptions = new Label("Geocode based on:"); useDisplayedLocation = new RadioButton("geoGroup", "The displayed location name"); useDisplayedLocation.setValue(true); useAlternateLocation = new RadioButton("geoGroup", "An alternate location that geocodes better: "); alternateTextBox = new TextBox(); alternateTextBox.setEnabled(false); HorizontalPanel alternatePanel = new HorizontalPanel(); alternatePanel.add(useAlternateLocation); alternatePanel.add(alternateTextBox); useManualLatLong = new RadioButton("geoGroup", "Manually entered latitude and longitude numbers (enter these below)"); HorizontalPanel latLongPanel = new HorizontalPanel(); latLongPanel.add(new HTML("Latitude: ")); latitudeTextBox = new TextBox(); latitudeTextBox.setEnabled(false); latLongPanel.add(latitudeTextBox); latLongPanel.add(new HTML(" Longitude: ")); longitudeTextBox = new TextBox(); longitudeTextBox.setName("lsp_longitude"); longitudeTextBox.setEnabled(false); latLongPanel.add(longitudeTextBox); // Hidden fields are needed to pass the value of the latitude and longitude text boxes to // the PHP code because the text boxes can be disabled. And if they are disabled, their // values can't be accessed. latitudeValue = new Hidden(); latitudeValue.setName("lsp_latitude"); longitudeValue = new Hidden(); longitudeValue.setName("lsp_longitude"); HorizontalPanel buttonPanel = new HorizontalPanel(); geocodeButton = new Button("Geocode location"); geocodeButton.setEnabled(false); buttonPanel.add(geocodeButton);/*from w w w. j av a 2 s. c om*/ geocoderStatus = new Label(""); buttonPanel.add(geocoderStatus); locationPanel.add(descriptionPanel); locationPanel.add(geocodingOptions); locationPanel.add(useDisplayedLocation); locationPanel.add(alternatePanel); locationPanel.add(useManualLatLong); locationPanel.add(latLongPanel); locationPanel.add(buttonPanel); locationPanel.add(new Label("Tip: once the map is visible, right-click a point on the map to" + " indicate that this is the precise location you want")); locationPanel.add(latitudeValue); locationPanel.add(longitudeValue); locationZippy = new DisclosurePanel("Location"); locationZippy.add(locationPanel); // show a map based on geocoded or manually-inputted lat-long combination AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setOtherParms(mapsKey + "&sensor=false"); AjaxLoader.loadApi("maps", "2", new Runnable() { @Override public void run() { mapsApiReady = true; map = new MapWidget(); map.setSize(MAP_WIDTH + "px", MAP_HEIGHT + "px"); map.addControl(new SmallMapControl()); map.setDoubleClickZoom(true); map.setDraggable(true); map.setScrollWheelZoomEnabled(true); map.setZoomLevel(MAP_ZOOM); map.setVisible(false); locationPanel.add(map); createLocationHandlers(); // Set the provided location on the map, if there is any setLocation(location); // Add handlers to re-center the map when the disclosure panel is toggled, because the // map has trouble centering if it's visibility is changed via the map. The handlers need // to be added here because we want to make sure that the map has been created before // adding the handlers. addDisclosurePanelHandlers(); } }, options); } else { Label noKeyLabel = new Label("Google Maps API key not available. Please specify in" + " the ClientConstants.properties file."); noKeyLabel.setStyleName(Resources.INSTANCE.css().error()); locationPanel.add(noKeyLabel); } return locationZippy; }
From source file:org.maps.client.Maps.java
License:Apache License
private void setUpMap() { LatLng cawkerCity = LatLng.newInstance(39.509, -98.434); // Open a map centered on Cawker City, KS USA MapOptions mapOptions = MapOptions.newInstance(); mapOptions.setDraggableCursor("default"); mapOptions.setDraggingCursor("move"); map = new MapWidget(cawkerCity, 3, mapOptions); map.setSize(MAP_WIDTH, MAP_HEIGHT);/*from w w w .j a v a2 s .c o m*/ map.setScrollWheelZoomEnabled(true); map.setDoubleClickZoom(false); // Add some controls for the zoom level map.addControl(new SmallMapControl()); refreshLayers(); MapClickHandler handler = new MapClickHandler() { public void onClick(MapClickEvent event) { if (event.getLatLng() != null) { handleMapClick(event.getLatLng()); } } }; map.addMapClickHandler(handler); }
From source file:org.onebusaway.webapp.gwt.agencies_map.AgenciesMap.java
License:Apache License
@Override public void onModuleLoad() { RootPanel panel = RootPanel.get("agencies_map"); if (panel == null) { System.out.println("you didn't include a div with the id of \"agencies_map\""); return;//from w ww . ja v a 2s . c o m } MapWidget map = new MapWidget(); map.addControl(new SmallMapControl()); map.addControl(new MapTypeControl()); map.addControl(new ScaleControl()); map.setScrollWheelZoomEnabled(true); panel.add(map); StyleInjector.inject(_css.getText()); WebappServiceAsync service = WebappServiceAsync.SERVICE; service.getAgencies(new AgencyHandler(map)); }
From source file:org.sigmah.client.page.entry.editor.MapFieldSet.java
License:Open Source License
private void addMap() { /* Create the map itself */ panel.removeAll();/*from ww w.j a v a 2 s. c om*/ map = new MapWidget(); panel.add(map); map.addControl(new SmallMapControl()); map.setCenter(LatLng.newInstance(country.getBounds().getCenterY(), country.getBounds().getCenterX())); map.setZoomLevel(6); MapType adminMap = MapTypeFactory.createLocalisationMapType(country); map.addMapType(adminMap); map.setCurrentMapType(adminMap); map.addMapZoomEndHandler(new MapZoomEndHandler() { public void onZoomEnd(MapZoomEndEvent event) { presenter.onMapViewChanged(createBounds(map.getBounds())); } }); map.addMapMoveEndHandler(new MapMoveEndHandler() { @Override public void onMoveEnd(MapMoveEndEvent mapMoveEndEvent) { presenter.onMapViewChanged(createBounds(map.getBounds())); } }); this.addListener(Events.AfterLayout, new Listener<ContainerEvent>() { @Override public void handleEvent(ContainerEvent be) { map.checkResizeAndCenter(); if (pendingZoom != null) { zoomToBounds(pendingZoom); } } }); layout(); }
From source file:org.sigmah.client.page.entry.SiteMap.java
License:Open Source License
private void loadMap() { status.setBusy(I18N.CONSTANTS.loadingGoogleMaps()); MapApiLoader.load(new MaskingAsyncMonitor(this, I18N.CONSTANTS.loadingComponent()), new AsyncCallback<Void>() { @Override/*from w w w . jav a 2s . com*/ public void onFailure(Throwable throwable) { removeAll(); setLayout(new CenterLayout()); add(new Html(I18N.CONSTANTS.connectionProblem())); layout(); } @Override public void onSuccess(Void result) { removeAll(); BoundingBoxDTO countryBounds = country.getBounds(); LatLng boundsFromActivity = LatLng.newInstance(countryBounds.getCenterY(), countryBounds.getCenterX()); map = new MapWidget(boundsFromActivity, 8); MapType adminMap = MapTypeFactory.createLocalisationMapType(country); map.addMapType(adminMap); map.setCurrentMapType(adminMap); map.addControl(new SmallMapControl()); setLayout(new FitLayout()); add(map); map.addMapClickHandler(new MapClickHandler() { @Override public void onClick(MapClickEvent event) { if (event.getOverlay() != null) { int siteId = siteIdFromOverlay(event.getOverlay()); highlightSite(siteId, false); } } }); map.addMapRightClickHandler(new MapRightClickHandler() { public void onRightClick(MapRightClickEvent event) { if (event.getOverlay() != null) { showContextMenu(event); } } }); // Listen for when this component is resized/layed out // to assure that map widget is properly restated Listener<BaseEvent> resizeListener = new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { map.checkResizeAndCenter(); if (pendingZoom != null) { zoomToBounds(pendingZoom); } } }; addListener(Events.AfterLayout, resizeListener); addListener(Events.Resize, resizeListener); new MapDropTarget(SiteMap.this); layout(); doLoadSites(); } }); }