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

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

Introduction

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

Prototype

public final native void setRel(String rel) ;

Source Link

Document

Sets the programmatic value that identifies the type of 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.// www  .  jav a 2  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);
        }
    });
}