Example usage for com.google.gwt.gdata.client.maps MapEntry getTitle

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

Introduction

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

Prototype

public final native Text getTitle() ;

Source Link

Document

Returns the title.

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.//from   w  w w  .j ava 2s. com
 * 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.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 a2 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.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./*from w  w w  . ja v a  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 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 ww .j av 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 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

/**
* Displays a set of Google Maps map entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields 
* Title and Updated are displayed.//from  w w  w  .jav  a  2  s.c  o  m
* 
* @param entries The Google Maps map entries to display.
*/
private void showData(MapEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "Updated" };
    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++) {
        MapEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 1, new Label(entry.getPublished().getValue().getDate().toString()));
    }
}

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 av  a 2 s  . c om*/
 * 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);
            }
        }
    });
}

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.//from www .  j a v  a2s. c o  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);
        }
    });
}