Example usage for com.google.gwt.gdata.client PhoneNumber REL_WORK

List of usage examples for com.google.gwt.gdata.client PhoneNumber REL_WORK

Introduction

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

Prototype

String REL_WORK

To view the source code for com.google.gwt.gdata.client PhoneNumber REL_WORK.

Click Source Link

Document

Work phone number.

Usage

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

License:Apache License

/**
 * Update a contact by making use of the updateEntry
 * method of the Entry class.//from   w  ww .j a va2 s  . c  o m
 * Set the contact's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Contacts-Client' so that
 * we can identify which contacts were updated by this demo.
 * We also update the contact's phone number.
 * On success and failure, display a status message.
 * 
 * @param targetContact The contact entry which to update
 */
private void updateContact(ContactEntry targetContact) {
    targetContact.setTitle(Text.newInstance());
    targetContact.getTitle().setText("GWT-Contacts-Client - updated contact");
    PhoneNumber phoneNumber = PhoneNumber.newInstance();
    phoneNumber.setValue("123-456-7890");
    phoneNumber.setRel(PhoneNumber.REL_WORK);
    targetContact.setPhoneNumbers(new PhoneNumber[] { phoneNumber });
    showStatus("Updating a contact event...", false);
    targetContact.updateEntry(new PersonEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while updating a contact: " + caught.getMessage(), true);
        }

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