List of usage examples for com.google.gwt.gdata.client.maps MapEntry getId
public final native Id getId() ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsCreateMapFeatureDemo.java
License:Apache License
/** * Retrieve the maps feed using the Maps service and * the maps feed uri. In GData all get, insert, update * and delete methods always receive a callback defining * success and failure handlers./*from w ww. ja v a 2 s.c o m*/ * Here, the failure handler displays an error message while the * success handler obtains the first map entry with a title * starting with "GWT-Maps-Client" and calls insertMapFeature to * insert a map feature into the map. * If no map is found, a message is displayed. * * @param mapsFeedUri The uri of the map feed */ private void getMaps(String mapsFeedUri) { showStatus("Loading maps feed...", false); service.getMapFeed(mapsFeedUri, new MapFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the maps feed: " + caught.getMessage(), true); } public void onSuccess(MapFeed result) { MapEntry[] entries = result.getEntries(); MapEntry targetMap = null; for (MapEntry entry : entries) { if (entry.getTitle().getText().startsWith("GWT-Maps-Client")) { targetMap = entry; break; } } if (targetMap == null) { showStatus("No map found that contains 'GWT-Maps-Client' in the title.", false); } else { String mapEntryUri = targetMap.getId().getValue(); insertMapFeature(mapEntryUri); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsDeleteMapFeatureDemo.java
License:Apache License
/** * Retrieve the maps feed using the Maps service and * the maps feed uri./*from w w w . j a va 2s .c o m*/ * Here, the failure handler displays an error message while the * success handler obtains the first map entry with a title * starting with "GWT-Maps-Client" and calls getFeatures to * retrieve the map's features. * If no map is found, a message is displayed. * * @param mapsFeedUri The uri of the map feed */ private void getMaps(String mapsFeedUri) { showStatus("Loading maps feed...", false); service.getMapFeed(mapsFeedUri, new MapFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the maps feed: " + caught.getMessage(), true); } public void onSuccess(MapFeed result) { MapEntry[] entries = result.getEntries(); MapEntry targetMap = null; for (MapEntry entry : entries) { if (entry.getTitle().getText().startsWith("GWT-Maps-Client")) { targetMap = entry; break; } } if (targetMap == null) { showStatus("No map found that contains 'GWT-Maps-Client' in the title.", false); } else { String mapEntryUri = targetMap.getId().getValue(); getFeatures(mapEntryUri); } } }); }