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

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

Introduction

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

Prototype

public final native void setValue(String value) ;

Source Link

Document

Sets the human-readable 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./*  w w w .  j ava  2  s  .co  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);
        }
    });
}