Example usage for com.google.gwt.gdata.client.calendar CalendarEventEntry setRecurrence

List of usage examples for com.google.gwt.gdata.client.calendar CalendarEventEntry setRecurrence

Introduction

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

Prototype

public final native void setRecurrence(Recurrence recurrence) ;

Source Link

Document

Sets the event recurrence.

Usage

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

License:Apache License

/**
 * Create a calendar event by inserting an event entry into
 * a calendar events feed.// w  w w . ja v a2s  .co  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 the event's recurrence settings.
 * On success and failure, display a status message.
 * 
 * @param eventsFeedUri The uri of the events feed into which to 
 * insert the new event
 */
private void createEvent(String eventsFeedUri) {
    showStatus("Creating event...", false);
    CalendarEventEntry eventEntry = CalendarEventEntry.newInstance();
    eventEntry.setTitle(Text.newInstance());
    eventEntry.getTitle().setText("GWT-Calendar-Client: insert recurring event");
    Recurrence recurrence = Recurrence.newInstance();
    String icalBreak = "\r\n";
    String recurrenceString = "DTSTART;TZID=America/Los_Angeles:20090101T080000" + icalBreak
            + "DTEND;TZID=America/Los_Angeles:20090101T090000" + icalBreak
            + "RRULE:FREQ=WEEKLY;UNTIL=20090701T160000Z;";
    recurrence.setValue(recurrenceString);
    eventEntry.setRecurrence(recurrence);
    service.insertEntry(eventsFeedUri, eventEntry, new CalendarEventEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating a Calendar event: " + caught.getMessage(), true);
        }

        public void onSuccess(CalendarEventEntry result) {
            showStatus("Created a recurring event.", false);
        }
    });
}