List of usage examples for com.google.gwt.gdata.client.calendar CalendarEventFeedCallback CalendarEventFeedCallback
CalendarEventFeedCallback
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarDeleteEventDemo.java
License:Apache License
/** * Retrieves a calendar feed using a Query object. * In GData, feed URIs can contain querystring parameters. The * GData query objects aid in building parameterized feed URIs. * We query for events with a title starting with * "GWT-Calendar-Client", this is the event that will be deleted. * If no event is found, display a message. * Otherwise call deleteEvent to delete the event. Alternatively * we could also have used targetEvent.deleteEntry to * delete the event, but the effect is the same. * /*from w w w. j a v a 2 s .c o m*/ * @param calendarsFeedUri The uri of the calendars feed */ private void queryCalendars(String calendarsFeedUri) { showStatus("Querying for events...", false); CalendarEventQuery query = CalendarEventQuery.newInstance(calendarsFeedUri); query.setFullTextQuery("GWT-Calendar-Client"); 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 containing the text 'GWT-Calendar-Client'.", false); } else { CalendarEventEntry targetEvent = entries[0]; String eventEntryUri = targetEvent.getEditLink().getHref(); deleteEvent(eventEntryUri, targetEvent.getEtag()); } } }); }
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 ww w .ja v a 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); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarQueryEventsFullTextDemo.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 FullTextQuery parameter is used to search for events * containing a specific text string./*w ww. ja va 2 s. co m*/ * * @param eventsFeedUri The uri of the events feed */ private void queryEvents(String eventsFeedUri) { showStatus("Querying for events...", false); CalendarEventQuery query = CalendarEventQuery.newInstance(eventsFeedUri); query.setFullTextQuery("GWT-Calendar-Client"); 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 containing the text 'GWT-Calendar-Client'.", false); } else { showData(entries); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarRetrieveEventsDemo.java
License:Apache License
/** * Retrieve the Calendar events feed using the Calendar service and * the events feed uri. In GData all get, insert, update and delete methods * always receive a callback defining success and failure handlers. * Here, the failure handler displays an error message while the * success handler calls showData to display the event entries. * // w w w . j a va 2 s . c o m * @param eventsFeedUri The uri of the events feed */ private void getEvents(String eventsFeedUri) { showStatus("Loading events feed...", false); service.getEventsFeed(eventsFeedUri, new CalendarEventFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Events feed: " + caught.getMessage(), true); } public void onSuccess(CalendarEventFeed result) { CalendarEventEntry[] entries = (CalendarEventEntry[]) result.getEntries(); if (entries.length == 0) { showStatus("There are no Calendar events.", false); } else { showData(entries); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarUpdateEventDemo.java
License:Apache License
/** * Retrieves a Calendar events feed using a Query object. * In GData, feed URIs can contain querystring parameters. The * GData query objects aid in building parameterized feed URIs. * On success, identify the first event entry with a title starting * with "GWT-Calendar-Client", this will be the event that will be updated. * If no event is found, display a message. * Otherwise call updateEvent to update the event. * //from w w w . j av a2 s .c om * @param eventsFeedUri The uri of the events feed */ private void queryEvents(String eventsFeedUri) { showStatus("Querying for events...", false); CalendarEventQuery query = CalendarEventQuery.newInstance(eventsFeedUri); query.setFullTextQuery("GWT-Calendar-Client"); 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 containing the text 'GWT-Calendar-Client'.", false); } else { CalendarEventEntry targetEvent = null; for (CalendarEventEntry entry : entries) { String title = entry.getTitle().getText(); if (title.startsWith("GWT-Calendar-Client")) { targetEvent = entry; break; } } if (targetEvent == null) { showStatus("Did not find a event entry whose title starts with " + "the prefix 'GWT-Calendar-Client'.", false); } else { updateEvent(targetEvent); } } } }); }