Example usage for com.google.gwt.gdata.client.finance PortfolioEntry updateEntry

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

Introduction

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

Prototype

public final native void updateEntry(Callback<E> callback) ;

Source Link

Document

Updates the entry in the feed by sending the representation of this entry.

Usage

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

License:Apache License

/**
 * Update a portfolio by making use of the updateEntry
 * method of the Entry class./*from w ww .j  a va  2 s.co  m*/
 * Set the portfolio title to an arbitrary string. Here
 * we prefix the title with 'GWT-Finance-Client' so that
 * we can identify which portfolios were updated by this demo.
 * On success and failure, display a status message.
 * 
 * @param targetPortfolio The portfolio entry which to update
 */
private void updatePortfolio(PortfolioEntry targetPortfolio) {
    showStatus("Updating portfolio...", false);
    targetPortfolio.setTitle(Text.newInstance());
    targetPortfolio.getTitle().setText("GWT-Finance-Client - updated portfolio");
    targetPortfolio.updateEntry(new PortfolioEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while updating a portfolio: " + caught.getMessage(), true);
        }

        public void onSuccess(PortfolioEntry result) {
            showStatus("Updated a portfolio.", false);
        }
    });
}