Example usage for com.google.gwt.gdata.client.contacts ContactGroupEntryCallback ContactGroupEntryCallback

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

Introduction

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

Prototype

ContactGroupEntryCallback

Source Link

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 ww  . j  a v  a 2s. co 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.ContactsDeleteContactGroupDemo.java

License:Apache License

/**
 * Delete a contact group entry using the Contacts service and
 * the contact group entry uri.//from w  ww  .j a  v a  2s  .  co  m
 * On success and failure, display a status message.
 * 
 * @param contactGroupEntryUri The uri of the contact group entry to delete
 * @param etag The etag of the entry to delete
 */
private void deleteContactGroup(String contactGroupEntryUri, String etag) {
    showStatus("Deleting a contact group...", false);
    GDataRequestParameters pars = GDataRequestParameters.newInstance();
    pars.setEtag(etag);
    service.deleteEntry(contactGroupEntryUri, new ContactGroupEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while deleting a contact group: " + caught.getMessage(), true);
        }

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

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.//from  w w  w  . ja 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);
        }
    });
}