List of usage examples for com.google.gwt.gdata.client.finance TransactionEntry getTransactionData
public final native TransactionData getTransactionData() ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.FinanceRetrieveTransactionsDemo.java
License:Apache License
/** * Displays a set of Finance transaction entries in a tabular * fashion with the help of a GWT FlexTable widget. The data fields * Notes, Type and Shares are displayed./*from ww w. ja v a 2 s . c o m*/ * * @param entries The Finance transaction entries to display. */ private void showData(TransactionEntry[] entries) { mainPanel.clear(); String[] labels = new String[] { "Notes", "Type", "Shares" }; mainPanel.insertRow(0); for (int i = 0; i < labels.length; i++) { mainPanel.addCell(0); mainPanel.setWidget(0, i, new Label(labels[i])); mainPanel.getFlexCellFormatter().setStyleName(0, i, "hm-tableheader"); } for (int i = 0; i < entries.length; i++) { TransactionEntry entry = entries[i]; TransactionData data = entry.getTransactionData(); int row = mainPanel.insertRow(i + 1); mainPanel.addCell(row); mainPanel.setWidget(row, 0, new Label(data.getNotes())); mainPanel.addCell(row); mainPanel.setWidget(row, 1, new Label(data.getType())); mainPanel.addCell(row); mainPanel.setWidget(row, 2, new Label("" + data.getShares())); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.FinanceUpdateTransactionDemo.java
License:Apache License
/** * Update a transaction by making use of the updateEntry * method of the Entry class./*from ww w . ja v a 2 s . c om*/ * Set the transaction notes to an arbitrary string. Here * we prefix the notes with 'GWT-Finance-Client' so that * we can identify which transactions were updated by this demo. * On success and failure, display a status message. * * @param transactionEntry The transaction entry which to update */ private void updateTransaction(TransactionEntry transactionEntry) { showStatus("Updating transaction...", false); transactionEntry.getTransactionData().setNotes("GWT-Finance-Client - updated transaction"); transactionEntry.getTransactionData().setShares(271.82); transactionEntry.updateEntry(new TransactionEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating a transaction: " + caught.getMessage(), true); } public void onSuccess(TransactionEntry result) { showStatus("Updated a transaction.", false); } }); }