Example usage for com.google.gwt.gdata.client.finance TransactionData getType

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

Introduction

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

Prototype

public final native String getType() ;

Source Link

Document

Returns the type for the transaction (can be "Buy", "Sell", "Buy to Cover" or "Sell Short").

Usage

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   w w  w  .  j  a v  a 2 s.  c  om*/
* 
* @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()));
    }
}