Example usage for com.google.gwt.gdata.client.finance PositionData getShares

List of usage examples for com.google.gwt.gdata.client.finance PositionData getShares

Introduction

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

Prototype

public final native double getShares() ;

Source Link

Document

Returns the number of shares belonging to the position.

Usage

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

License:Apache License

/**
* Displays a set of Finance position entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields
* Title and Shares are displayed./* w w  w  . jav  a 2 s .com*/
* 
* @param entries The Finance position entries to display.
*/
private void showData(PositionEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "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++) {
        PositionEntry entry = entries[i];
        PositionData data = entry.getPositionData();
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 1, new Label("" + data.getShares()));
    }
}