List of usage examples for com.google.gwt.gdata.client.maps FeatureEntry getTitle
public final native Text getTitle() ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsCreateMapFeatureDemo.java
License:Apache License
/** * Create a feature by inserting a feature entry into * a feature feed for a given map.//from w w w .j a v a 2 s . c o m * Set the feature's title to an arbitrary string. Here * we prefix the title with 'GWT-Maps-Client' so that * we can identify which features were created by this demo. * A value is also provided for the feature's postal address * along with the KML content which defines the placemarks * for this feature. * On success and failure, display a status message. * * @param mapId The id of the map into which to insert the * new feature entry */ private void insertMapFeature(String mapId) { showStatus("Creating map feature...", false); FeatureEntry entry = FeatureEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-Maps-Client - inserted feature"); PostalAddress address = PostalAddress.newInstance(); address.setLabel("Google Headquarters"); address.setRel(PostalAddress.REL_WORK); address.setValue("1600 Amphitheatre Parkway\nMountain View, CA 94043"); entry.setPostalAddress(address); KmlContent kml = KmlContent.newInstance(); kml.setType(KmlContent.TYPE_APPLICATION_VND_GOOGLE_EARTH_KML_XML); kml.setText("<Placemark xmlns=\"http://www.opengis.net/kml/2.2\">" + "<name>Faulkner's Birthplace</name>" + "<description/><Point><coordinates>-89.520753,34.360902,0.0" + "</coordinates></Point><" + "/Placemark>"); entry.setContent(kml); String featuresFeedUri = mapId.replace("/feeds/maps/", "/feeds/features/") + "/full"; service.insertEntry(featuresFeedUri, entry, new FeatureEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating a map feature: " + caught.getMessage(), true); } public void onSuccess(FeatureEntry result) { showStatus("Created a map feature.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsDeleteMapFeatureDemo.java
License:Apache License
/** * Retrieve the features feed for a given map using the * Maps service and the features feed uri. * In GData all get, insert, update and delete methods always * receive a callback defining success and failure handlers. * Here, the failure handler displays an error message while the * success handler obtains the first feature entry with a title * starting with "GWT-Maps-Client" and calls deleteFeature to * delete the feature./*from www. j a v a 2s . c om*/ * If no feature is found, a message is displayed. * * @param mapEntryUri The uri of the map entry for which to * retrieve the features feed */ private void getFeatures(String mapEntryUri) { String featuresFeedUri = mapEntryUri.replace("/feeds/maps/", "/feeds/features/") + "/full"; showStatus("Loading features feed...", false); service.getFeatureFeed(featuresFeedUri, new FeatureFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the features feed: " + caught.getMessage(), true); } public void onSuccess(FeatureFeed result) { FeatureEntry[] entries = result.getEntries(); FeatureEntry targetFeature = null; for (FeatureEntry entry : entries) { if (entry.getTitle().getText().startsWith("GWT-Maps-Client")) { targetFeature = entry; break; } } if (targetFeature == null) { showStatus("No map feature found that contains 'GWT-Maps-Client' " + "in the title.", false); } else { String featureEntryUri = targetFeature.getSelfLink().getHref(); deleteFeature(featureEntryUri); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsRetrieveMapFeaturesDemo.java
License:Apache License
/** * Displays a set of Google Maps feature entries in a tabular * fashion with the help of a GWT FlexTable widget. The data fields * Title and Address are displayed.// ww w . j a va 2 s .c o m * * @param entries The Google Maps feature entries to display. */ private void showData(FeatureEntry[] entries) { mainPanel.clear(); String[] labels = new String[] { "Title", "Address" }; mainPanel.insertRow(0); for (int i = 0; i < labels.length; i++) { mainPanel.addCell(0); mainPanel.setWidget(0, i, new Label(labels[i])); mainPanel.getFlexCellFormatter().setStyleName(0, i, "hm-tableheader"); } for (int i = 0; i < entries.length; i++) { FeatureEntry entry = entries[i]; int row = mainPanel.insertRow(i + 1); mainPanel.addCell(row); mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText())); mainPanel.addCell(row); String address = ""; if (entry.getPostalAddress() != null) { address = entry.getPostalAddress().getValue(); } mainPanel.setWidget(row, 1, new Label(address)); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsUpdateMapFeatureDemo.java
License:Apache License
/** * Retrieve the features feed for a given map using the * Maps service and the features feed uri. * In GData all get, insert, update and delete methods always * receive a callback defining success and failure handlers. * Here, the failure handler displays an error message while the * success handler obtains the first feature entry with a title * starting with "GWT-Maps-Client" and calls updateFeature to * update the feature entry./*from w w w .ja v a 2 s. c om*/ * If no feature is found, a message is displayed. * * @param mapEntryUri The uri of the map entry for which to * retrieve the features feed */ private void getFeatures(String mapEntryUri) { String featuresFeedUri = mapEntryUri.replace("/feeds/maps/", "/feeds/features/") + "/full"; showStatus("Loading features feed...", false); service.getFeatureFeed(featuresFeedUri, new FeatureFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the features feed: " + caught.getMessage(), true); } public void onSuccess(FeatureFeed result) { FeatureEntry[] entries = result.getEntries(); FeatureEntry targetFeature = null; for (FeatureEntry entry : entries) { if (entry.getTitle().getText().startsWith("GWT-Maps-Client")) { targetFeature = entry; break; } } if (targetFeature == null) { showStatus("No map feature found that contains 'GWT-Maps-Client' " + "in the title.", false); } else { updateFeature(targetFeature); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsUpdateMapFeatureDemo.java
License:Apache License
/** * Update a map feature by making use of the updateEntry * method of the Entry class.//from w w w . j av a 2 s .co m * Set the feature's title to an arbitrary string. Here * we prefix the title with 'GWT-Maps-Client' so that * we can identify which features were updated by this demo. * On success and failure, display a status message. * * @param targetFeature The feature entry which to update */ private void updateFeature(FeatureEntry targetFeature) { showStatus("Updating map feature...", false); targetFeature.setTitle(Text.newInstance()); targetFeature.getTitle().setText("GWT-Maps-Client - updated feature"); targetFeature.updateEntry(new FeatureEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating a map feature: " + caught.getMessage(), true); } public void onSuccess(FeatureEntry result) { showStatus("Updated a map feature.", false); } }); }