Example usage for com.google.gwt.gdata.client.maps MapEntryCallback MapEntryCallback

List of usage examples for com.google.gwt.gdata.client.maps MapEntryCallback MapEntryCallback

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.maps MapEntryCallback MapEntryCallback.

Prototype

MapEntryCallback

Source Link

Usage

From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsCreateMapDemo.java

License:Apache License

/**
 * Create a map by inserting a map entry into
 * a maps feed./*w ww  .ja  v a 2s  .  c o  m*/
 * Set the map's title and contents to an arbitrary string. Here
 * we prefix the title with 'GWT-Maps-Client' so that
 * we can identify which maps were created by this demo.
 * On success and failure, display a status message.
 * 
 * @param mapsFeedUri The uri of the maps feed into which to
 * insert the new map entry
 */
private void createMap(String mapsFeedUri) {
    showStatus("Creating map...", false);
    MapEntry entry = MapEntry.newInstance();
    entry.setTitle(Text.newInstance());
    entry.getTitle().setText("GWT-Maps-Client - inserted map");
    service.insertEntry(mapsFeedUri, entry, new MapEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating a map: " + caught.getMessage(), true);
        }

        public void onSuccess(MapEntry result) {
            showStatus("Created a map.", false);
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsDeleteMapDemo.java

License:Apache License

/**
 * Delete a map entry using the Maps service and
 * the map entry uri./*from  w w w  . j  a  v  a2  s.c o m*/
 * On success and failure, display a status message.
 * 
 * @param mapEntryUri The uri of the map entry to delete
 */
private void deleteMap(String mapEntryUri) {
    showStatus("Deleting map...", false);
    service.deleteEntry(mapEntryUri, new MapEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the maps feed: " + caught.getMessage(), true);
        }

        public void onSuccess(MapEntry result) {
            showStatus("Deleted a map.", false);
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsUpdateMapDemo.java

License:Apache License

/**
 * Update a map by making use of the updateEntry
 * method of the Entry class./*w  ww .  j  av  a  2  s.co m*/
 * Set the map's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Maps-Client' so that
 * we can identify which maps were updated by this demo.
 * On success and failure, display a status message.
 * 
 * @param targetMap The map entry which to update
 */
private void updateMap(MapEntry targetMap) {
    showStatus("Updating map...", false);
    targetMap.setTitle(Text.newInstance());
    targetMap.getTitle().setText("GWT-Maps-Client - updated map");
    targetMap.updateEntry(new MapEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while updating a map: " + caught.getMessage(), true);
        }

        public void onSuccess(MapEntry result) {
            showStatus("Updated a map.", false);
        }
    });
}