Example usage for com.google.gwt.gdata.client Email setAddress

List of usage examples for com.google.gwt.gdata.client Email setAddress

Introduction

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

Prototype

public final native void setAddress(String address) ;

Source Link

Document

Sets the email address.

Usage

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

License:Apache License

/**
 * Create a contact by inserting a contact entry into
 * a contacts feed.//from   ww w  .ja v  a  2 s  . c  o m
 * Set the contact's title and contents to an arbitrary string. Here
 * we prefix the title with 'GWT-Contacts-Client' so that
 * we can identify which contacts were created by this demo.
 * On success and failure, display a status message.
 * 
 * @param contactFeedUri The uri of the contact feed into which to
 * insert the new contact entry
 */
private void createContact(String contactFeedUri) {
    showStatus("Creating contact...", false);
    ContactEntry entry = ContactEntry.newInstance();
    entry.setTitle(Text.newInstance());
    entry.getTitle().setText("GWT-Contacts-Client - Create Contact");
    entry.setContent(Text.newInstance());
    entry.getContent().setText("content info here");
    Email email = Email.newInstance();
    email.setAddress("GWT-Contacts-Client@domain.com");
    email.setPrimary(true);
    email.setRel(Email.REL_HOME);
    entry.setEmailAddresses(new Email[] { email });
    service.insertEntry(contactFeedUri, entry, new ContactEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating a contact: " + caught.getMessage(), true);
        }

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