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

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

Introduction

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

Prototype

public final native void setFullTextQuery(String fullTextQuery) ;

Source Link

Document

Sets the full-text query string.

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.
 * /*w  ww. j a v  a2s  .  com*/
 * @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.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.//from  w w  w.  j av a2 s .c o 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.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  ww w.  j a v  a2 s  .  c o 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 {
                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);
                }
            }
        }
    });
}