TableViewerColumn viewColDateTime = new TableViewerColumn(tradesTableViewer, SWT.NONE);
viewColDateTime.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return sdf.format(t.getIndex());
}
});
TableColumn columnDateTime = viewColDateTime.getColumn();
columnDateTime.setText("Time");
columnDateTime.setWidth(140);
columnDateTime.setResizable(true);
TableViewerColumn viewColSide = new TableViewerColumn(tradesTableViewer, SWT.NONE);
viewColSide.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return t.getTrade().getOrder() != null ? t.getTrade().getOrder().getSide().name() : "";
}
});
TableColumn columnSide = viewColSide.getColumn();
columnSide.setText("Side");
columnSide.setWidth(40);
columnSide.setResizable(true);
TableViewerColumn viewColSize = new TableViewerColumn(tradesTableViewer, SWT.NONE);
viewColSize.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return t.getTrade().getOrder() != null ? Integer.toString(t.getTrade().getOrder().getAmount()) : "";
}
});
TableColumn columnSize = viewColSize.getColumn();
columnSize.setText("Size");
columnSize.setWidth(40);
columnSize.setResizable(true);
TableViewerColumn viewColExPrice = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
viewColExPrice.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return df.format(t.getTrade().getExecutionPrice());
}
});
TableColumn columnExPrice = viewColExPrice.getColumn();
columnExPrice.setText("Ex.Price");
columnExPrice.setWidth(80);
columnExPrice.setResizable(true);
TableViewerColumn viewColAvgPrice = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
viewColAvgPrice.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return df.format(t.getTrade().getAveragePrice());
}
});
TableColumn columnAvgPrice = viewColAvgPrice.getColumn();
columnAvgPrice.setText("Avg.Price");
columnAvgPrice.setWidth(80);
columnAvgPrice.setResizable(true);
TableViewerColumn viewColTradePnl = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
viewColTradePnl.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return df.format(t.getTradePnl());
}
});
TableColumn columnTradePnl = viewColTradePnl.getColumn();
columnTradePnl.setText("Trade P&&L");
columnTradePnl.setWidth(80);
columnTradePnl.setResizable(true);
TableViewerColumn viewColMaxFavExc = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
viewColMaxFavExc.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return df.format(t.getMaxFavorableExcursion());
}
});
TableColumn columnMaxFavExc = viewColMaxFavExc.getColumn();
columnMaxFavExc.setText("Fav.Chg.");
columnMaxFavExc.setWidth(80);
columnMaxFavExc.setResizable(true);
TableViewerColumn viewColMaxAdvExc = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
viewColMaxAdvExc.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ITradeStatsPoint t = (ITradeStatsPoint) element;
return df.format(t.getMaxAdverseExcursion());
}
});
TableColumn columnMaxAdvExc = viewColMaxAdvExc.getColumn();
columnMaxAdvExc.setText("Adv.Chg.");
columnMaxAdvExc.setWidth(80);