Example usage for com.google.gwt.gdata.client.finance PositionFeedCallback PositionFeedCallback

List of usage examples for com.google.gwt.gdata.client.finance PositionFeedCallback PositionFeedCallback

Introduction

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

Prototype

PositionFeedCallback

Source Link

Usage

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

License:Apache License

/**
 * Retrieve the positions feed for a given portfolio using the
 * Finance service and the positions feed uri.
 * The failure handler displays an error message while the
 * success handler calls showData to display the position entries.
 * // w w w . jav  a2s .com
 * @param portfolioId The id of the portfolio for which to
 * retrieve position data
 */
private void getPositions(String portfolioId) {
    showStatus("Loading positions feed...", false);
    String positionsFeedUri = "http://finance.google.com/finance/feeds/default/" + "portfolios/" + portfolioId
            + "/positions";
    service.getPositionFeed(positionsFeedUri, new PositionFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the positions feed: " + caught.getMessage(), true);
        }

        public void onSuccess(PositionFeed result) {
            PositionEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No transactions found.", false);
            } else {
                showData(entries);
            }
        }
    });
}