use of name.abuchen.portfolio.snapshot.security.SecurityPerformanceRecord in project portfolio by buchen.
the class SecuritiesPerformanceView method createDividendColumns.
private void createDividendColumns() {
// Gesamtsumme der erhaltenen Dividenden
// $NON-NLS-1$
Column column = new Column("sumdiv", Messages.ColumnDividendSum, SWT.RIGHT, 80);
column.setMenuLabel(Messages.ColumnDividendSum_MenuLabel);
column.setGroupLabel(Messages.GroupLabelDividends);
column.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object r) {
return Values.Money.format(((SecurityPerformanceRecord) r).getSumOfDividends(), getClient().getBaseCurrency());
}
});
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "sumOfDividends"));
recordColumns.addColumn(column);
// Rendite insgesamt
// $NON-NLS-1$
column = new Column("d%", Messages.ColumnDividendTotalRateOfReturn, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelDividends);
column.setDescription(Messages.ColumnDividendTotalRateOfReturn_Description);
column.setVisible(false);
column.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object r) {
return Values.Percent2.formatNonZero(((SecurityPerformanceRecord) r).getTotalRateOfReturnDiv());
}
});
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "totalRateOfReturnDiv"));
recordColumns.addColumn(column);
// Rendite insgesamt, nach gleitendem Durchschnitt
// $NON-NLS-1$
column = new Column("d%mvavg", Messages.ColumnDividendMovingAverageTotalRateOfReturn, SWT.RIGHT, 80);
column.setGroupLabel(Messages.GroupLabelDividends);
column.setMenuLabel(Messages.ColumnDividendMovingAverageTotalRateOfReturn_MenuLabel);
column.setDescription(Messages.ColumnDividendMovingAverageTotalRateOfReturn_Description);
column.setVisible(false);
column.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object r) {
return Values.Percent2.formatNonZero(((SecurityPerformanceRecord) r).getTotalRateOfReturnDivMovingAverage());
}
});
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "totalRateOfReturnDivMovingAverage"));
recordColumns.addColumn(column);
// Anzahl der Dividendenereignisse
// $NON-NLS-1$
column = new Column("dcount", Messages.ColumnDividendPaymentCount, SWT.RIGHT, 25);
column.setGroupLabel(Messages.GroupLabelDividends);
column.setMenuLabel(Messages.ColumnDividendPaymentCount_MenuLabel);
column.setVisible(false);
column.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object r) {
return Values.Id.format(((SecurityPerformanceRecord) r).getDividendEventCount());
}
});
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "dividendEventCount"));
recordColumns.addColumn(column);
// Datum der letzten Dividendenzahlung
// $NON-NLS-1$
column = new Column("dlast", Messages.ColumnLastDividendPayment, SWT.None, 75);
column.setMenuLabel(Messages.ColumnLastDividendPayment_MenuLabel);
column.setGroupLabel(Messages.GroupLabelDividends);
column.setVisible(false);
column.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object r) {
LocalDate date = ((SecurityPerformanceRecord) r).getLastDividendPayment();
return date != null ? Values.Date.format(date) : null;
}
});
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "lastDividendPayment"));
recordColumns.addColumn(column);
// Periodizität der Dividendenzahlungen
// $NON-NLS-1$
column = new Column("dperiod", Messages.ColumnDividendPeriodicity, SWT.None, 100);
column.setGroupLabel(Messages.GroupLabelDividends);
column.setDescription(Messages.ColumnDividendPeriodicity_Description);
column.setVisible(false);
column.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object r) {
return ((SecurityPerformanceRecord) r).getPeriodicity().toString();
}
});
// $NON-NLS-1$
column.setSorter(ColumnViewerSorter.create(SecurityPerformanceRecord.class, "periodicitySort"));
recordColumns.addColumn(column);
}
use of name.abuchen.portfolio.snapshot.security.SecurityPerformanceRecord in project portfolio by buchen.
the class StatementOfAssetsViewer method addPerformanceColumns.
private void addPerformanceColumns(List<ReportingPeriod> options) {
ReportingPeriodLabelProvider labelProvider;
// $NON-NLS-1$
Column column = new Column("ttwror", Messages.ColumnTWROR, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getTrueTimeWeightedRateOfReturn);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnTTWROR_Option, options));
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnTWROR_Description);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
// $NON-NLS-1$
column = new Column("irr", Messages.ColumnIRR, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getIrr);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnIRRPerformanceOption, options));
column.setMenuLabel(Messages.ColumnIRR_MenuLabel);
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
Function<Stream<Object>, Object> sum = elements -> elements.map(e -> (Money) e).collect(MoneyCollectors.sum(client.getBaseCurrency()));
// $NON-NLS-1$
column = new Column("capitalgains", Messages.ColumnCapitalGains, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getCapitalGainsOnHoldings, sum, true);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnCapitalGains_Option, options));
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnCapitalGains_Description);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
// $NON-NLS-1$
column = new Column("capitalgains%", Messages.ColumnCapitalGainsPercent, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getCapitalGainsOnHoldingsPercent);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnCapitalGainsPercent_Option, options));
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnCapitalGainsPercent_Description);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
// $NON-NLS-1$
column = new Column("capitalgainsmvavg", Messages.ColumnCapitalGainsMovingAverage, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getCapitalGainsOnHoldingsMovingAverage, sum, true);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnCapitalGainsMovingAverage_Option, options));
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnCapitalGainsMovingAverage_Description);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
// $NON-NLS-1$
column = new Column("capitalgainsmvavg%", Messages.ColumnCapitalGainsMovingAveragePercent, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getCapitalGainsOnHoldingsMovingAveragePercent);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnCapitalGainsMovingAveragePercent_Option, options));
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnCapitalGainsMovingAveragePercent_Description);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
// $NON-NLS-1$
column = new Column("delta", Messages.ColumnAbsolutePerformance_MenuLabel, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getDelta, sum, true);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnAbsolutePerformance_Option, options));
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnAbsolutePerformance_Description);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
// $NON-NLS-1$
column = new Column("delta%", Messages.ColumnAbsolutePerformancePercent_MenuLabel, SWT.RIGHT, 80);
labelProvider = new ReportingPeriodLabelProvider(SecurityPerformanceRecord::getDeltaPercent);
column.setOptions(new ReportingPeriodColumnOptions(Messages.ColumnAbsolutePerformancePercent_Option, options));
column.setGroupLabel(Messages.GroupLabelPerformance);
column.setDescription(Messages.ColumnAbsolutePerformancePercent_Description);
column.setLabelProvider(labelProvider);
column.setSorter(ColumnViewerSorter.create(new ElementComparator(labelProvider)));
column.setVisible(false);
support.addColumn(column);
}
Aggregations