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

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

Introduction

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

Prototype

public final native Id getId() ;

Source Link

Document

Returns the entry identifier.

Usage

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.
 * //from   w w w. jav a2s  .co  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

/**
* Displays a set of Google Contacts group entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields 
* Title and ID are displayed.//w w w .  j  av  a  2 s .  c  o m
* 
* @param entries The Google Contacts group entries to display.
*/
private void showData(ContactGroupEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "ID" };
    mainPanel.insertRow(0);
    for (int i = 0; i < labels.length; i++) {
        mainPanel.addCell(0);
        mainPanel.setWidget(0, i, new Label(labels[i]));
        mainPanel.getFlexCellFormatter().setStyleName(0, i, "hm-tableheader");
    }
    for (int i = 0; i < entries.length; i++) {
        ContactGroupEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 1, new Label(entry.getId().getValue()));
    }
}