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

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

Introduction

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

Prototype

ContactGroupFeedCallback

Source Link

Usage

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

License:Apache License

/**
 * Retrieve the contact groups feed using the Contacts service and
 * the contact groupd feed uri./*from   ww w . ja v a 2 s  .  c om*/
 * On success, identify the first group entry with a title starting
 * with "GWT-Contacts-Client", this is the group that will be deleted.
 * If no contact group is found, display a message.
 * Otherwise call deleteContactGroup to delete the group entry.
 * Alternatively we could also have used deleteContactGroup.deleteEntry to
 * delete the contact group, but the effect is the same.
 * 
 * @param contactGroupsFeedUri The contact groups feed uri
 */
private void getContactGroups(String contactGroupsFeedUri) {
    showStatus("Loading contact groups feed...", false);
    service.getContactGroupFeed(contactGroupsFeedUri, new ContactGroupFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the contact groups " + "feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(ContactGroupFeed result) {
            ContactGroupEntry[] entries = result.getEntries();
            ContactGroupEntry targetGroup = null;
            for (ContactGroupEntry group : entries) {
                String title = group.getTitle().getText();
                if (title.startsWith("GWT-Contacts-Client")) {
                    targetGroup = group;
                    break;
                }
            }
            if (targetGroup == null) {
                showStatus("No contacts were found with a title starting with " + "'GWT-Contacts-Client'.",
                        false);
            } else {
                String contactGroupEntryUri = targetGroup.getEditLink().getHref();
                deleteContactGroup(contactGroupEntryUri, targetGroup.getEtag());
            }
        }
    });
}

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

License:Apache License

/**
 * Retrieve the contact groups feed using the Contacts service and
 * the contacts feed uri. In GData all get, insert, update and delete methods
 * always receive a callback defining success and failure handlers.
 * Here, the failure handler displays an error message while the
 * success handler obtains the first group entry and
 * calls queryContacts to retrieve the contacts feed for that group.
 * // w w w . jav a2  s.c  o m
 * @param contactGroupsFeedUri The contact groups feed uri
 */
private void getContactGroups(String contactGroupsFeedUri) {
    showStatus("Loading contact groups feed...", false);
    service.getContactGroupFeed(contactGroupsFeedUri, new ContactGroupFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the contact groups " + "feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(ContactGroupFeed result) {
            ContactGroupEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("You have no contact groups.", false);
            } else {
                ContactGroupEntry targetGroup = entries[0];
                String groupId = targetGroup.getId().getValue();
                queryContacts(groupId);
            }
        }
    });
}

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

License:Apache License

/**
 * Retrieve the contact groups feed using the Contacts service and
 * the contact groups feed uri. In GData all get, insert, update and
 * delete methods always receive a callback defining success and
 * failure handlers./*from   w  w  w .  jav  a 2  s.c  o m*/
 * Here, the failure handler displays an error message while the
 * success handler calls showData to display the contact group entries.
 * 
 * @param contactGroupsFeedUri The contact groups feed uri
 */
private void getContactGroups(String contactGroupsFeedUri) {
    showStatus("Loading contact groups feed...", false);
    service.getContactGroupFeed(contactGroupsFeedUri, new ContactGroupFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the contact groups " + "feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(ContactGroupFeed result) {
            ContactGroupEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("You have no contact groups.", false);
            } else {
                showData(entries);
            }
        }
    });
}

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

License:Apache License

/**
 * Retrieve the contact groups feed using the Contacts service and
 * the contact groups feed uri.//w  w  w  . j av a2s . c  o m
 * On success, obtain the first group entry with a title starting
 * with "GWT-Contacts-Client", this is the group that will be updated.
 * If no contact group is found, display a message.
 * Otherwise call updateContactGroup to update the group.
 * 
 * @param contactGroupsFeedUri The contact groups feed uri
 */
private void getContactGroups(String contactGroupsFeedUri) {
    showStatus("Loading contact groups feed...", false);
    service.getContactGroupFeed(contactGroupsFeedUri, new ContactGroupFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the contact groups " + "feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(ContactGroupFeed result) {
            ContactGroupEntry[] entries = result.getEntries();
            ContactGroupEntry targetGroup = null;
            for (ContactGroupEntry contact : entries) {
                String title = contact.getTitle().getText();
                if (title.startsWith("GWT-Contacts-Client")) {
                    targetGroup = contact;
                    break;
                }
            }
            if (targetGroup == null) {
                showStatus(
                        "No contacts groups were found with a title starting " + "with 'GWT-Contacts-Client'.",
                        false);
            } else {
                updateContactGroup(targetGroup);
            }
        }
    });
}