List of usage examples for com.google.gwt.gdata.client.finance PortfolioData newInstance
public static native PortfolioData newInstance() ;
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./*from w ww. j av a 2 s . com*/ * 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); } }); }