Example usage for com.google.gwt.gdata.client.calendar CalendarExtendedProperty newInstance

List of usage examples for com.google.gwt.gdata.client.calendar CalendarExtendedProperty newInstance

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.calendar CalendarExtendedProperty newInstance.

Prototype

public static native CalendarExtendedProperty newInstance() ;

Source Link

Document

Constructs a calendar extended property.

Usage

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

License:Apache License

/**
 * Create a calendar event by inserting an event entry into
 * a calendar events feed.//w w  w . j  a va  2 s.c o  m
 * Set the event's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Calendar-Client' so that
 * we can identify which events were created by this demo.
 * We also specify values for time span and an extended
 * property.
 * On success and failure, display a status message.
 * 
 * @param eventsFeedUri The uri of the events feed into which to 
 * insert the new event
 */
@SuppressWarnings("deprecation")
private void createEvent(String eventsFeedUri) {
    showStatus("Creating event reminder...", false);
    CalendarEventEntry entry = CalendarEventEntry.newInstance();
    entry.setTitle(Text.newInstance());
    entry.getTitle().setText("GWT-Calendar-Client: add extended property");
    When when = When.newInstance();
    Date startTime = new Date();
    Date endTime = new Date();
    endTime.setHours(endTime.getHours() + 1);
    when.setStartTime(DateTime.newInstance(startTime));
    when.setEndTime(DateTime.newInstance(endTime));
    entry.addTime(when);
    CalendarExtendedProperty extendedProp = CalendarExtendedProperty.newInstance();
    extendedProp.setName("mydata");
    extendedProp.setValue("xyz");
    entry.addExtendedProperty(extendedProp);
    service.insertEntry(eventsFeedUri, entry, new CalendarEventEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while creating a Calendar event " + "reminder: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(CalendarEventEntry result) {
            showStatus("Created an event with an extended property.", false);
        }
    });
}