Example usage for com.google.gwt.gdata.client.calendar CalendarEventQuery setMaximumStartTime

List of usage examples for com.google.gwt.gdata.client.calendar CalendarEventQuery setMaximumStartTime

Introduction

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

Prototype

public final native void setMaximumStartTime(DateTime maximumStartTime) ;

Source Link

Document

Sets the latest event start time to match (default is 2031-01-01).

Usage

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

License:Apache License

/**
 * Retrieves an events feed using a Query object.
 * In GData, feed URIs can contain querystring parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the events feed, the event entries 
 * are displayed to the user via the showData method.
 * The MinimumStartTime and MaximumStartTime parameters are used to
 * limit the range of events to a given time period.
 * /*from  w  w  w . ja  va 2  s  .co  m*/
 * @param eventsFeedUri The uri of the events feed
 */
@SuppressWarnings("deprecation")
private void queryEvents(String eventsFeedUri) {
    showStatus("Querying for events...", false);
    CalendarEventQuery query = CalendarEventQuery.newInstance(eventsFeedUri);
    Date startDate = new Date();
    startDate.setMonth(startDate.getMonth() - 1);
    Date endDate = new Date();
    query.setMinimumStartTime(DateTime.newInstance(startDate));
    query.setMaximumStartTime(DateTime.newInstance(endDate));
    service.getEventsFeed(query, new CalendarEventFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the Event feed: " + caught.getMessage(), true);
        }

        public void onSuccess(CalendarEventFeed result) {
            CalendarEventEntry[] entries = (CalendarEventEntry[]) result.getEntries();
            if (entries.length == 0) {
                showStatus("No events found for the past month.", false);
            } else {
                showData(entries);
            }
        }
    });
}