List of usage examples for com.google.gwt.gdata.client.calendar CalendarFeedCallback CalendarFeedCallback
CalendarFeedCallback
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarDeleteCalendarDemo.java
License:Apache License
/** * Retrieve the calendars feed using the calendar service and * the calendars feed uri./*w ww.j a v a 2s.c o m*/ * On success, identify the first calendar entry with a title starting * with "GWT-Calendar-Client", this will be the calendar that will be * deleted. * If no calendar is found, display a message. * Otherwise call deleteCalendar to delete the calendar. Alternatively * we could also have used targetCalendar.deleteEntry to * delete the calendar, but the effect is the same. * * @param calendarsFeedUri The uri of the calendars feed */ private void getCalendars(String calendarsFeedUri) { showStatus("Loading calendars...", false); service.getOwnCalendarsFeed(calendarsFeedUri, new CalendarFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Calendar feed: " + caught.getMessage(), true); } public void onSuccess(CalendarFeed result) { CalendarEntry[] entries = result.getEntries(); if (entries.length == 0) { showStatus("You have no calendars.", false); } else { CalendarEntry targetCalendar = null; for (CalendarEntry entry : entries) { String title = entry.getTitle().getText(); if (title.startsWith("GWT-Calendar-Client")) { targetCalendar = entry; break; } } if (targetCalendar == null) { showStatus("Did not find a calendar entry whose title starts " + "with the prefix 'GWT-Calendar-Client'.", false); } else { String calendarEntryUri = targetCalendar.getSelfLink().getHref(); deleteCalendar(calendarEntryUri); } } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarRetrieveCalendarsDemo.java
License:Apache License
/** * Retrieve the calendars feed using the Calendar service and * the calendars feed uri. In GData all get, insert, update and * delete methods always receive a callback defining success and * failure handlers./*from w ww .j a v a2 s . c o m*/ * Here, the failure handler displays an error message while the * success handler calls showData to display the calendar entries. * * @param calendarsFeedUri The uri of the calendars feed */ private void getCalendars(String calendarsFeedUri) { showStatus("Loading calendars feed...", false); service.getAllCalendarsFeed(calendarsFeedUri, new CalendarFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Calendar feed: " + caught.getMessage(), true); } public void onSuccess(CalendarFeed result) { CalendarEntry[] entries = result.getEntries(); if (entries.length == 0) { showStatus("You have no Calendars.", false); } else { showData(result.getEntries()); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarUpdateCalendarDemo.java
License:Apache License
/** * Retrieve the calendars feed using the Calendar service and * the calendars feed uri.//www.j ava 2 s . c o m * On success, identify the first calendar entry with a title * starting with "GWT-Calendar-Client", this will be the calendar * that will be updated. * If no calendar is found, display a message. * Otherwise call updateCalendar to update the calendar. * * @param calendarsFeedUri The uri of the calendars feed */ private void getCalendars(String calendarsFeedUri) { showStatus("Loading calendars...", false); service.getOwnCalendarsFeed(calendarsFeedUri, new CalendarFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Calendar feed: " + caught.getMessage(), true); } public void onSuccess(CalendarFeed result) { CalendarEntry[] entries = result.getEntries(); if (entries.length == 0) { showStatus("You have no calendars.", false); } else { CalendarEntry targetCalendar = null; for (CalendarEntry entry : entries) { String title = entry.getTitle().getText(); if (title.startsWith("GWT-Calendar-Client")) { targetCalendar = entry; break; } } if (targetCalendar == null) { showStatus("Did not find a calendar entry whose title starts " + "with the prefix 'GWT-Calendar-Client'.", false); } else { updateCalendar(targetCalendar); } } } }); }