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

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

Introduction

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

Prototype

public final native com.google.gwt.gdata.client.Link getEditLink() ;

Source Link

Document

Returns the link that provides the URI that can be used to edit the entry.

Usage

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.
 * // www  . j av  a  2s. c om
 * @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());
            }
        }
    });
}