Example usage for com.google.gwt.gdata.client.gbase SnippetsQuery setMaxResults

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

Introduction

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

Prototype

public final native void setMaxResults(double maxResults) ;

Source Link

Document

Sets the maximum number of results to be retrieved.

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.
 * //  w w w . j av a 2s  . 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("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 ww  w .j a v  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("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.
 * //w  w w .  j  a v  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.
 * //from w ww.j av  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("[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.
 * //from   w w 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: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);
            }
        }
    });
}