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

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

Introduction

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

Prototype

public static native MapEntry newInstance() ;

Source Link

Document

Constructs a map entry.

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  a v a2s . 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);
        }
    });
}