use of name.abuchen.portfolio.ui.util.viewers.MoneyColorLabelProvider in project portfolio by buchen.
the class SecuritiesPerformanceView method addPerformanceColumns.
private void addPerformanceColumns() {
// $NON-NLS-1$
Column column = new Column("twror", Messages.ColumnTWROR, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setMenuLabel(Messages.ColumnTWROR_Description);
column.setLabelProvider(new NumberColorLabelProvider<>(Values.Percent2, r -> ((SecurityPerformanceRecord) r).getTrueTimeWeightedRateOfReturn()));
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "trueTimeWeightedRateOfReturn"));
recordColumns.addColumn(column);
// internal rate of return
// $NON-NLS-1$
column = new Column("izf", Messages.ColumnIRR, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setMenuLabel(Messages.ColumnIRR_MenuLabel);
column.setLabelProvider(new NumberColorLabelProvider<>(Values.Percent2, r -> ((SecurityPerformanceRecord) r).getIrr()));
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "irr"));
recordColumns.addColumn(column);
// $NON-NLS-1$
column = new Column("capitalgains", Messages.ColumnCapitalGains, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnCapitalGains_Description);
column.setLabelProvider(new MoneyColorLabelProvider(element -> ((SecurityPerformanceRecord) element).getCapitalGainsOnHoldings(), getClient().getBaseCurrency()));
column.setVisible(false);
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "capitalGainsOnHoldings"));
recordColumns.addColumn(column);
// $NON-NLS-1$
column = new Column("capitalgains%", Messages.ColumnCapitalGainsPercent, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnCapitalGainsPercent_Description);
column.setLabelProvider(new NumberColorLabelProvider<>(Values.Percent2, r -> ((SecurityPerformanceRecord) r).getCapitalGainsOnHoldingsPercent()));
column.setVisible(false);
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "capitalGainsOnHoldingsPercent"));
recordColumns.addColumn(column);
// $NON-NLS-1$
column = new Column("capitalgainsmvavg", Messages.ColumnCapitalGainsMovingAverage, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setMenuLabel(Messages.ColumnCapitalGainsMovingAverage_MenuLabel);
column.setDescription(Messages.ColumnCapitalGainsMovingAverage_Description);
column.setLabelProvider(new MoneyColorLabelProvider(element -> ((SecurityPerformanceRecord) element).getCapitalGainsOnHoldingsMovingAverage(), getClient().getBaseCurrency()));
column.setVisible(false);
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "capitalGainsOnHoldingsMovingAverage"));
recordColumns.addColumn(column);
// $NON-NLS-1$
column = new Column("capitalgainsmvavg%", Messages.ColumnCapitalGainsMovingAveragePercent, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setMenuLabel(Messages.ColumnCapitalGainsMovingAveragePercent_MenuLabel);
column.setDescription(Messages.ColumnCapitalGainsMovingAveragePercent_Description);
column.setLabelProvider(new NumberColorLabelProvider<>(Values.Percent2, r -> ((SecurityPerformanceRecord) r).getCapitalGainsOnHoldingsMovingAveragePercent()));
column.setVisible(false);
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "capitalGainsOnHoldingsMovingAveragePercent"));
recordColumns.addColumn(column);
// delta
// $NON-NLS-1$
column = new Column("delta", Messages.ColumnAbsolutePerformance, SWT.RIGHT, 80);
column.setDescription(Messages.ColumnAbsolutePerformance_Description);
column.setMenuLabel(Messages.ColumnAbsolutePerformance_MenuLabel);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setLabelProvider(new MoneyColorLabelProvider(element -> ((SecurityPerformanceRecord) element).getDelta(), getClient().getBaseCurrency()));
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "delta"));
recordColumns.addColumn(column);
// delta percent
// $NON-NLS-1$
column = new Column("delta%", Messages.ColumnAbsolutePerformancePercent, SWT.RIGHT, 80);
column.setDescription(Messages.ColumnAbsolutePerformancePercent_Description);
column.setMenuLabel(Messages.ColumnAbsolutePerformancePercent_MenuLabel);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setLabelProvider(new NumberColorLabelProvider<>(Values.Percent2, r -> ((SecurityPerformanceRecord) r).getDeltaPercent()));
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "deltaPercent"));
column.setVisible(false);
recordColumns.addColumn(column);
}
Aggregations