Example usage for com.google.gwt.gdata.client.gbase SnippetsFeedCallback SnippetsFeedCallback

List of usage examples for com.google.gwt.gdata.client.gbase SnippetsFeedCallback SnippetsFeedCallback

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.gbase SnippetsFeedCallback SnippetsFeedCallback.

Prototype

SnippetsFeedCallback

Source Link

Usage

From source file:com.google.gwt.gdata.sample.hellogdata.client.GoogleBaseQuerySnippetsForCamerasDemo.java

License:Apache License

/**
 * Retrieves a snippets feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the snippets feed, the snippet entries 
 * are displayed to the user via the showData method.
 * We set the BQ parameter to search for digital cameras.
 * //ww  w .  j av a2  s  .c o  m
 * @param itemsFeedUri The items feed uri.
 */
private void querySnippets(String itemsFeedUri) {
    showStatus("Loading snippets feed...", false);
    SnippetsQuery query = SnippetsQuery.newInstance(itemsFeedUri);
    query.setMaxResults(25);
    query.setBq("digital camera [megapixels >= 4][price < 200.0][condition:new]");
    service.getSnippetsFeed(query, new SnippetsFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the snippets feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SnippetsFeed result) {
            SnippetsEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No snippets matched the search criteria.", false);
            } else {
                showData(entries);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.GoogleBaseQuerySnippetsForConvertiblesDemo.java

License:Apache License

/**
 * Retrieves a snippets feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the snippets feed, the snippet entries 
 * are displayed to the user via the showData method.
 * We set the BQ parameter to search for convertibles.
 * /*from   w ww. j  a  va 2s.  c  o  m*/
 * @param itemsFeedUri The items feed uri.
 */
private void querySnippets(String itemsFeedUri) {
    showStatus("Loading snippets feed...", false);
    SnippetsQuery query = SnippetsQuery.newInstance(itemsFeedUri);
    query.setMaxResults(25);
    query.setBq("convertible [brand:Volkswagen][year >=2003]" + "[color:red][vehicle type:car]");
    service.getSnippetsFeed(query, new SnippetsFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the snippets feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SnippetsFeed result) {
            SnippetsEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No snippets matched the search criteria.", false);
            } else {
                showData(entries);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.GoogleBaseQuerySnippetsForHousingDemo.java

License:Apache License

/**
 * Retrieves a snippets feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the snippets feed, the snippet entries 
 * are displayed to the user via the showData method.
 * We set the BQ parameter to search for housing.
 * /*from   ww  w.  j av a2  s. c o  m*/
 * @param itemsFeedUri The items feed uri.
 */
private void querySnippets(String itemsFeedUri) {
    showStatus("Loading snippets feed...", false);
    SnippetsQuery query = SnippetsQuery.newInstance(itemsFeedUri);
    query.setMaxResults(25);
    query.setBq("[item type:housing][listing type:for sale]"
            + "[location:@\"San Jose, CA, USA\"+15mi][price < 700000 USD]");
    service.getSnippetsFeed(query, new SnippetsFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the snippets feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SnippetsFeed result) {
            SnippetsEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No snippets matched the search criteria.", false);
            } else {
                showData(entries);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.GoogleBaseQuerySnippetsForJobsDemo.java

License:Apache License

/**
 * Retrieves a snippets feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the snippets feed, the snippet entries 
 * are displayed to the user via the showData method.
 * We set the BQ query string to search for jobs.
 * /* www.  j a va  2  s  .c  om*/
 * @param itemsFeedUri The items feed uri.
 */
private void querySnippets(String itemsFeedUri) {
    showStatus("Loading snippets feed...", false);
    SnippetsQuery query = SnippetsQuery.newInstance(itemsFeedUri);
    query.setMaxResults(25);
    query.setBq("[employer: Google][job type:full-time][job function:Marketing]");
    service.getSnippetsFeed(query, new SnippetsFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the snippets feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SnippetsFeed result) {
            SnippetsEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No snippets matched the search criteria.", false);
            } else {
                showData(entries);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.GoogleBaseQuerySnippetsForRecipesDemo.java

License:Apache License

/**
 * Retrieves a snippets feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the snippets feed, the snippet entries 
 * are displayed to the user via the showData method.
 * We set the BQ parameter to search for recipes.
 * /*w  w  w  . jav a2s.  c  o  m*/
 * @param itemsFeedUri The items feed uri.
 */
private void querySnippets(String itemsFeedUri) {
    showStatus("Loading snippets feed...", false);
    SnippetsQuery query = SnippetsQuery.newInstance(itemsFeedUri);
    query.setMaxResults(25);
    query.setBq("[item type:recipes][cuisine:chinese][course:main]" + "[main ingredient:chicken]");
    service.getSnippetsFeed(query, new SnippetsFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the snippets feed: " + caught.getMessage(), true);
        }

        public void onSuccess(SnippetsFeed result) {
            SnippetsEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No snippets matched the search criteria.", false);
            } else {
                showData(entries);
            }
        }
    });
}