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

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

Introduction

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

Prototype

public final native void setMinimumStartTime(DateTime minimumStartTime) ;

Source Link

Document

Sets the earliest event start time to match (default is 1970-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.
 * /* w w  w .j  a  v a 2  s  .  com*/
 * @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);
            }
        }
    });
}