Example usage for com.google.gwt.gdata.client.finance PortfolioData setCurrencyCode

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

Introduction

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

Prototype

public final native void setCurrencyCode(String currencyCode) ;

Source Link

Document

Sets the ISO4217 currency code.

Usage

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

License:Apache License

/**
 * Create a portfolio by inserting a portfolio entry into
 * a portfolio feed.//  w ww .  j a va2s.c  o m
 * Set the portfolio's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Finance-Client' so that
 * we can identify which portfolios were created by this demo.
 * The new portfolio is created with currency code set to USD.
 * On success and failure, display a status message.
 * 
 * @param portfolioFeedUri The uri of the portfolio feed into which
 * to insert the portfolio entry
 */
private void createPortfolio(String portfolioFeedUri) {
    showStatus("Creating portfolio...", false);
    PortfolioEntry entry = PortfolioEntry.newInstance();
    entry.setTitle(Text.newInstance());
    entry.getTitle().setText("GWT-Finance-Client - inserted portfolio");
    PortfolioData data = PortfolioData.newInstance();
    data.setCurrencyCode("USD");
    entry.setPortfolioData(data);
    service.insertEntry(portfolioFeedUri, entry, new PortfolioEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating a portfolio: " + caught.getMessage(), true);
        }

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