List of usage examples for com.google.gwt.maps.client.overlay MarkerOptions setClickable
public final native void setClickable(boolean clickable) ;
From source file:com.claudiushauptmann.gwt.maps.gxt.samples.client.OverlayEditor.java
License:Apache License
public void onModuleLoad() { // Map// www .j a v a 2 s .c o m mapWidget = new MapWidget(); mapWidget.setCenter(LatLng.newInstance(48.136559, 11.576318), 13); mapWidget.setWidth("100%"); mapWidget.setHeight("100%"); mapWidget.addControl(new LargeMapControl()); mapWidget.setContinuousZoom(true); mapWidget.setScrollWheelZoomEnabled(true); RootPanel.get().add(mapWidget); // MapController mapGxtController = new MapGXTController(mapWidget); mapMenuProvider = new MapMenuProvider(); mapGxtController.setMenuProvider(mapMenuProvider); // Marker MarkerOptions mo = MarkerOptions.newInstance(); mo.setClickable(true); mo.setDraggable(true); Marker marker = new Marker(mapWidget.getCenter(), mo); mapWidget.addOverlay(marker); new MyMarkerEditController(mapGxtController, marker, "Marienplatz", "Marienplatz is a central square in the" + " city center of Munich, Germany since 1158.<br/>" + " In the Middle Ages markets and tournaments were held in this" + " city square. The Glockenspiel in the new city hall was inspired" + " by these tournaments, and draws millions of tourists a year."); // Polyline LatLng[] llline = new LatLng[3]; llline[0] = LatLng.newInstance(48.131955, 11.527061); llline[1] = LatLng.newInstance(48.11809, 11.579247); llline[2] = LatLng.newInstance(48.127143, 11.638298); PolylineOptions plo = PolylineOptions.newInstance(true, false); Polyline line = new Polyline(llline, "#FF0000", 2, 1.0, plo); mapWidget.addOverlay(line); new MyPolylineEditController(mapGxtController, line, "Polyline", "This is a polyline."); // Polygon LatLng[] llpolygon = new LatLng[4]; llpolygon[0] = LatLng.newInstance(48.119809, 11.539936); llpolygon[1] = LatLng.newInstance(48.158185, 11.541138); llpolygon[2] = LatLng.newInstance(48.155894, 11.569118); llpolygon[3] = llpolygon[0]; PolygonOptions pgo = PolygonOptions.newInstance(true); Polygon polygon = new Polygon(llpolygon, "#0000FF", 2, 1.0, "#0000FF", 0.3, pgo); mapWidget.addOverlay(polygon); new MyPolygonEditController(mapGxtController, polygon, "Polygon", "This is a polygon."); }
From source file:com.mashery.examples.api.client.ActiveExample.java
License:Open Source License
public ActiveExample(final PopupMapWidget mapWidget) { FlowPanel panel = new FlowPanel(); panel.add(new HTML("<h1>Search</h1>")); FormPanel form = new FormPanel(); panel.add(form);// w w w . j av a 2s. co m FlexTable entryGrid = new FlexTable(); form.add(entryGrid); FlexTable.FlexCellFormatter formatter = (FlexCellFormatter) entryGrid.getCellFormatter(); entryGrid.setWidget(0, 0, new Label("Keywords:")); formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); final TextBox keywordsText = new TextBox(); entryGrid.setWidget(0, 1, keywordsText); keywordsText.setWidth("200px"); entryGrid.setWidget(1, 0, new Label("Location:")); formatter.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); final TextBox locationText = new TextBox(); entryGrid.setWidget(1, 1, locationText); locationText.setWidth("200px"); Anchor fromMapLink = new Anchor("<- from Map"); final Geocoder geocoder = new Geocoder(); fromMapLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { mapWidget.show(); HasLatLng center = mapWidget.getMap().getCenter(); GeocoderRequest request = new GeocoderRequest(); request.setLatLng(center); geocoder.geocode(request, new GeocoderCallback() { @Override public void callback(List<HasGeocoderResult> responses, String status) { if (responses != null) { String postalCode = null; String country = null; RESULTS: for (HasGeocoderResult result : responses) { if (result.getTypes().contains("postal_code")) { for (HasAddressComponent addr : result.getAddressComponents()) { if (postalCode == null && addr.getTypes().contains("postal_code")) postalCode = addr.getLongName(); if (country == null && addr.getTypes().contains("country")) country = addr.getLongName(); if (postalCode != null && country != null) break RESULTS; } } } if (postalCode != null) { if (country == null) locationText.setText(postalCode); else locationText.setText(postalCode + ", " + country); } } } }); } }); entryGrid.setWidget(1, 2, fromMapLink); SubmitButton submitButton = new SubmitButton("Search"); entryGrid.setWidget(2, 0, submitButton); formatter.setColSpan(2, 0, 3); formatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); final SearchResultsTable table = new SearchResultsTable(10); panel.add(table); table.setWidth("500px"); form.addSubmitHandler(new FormPanel.SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { String keywords = keywordsText.getValue().trim(); String location = locationText.getValue().trim(); table.loadData(keywords.length() == 0 ? null : keywords, location.length() == 0 ? null : location); event.cancel(); } }); infoPanel = new PopupPanel(true); infoPanel.setAutoHideOnHistoryEventsEnabled(true); infoGrid = new FlexTable(); infoPanel.setWidget(infoGrid); FlowPanel linkPanel = new FlowPanel(); infoGrid.setWidget(3, 0, linkPanel); Anchor mapLink = new Anchor("Map", "#"); linkPanel.add(mapLink); mapLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); if (selectedResult == null) return; Meta meta = selectedResult.getMeta(); if (meta == null) { Window.alert("No location available."); return; } MarkerOptions opt = new MarkerOptions(); if (meta.getAssetName() != null) opt.setTitle(meta.getAssetName().trim()); opt.setPosition(new LatLng(meta.getLatitude(), meta.getLongitude())); opt.setClickable(true); opt.setVisible(true); mapWidget.show(new Marker(opt)); } }); mapWidget.addAutoHidePartner(mapLink.getElement()); linkPanel.add(new InlineHTML(" | ")); linkPanel.add(visitLink = new Anchor("Visit", "#")); ((FlexTable.FlexCellFormatter) infoGrid.getCellFormatter()).setColSpan(1, 0, 2); ((FlexTable.FlexCellFormatter) infoGrid.getCellFormatter()).setColSpan(2, 0, 2); ((FlexTable.FlexCellFormatter) infoGrid.getCellFormatter()).setColSpan(3, 0, 2); initWidget(new ScrollPanel(panel)); }
From source file:com.mashery.examples.api.client.EtsyExample.java
License:Open Source License
public EtsyExample(final PopupMapWidget mapWidget) { AbsolutePanel rootPanel = new AbsolutePanel(); rootPanel.setSize("100%", "100%"); SplitLayoutPanel panel = new SplitLayoutPanel(); rootPanel.add(panel);/*from w w w . j av a2 s .co m*/ panel.setHeight("100%"); FlowPanel topPanel = new FlowPanel(); panel.addNorth(topPanel, 250d); topPanel.add(new HTML("<h1>Featured Listings</h1>")); dragController = new PickupDragController(rootPanel, false); dragController.setBehaviorDragProxy(true); dragController.setBehaviorMultipleSelection(false); dragController.setBehaviorDragStartSensitivity(2); featuredListingsTable = new FeaturedListingsTable(20); topPanel.add(new ScrollPanel(featuredListingsTable)); DockLayoutPanel bottomPanelContainer = new DockLayoutPanel(Unit.PX); panel.add(bottomPanelContainer); bottomPanelContainer.addNorth(new HTML("<h1>Favorite Listings</h1>"), 50d); bottomPanel = new DeckPanel(); bottomPanelContainer.add(bottomPanel); bottomPanel.add(new HTML("Obtaining your Etsy account information...")); favoriteListingsTable = new FavoriteListingsTable(20); dropController = new SimpleDropController(favoriteListingsTable) { public void onDrop(DragContext context) { Image img = (Image) context.draggable; String id = img.getElement().getId(); if (id != null && id.startsWith("listing_")) { try { int listingId = Integer.parseInt(id.substring("listing_".length())); favoriteListingsTable.createUserFavoriteListing(listingId); } catch (NumberFormatException e) { GWT.log("Unable to parse listing id.", e); } } } }; dragController.registerDropController(dropController); FlowPanel userPanel = new FlowPanel(); userPanel.add(userLabel = new InlineHTML()); userPanel.add(new InlineHTML(" ")); Anchor disconnectLink = new Anchor("Disconnect", "#"); userPanel.add(disconnectLink); disconnectLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); disconnectEtsyAccount(); } }); userPanel.add(new InlineHTML(" | ")); Anchor mapProfileLink = new Anchor("Map Profile", "#"); userPanel.add(mapProfileLink); mapProfileLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); if (user != null) { UserProfile profile = user.getProfile(); if (profile != null) { MarkerOptions opt = new MarkerOptions(); opt.setTitle(profile.getLoginName()); opt.setPosition(new LatLng(profile.getLat(), profile.getLon())); opt.setClickable(true); opt.setVisible(true); mapWidget.show(new Marker(opt)); } } } }); mapWidget.addAutoHidePartner(mapProfileLink.getElement()); userPanel.add(new HTML()); userPanel.add(favoriteListingsTable); bottomPanel.add(new ScrollPanel(userPanel)); bottomPanel.add(new HTML("You must be logged in in order to manage your favorite listings.")); bottomPanel.add(createOAuthPanel()); etsySvc = GWT.create(EtsyService.class); infoPanel = new PopupPanel(true); infoPanel.setAutoHideOnHistoryEventsEnabled(true); infoGrid = new Grid(2, 1); infoPanel.setWidget(infoGrid); infoGrid.setWidth("240px"); mapListingLink = new Anchor("Map", "#"); mapListingLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); if (selectedListing == null) return; Shop shop = selectedListing.getShop(); if (shop == null) { Window.alert("No shop information available."); return; } if (!shop.hasLatLon()) { Window.alert("No location information available."); return; } MarkerOptions opt = new MarkerOptions(); opt.setTitle(shop.getShopName()); opt.setPosition(new LatLng(shop.getLat(), shop.getLon())); opt.setClickable(true); opt.setVisible(true); mapWidget.show(new Marker(opt)); } }); mapWidget.addAutoHidePartner(mapListingLink.getElement()); deleteFavListingLink = new Anchor("Delete", "#"); deleteFavListingLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); favoriteListingsTable.deleteUserFavoriteListing(selectedListing.getListingId()); infoPanel.hide(); } }); initWidget(rootPanel); bottomPanel.showWidget(0); }
From source file:com.mashery.examples.api.client.HotwireExample.java
License:Open Source License
public HotwireExample(final PopupMapWidget mapWidget) { FlowPanel panel = new FlowPanel(); panel.add(new HTML("<h1>Hotel Deals</h1>")); FormPanel form = new FormPanel(); panel.add(form);/*w w w .ja va 2 s . c o m*/ FlexTable entryGrid = new FlexTable(); form.add(entryGrid); FlexTable.FlexCellFormatter formatter = (FlexCellFormatter) entryGrid.getCellFormatter(); entryGrid.setWidget(0, 0, new Label("Destination:")); formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); FlowPanel destPanel = new FlowPanel(); entryGrid.setWidget(0, 1, destPanel); formatter.setColSpan(0, 1, 5); final TextBox destText = new TextBox(); destPanel.add(destText); destText.setWidth("220px"); Anchor fromMapLink = new Anchor("<- from Map"); fromMapLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { HasLatLng center = mapWidget.getMap().getCenter(); destText.setText(center.getLatitude() + "," + center.getLongitude()); } }); destPanel.add(new InlineHTML(" ")); destPanel.add(fromMapLink); entryGrid.setWidget(1, 0, new Label("From:")); formatter.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); final TextBox startDateText = new TextBox(); entryGrid.setWidget(1, 1, startDateText); startDateText.setWidth("100px"); final PopupPanel startDatePanel = new PopupPanel(true); startDatePanel.setAutoHideOnHistoryEventsEnabled(true); final ToggleButton startDateButton = new ToggleButton(new Image("resources/img/date-picker.gif")); entryGrid.setWidget(1, 2, startDateButton); startDateButton.setPixelSize(16, 16); startDatePanel.addAutoHidePartner(startDateButton.getElement()); startDateButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { startDatePanel.showRelativeTo(startDateButton); } }); startDatePanel.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { startDateButton.setDown(false); } }); final DateTimeFormat dateFormat = DateTimeFormat.getFormat("MM/dd/yyyy"); final DatePicker startDatePicker = new DatePicker(); startDatePanel.setWidget(startDatePicker); startDatePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { startDateText.setText(dateFormat.format(event.getValue())); startDatePanel.hide(); } }); startDateText.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { try { Date date = dateFormat.parse(event.getValue()); startDatePicker.setValue(date); } catch (IllegalArgumentException e) { // ignore } } }); Date date = new Date(); startDatePicker.setValue(date, true); entryGrid.setWidget(1, 3, new Label("To:")); formatter.setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_RIGHT); final TextBox endDateText = new TextBox(); entryGrid.setWidget(1, 4, endDateText); endDateText.setWidth("100px"); final PopupPanel endDatePanel = new PopupPanel(true); endDatePanel.setAutoHideOnHistoryEventsEnabled(true); final ToggleButton endDateButton = new ToggleButton(new Image("resources/img/date-picker.gif")); entryGrid.setWidget(1, 5, endDateButton); endDateButton.setPixelSize(16, 16); endDatePanel.addAutoHidePartner(endDateButton.getElement()); endDateButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { endDatePanel.showRelativeTo(endDateButton); } }); endDatePanel.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { endDateButton.setDown(false); } }); final DatePicker endDatePicker = new DatePicker(); endDatePanel.setWidget(endDatePicker); endDatePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { endDateText.setText(dateFormat.format(event.getValue())); endDatePanel.hide(); } }); endDateText.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { try { Date date = dateFormat.parse(event.getValue()); endDatePicker.setValue(date); } catch (IllegalArgumentException e) { // ignore } } }); date = CalendarUtil.copyDate(date); CalendarUtil.addDaysToDate(date, 1); endDatePicker.setValue(date, true); SubmitButton submitButton = new SubmitButton("Search"); entryGrid.setWidget(2, 0, submitButton); formatter.setColSpan(2, 0, 6); formatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); final HotelDealsTable table = new HotelDealsTable(10); panel.add(table); table.setWidth("500px"); form.addSubmitHandler(new FormPanel.SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { String dest = destText.getValue().trim(); String start = startDateText.getValue().trim(); String end = endDateText.getValue().trim(); table.loadData(dest.length() == 0 ? null : dest, start.length() == 0 ? null : start, end.length() == 0 ? null : end); event.cancel(); } }); infoPanel = new PopupPanel(true); infoPanel.setAutoHideOnHistoryEventsEnabled(true); infoGrid = new FlexTable(); infoPanel.setWidget(infoGrid); FlowPanel linkPanel = new FlowPanel(); infoGrid.setWidget(3, 0, linkPanel); Anchor mapLink = new Anchor("Map", "#"); linkPanel.add(mapLink); mapLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); if (selectedResult == null) return; MarkerOptions opt = new MarkerOptions(); opt.setTitle(selectedResult.getHeadline()); LatLng latLng = new LatLng(selectedResult.getNeighborhoodLatitude(), selectedResult.getNeighborhoodLongitude()); opt.setPosition(latLng); opt.setClickable(true); opt.setVisible(true); mapWidget.show(new Marker(opt)); } }); mapWidget.addAutoHidePartner(mapLink.getElement()); linkPanel.add(new InlineHTML(" | ")); linkPanel.add(visitLink = new Anchor("Visit", "#")); initWidget(new ScrollPanel(panel)); }
From source file:com.mashery.examples.api.client.QuovaExample.java
License:Open Source License
public QuovaExample(final PopupMapWidget mapWidget) { FlowPanel panel = new FlowPanel(); panel.add(new HTML("<h1>IP Info</h1>")); FormPanel entryForm = new FormPanel(); panel.add(entryForm);/* w ww .ja v a 2s.com*/ Grid entryPanel = new Grid(1, 3); entryForm.setWidget(entryPanel); entryPanel.setWidget(0, 0, new Label("IP Address:")); entryPanel.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE); addressText = new TextBox(); entryPanel.setWidget(0, 1, addressText); addressText.setWidth("150px"); entryPanel.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); submitButton = new SubmitButton("Look Up"); entryPanel.setWidget(0, 2, submitButton); entryPanel.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE); final IPInfoServiceAsync ipInfoSvc = GWT.create(IPInfoService.class); entryForm.addSubmitHandler(new FormPanel.SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { addressText.setReadOnly(true); submitButton.setEnabled(false); String value = addressText.getText().trim(); lookupIPInfo(ipInfoSvc, value.length() == 0 ? null : value); event.cancel(); } }); panel.add(new HTML("<em>Note: Leave blank to use your auto-detected IP address.</em>")); panel.add(new HTML()); generalTable = new FlexTable(); panel.add(generalTable); FlexTable.FlexCellFormatter formatter = (FlexCellFormatter) generalTable.getCellFormatter(); int row = -1; formatter.setWidth(0, 0, "160px"); generalTable.setText(++row, 0, "IP Address:"); generalTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); generalTable.setText(++row, 0, "IP Type:"); generalTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); generalTable.setText(++row, 0, "Anonymizer Status:"); generalTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); for (int i = 0, n = generalTable.getRowCount(); i < n; ++i) formatter.getElement(i, 0).getStyle().setFontWeight(FontWeight.BOLD); DisclosurePanel networkPanel = new DisclosurePanel("Network"); panel.add(networkPanel); networkPanel.setAnimationEnabled(true); networkTable = new FlexTable(); networkPanel.setContent(networkTable); formatter = (FlexCellFormatter) networkTable.getCellFormatter(); row = -1; formatter.setWidth(0, 0, "144px"); networkTable.setText(++row, 0, "Organization:"); networkTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); networkTable.setText(++row, 0, "Carrier:"); networkTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); networkTable.setText(++row, 0, "ASN:"); networkTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); networkTable.setText(++row, 0, "Connection Type:"); networkTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); networkTable.setText(++row, 0, "Line Speed:"); networkTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); networkTable.setText(++row, 0, "IP Routing Type:"); networkTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); networkTable.setText(++row, 0, "Domain:"); networkTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); for (int i = 0, n = networkTable.getRowCount(); i < n; ++i) formatter.getElement(i, 0).getStyle().setFontWeight(FontWeight.BOLD); locationPanel = new DisclosurePanel("Location"); panel.add(locationPanel); locationPanel.setAnimationEnabled(true); locationTable = new FlexTable(); locationPanel.setContent(locationTable); formatter = (FlexCellFormatter) locationTable.getCellFormatter(); row = -1; formatter.setWidth(0, 0, "144px"); locationTable.setText(++row, 0, "Continent:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "Country:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "Region:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "State:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "DMA:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "MSA:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "City:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "Postal Code:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "Time Zone:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "Area Code:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "Latitude:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); locationTable.setText(++row, 0, "Longitude:"); locationTable.setText(row, 1, ""); formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); for (int i = 0, n = locationTable.getRowCount(); i < n; ++i) formatter.getElement(i, 0).getStyle().setFontWeight(FontWeight.BOLD); mapButton = new Button("Locate on Map", new ClickHandler() { @Override public void onClick(ClickEvent event) { MarkerOptions opt = new MarkerOptions(); opt.setTitle(result.getIpAddress()); opt.setPosition(new LatLng(result.getLatitude(), result.getLongitude())); opt.setClickable(true); opt.setVisible(true); mapWidget.show(new Marker(opt)); } }); mapButton.setEnabled(false); locationTable.setWidget(++row, 0, mapButton); formatter.setColSpan(row, 0, 2); // formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); initWidget(new ScrollPanel(panel)); }
From source file:org.onebusaway.webapp.gwt.oba_application.view.ResultsTablePresenter.java
License:Apache License
private Marker getMarker(int index, LocalSearchResult entry) { ImageResource resource = getMarkerResource(index); Icon icon = Icon.newInstance(resource.getURL()); icon.setIconSize(Size.newInstance(24, 31)); icon.setIconAnchor(Point.newInstance(12, 31)); MarkerOptions opts = MarkerOptions.newInstance(); opts.setClickable(true); opts.setIcon(icon);/*w w w . ja va 2 s . co m*/ LatLng point = LatLng.newInstance(entry.getLat(), entry.getLon()); return new Marker(point, opts); }
From source file:org.opennms.features.poller.remote.gwt.client.GoogleMapsPanel.java
License:Open Source License
private Marker createMarker(final GWTMarkerState marker) { final Icon icon = Icon.newInstance(); icon.setIconSize(Size.newInstance(32, 32)); icon.setIconAnchor(Point.newInstance(16, 32)); String markerImageURL = marker.getImageURL(); icon.setImageURL(markerImageURL);/*from w w w . j av a 2 s .c o m*/ final MarkerOptions markerOptions = MarkerOptions.newInstance(); markerOptions.setAutoPan(true); markerOptions.setClickable(true); markerOptions.setTitle(marker.getName()); markerOptions.setIcon(icon); Marker m = new Marker(toLatLng(marker.getLatLng()), markerOptions); m.setVisible(marker.isVisible()); m.addMarkerClickHandler(new DefaultMarkerClickHandler(marker)); return m; }