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

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

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.contacts ContactGroupEntry 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.ContactsCreateContactGroupDemo.java

License:Apache License

/**
 * Create a contact group by inserting a contact group entry into
 * a contact groups feed.//from   www.  j a  va 2 s  .  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);
        }
    });
}

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

License:Apache License

/**
 * Update a contact group by making use of the updateEntry
 * method of the Entry class./* ww  w .j  a  v  a 2  s  . co  m*/
 * Set the group's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Contacts-Client' so that
 * we can identify which groups were updated by this demo.
 * On success and failure, display a status message.
 * 
 * @param targetGroup The contact group entry which to update
 */
private void updateContactGroup(ContactGroupEntry targetGroup) {
    showStatus("Updating a contact group...", false);
    targetGroup.setTitle(Text.newInstance());
    targetGroup.getTitle().setText("GWT-Contacts-Client - updated group");
    targetGroup.updateEntry(new ContactGroupEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while updating a contact group: " + caught.getMessage(), true);
        }

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