TableViewerColumn viewColContract = new TableViewerColumn(positionListViewer, SWT.NONE);
viewColContract.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
IPositionPoint p = (IPositionPoint)element;
return ContractBase.shortStringRepr(p.getContract());
}});
TableColumn columnContract = viewColContract.getColumn();
columnContract.setText("Contract");
columnContract.setWidth(120);
columnContract.setResizable(true);
TableViewerColumn viewColPosition = new TableViewerColumn(positionListViewer, SWT.RIGHT);
viewColPosition.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
IPositionPoint p = (IPositionPoint)element;
return positionFormat.format(p.getPosition().getSignedAmount());
}});
TableColumn columnPosition = viewColPosition.getColumn();
columnPosition.setText("Position");
columnPosition.setWidth(80);
columnPosition.setResizable(true);
TableViewerColumn viewColMktPrice = new TableViewerColumn(positionListViewer, SWT.RIGHT);
viewColMktPrice.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
IPositionPoint p = (IPositionPoint)element;
return priceFormat.format(p.getPosition().getMarketPrice());
}});
TableColumn columnMktPrice = viewColMktPrice.getColumn();
columnMktPrice.setText("Mkt Price");
columnMktPrice.setWidth(100);
columnMktPrice.setResizable(true);
TableViewerColumn viewColMktValue = new TableViewerColumn(positionListViewer, SWT.RIGHT);
viewColMktValue.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
IPositionPoint p = (IPositionPoint)element;
return priceFormat.format(p.getPosition().getMarketValue());
}});
TableColumn columnMktValue = viewColMktValue.getColumn();
columnMktValue.setText("Mkt Value");
columnMktValue.setWidth(100);
columnMktValue.setResizable(true);
TableViewerColumn viewColAvgPrice = new TableViewerColumn(positionListViewer, SWT.RIGHT);
viewColAvgPrice.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
IPositionPoint p = (IPositionPoint)element;
return priceFormat.format(p.getPosition().getAveragePrice());
}});
TableColumn columnAvgPrice = viewColAvgPrice.getColumn();
columnAvgPrice.setText("Avg Price");
columnAvgPrice.setWidth(100);
columnAvgPrice.setResizable(true);
TableViewerColumn viewColUnrPnl = new TableViewerColumn(positionListViewer, SWT.RIGHT);
viewColUnrPnl.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
IPositionPoint p = (IPositionPoint)element;
return priceFormat.format(p.getPosition().getUnrealizedPnl());
}});
TableColumn columnUnrPnl = viewColUnrPnl.getColumn();
columnUnrPnl.setText("Unr P&&L");
columnUnrPnl.setWidth(100);
columnUnrPnl.setResizable(true);
TableViewerColumn viewColRealPnl = new TableViewerColumn(positionListViewer, SWT.RIGHT);
viewColRealPnl.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
IPositionPoint p = (IPositionPoint)element;
return priceFormat.format(p.getPosition().getRealizedPnl());
}});
TableColumn columnRealPnl = viewColRealPnl.getColumn();
columnRealPnl.setText("Real P&&L");
columnRealPnl.setWidth(100);
columnRealPnl.setResizable(true);