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

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

Introduction

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

Prototype

MapFeedCallback

Source Link

Usage

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  www  .  j a v  a2s  .  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.MapsDeleteMapDemo.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./*  w  w  w  .  j a  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 deleteMap to
 * delete 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.getSelfLink().getHref();
                deleteMap(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 ava2  s .  co 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);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsRetrieveMapsDemo.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.//  w w  w.j  a v a2 s.  c o  m
 * Here, the failure handler displays an error message while the
 * success handler calls showData to display the map entries.
 * 
 * @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();
            if (entries.length == 0) {
                showStatus("You have no maps.", false);
            } else {
                showData(entries);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsUpdateMapDemo.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./*w w w  .j  a  va2  s . co 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 updateMap to
 * update the map entry.
 * 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 {
                updateMap(targetMap);
            }
        }
    });
}