Example usage for com.google.gwt.gdata.client.contacts ContactGroupEntry newInstance

List of usage examples for com.google.gwt.gdata.client.contacts ContactGroupEntry newInstance

Introduction

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

Prototype

public static native ContactGroupEntry newInstance() ;

Source Link

Document

Constructs a contact group entry.

Usage

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

License:Apache License

/**
 * Create a contact group by inserting a contact group entry into
 * a contact groups feed.//  w  w  w.  j  ava 2s . c  o m
 * Set the contact group's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Contacts-Client' so that
 * we can identify which groups were created by this demo.
 * On success and failure, display a status message.
 * 
 * @param contactGroupFeedUri The uri of the groups feed into which 
 * to insert the new group entry
 */
private void createContactGroup(String contactGroupFeedUri) {
    showStatus("Creating contact group...", false);
    ContactGroupEntry entry = ContactGroupEntry.newInstance();
    entry.setTitle(Text.newInstance());
    entry.getTitle().setText("GWT-Contacts-Client - Create Group");
    service.insertEntry(contactGroupFeedUri, entry, new ContactGroupEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating a contact group: " + caught.getMessage(), true);
        }

        public void onSuccess(ContactGroupEntry result) {
            showStatus("Created a contact group.", false);
        }
    });
}