List of usage examples for com.google.gwt.gdata.client.contacts ContactGroupEntry getTitle
public final native Text getTitle() ;
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 . ja v a 2 s.c om*/ * 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
/** * Retrieve the contact groups feed using the Contacts service and * the contact groupd feed uri./* ww w. j ava 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.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./*from w w w . ja va 2s .com*/ * * @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())); } }
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./*from w w w . j ava2 s . 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); } } }); }
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 ww.j a v a 2s . c o 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); } }); }