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

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

Introduction

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

Prototype

public final native void setTitle(Text title) ;

Source Link

Document

Sets 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 ww  w. j a v a2  s  . 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.MapsUpdateMapDemo.java

License:Apache License

/**
 * Update a map by making use of the updateEntry
 * method of the Entry class.//from  w  w w.j a v a2  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);
        }
    });
}