use of name.abuchen.portfolio.snapshot.ReportingPeriod in project portfolio by buchen.
the class ReportingPeriodConfig method menuAboutToShow.
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.appendToGroup(DashboardView.INFO_MENU_GROUP_NAME, new LabelOnly(getReportingPeriod().toString()));
MenuManager subMenu = new MenuManager(Messages.LabelReportingPeriod);
subMenu.add(new LabelOnly(reportingPeriod != null ? getReportingPeriod().toString() : Messages.LabelUsingDashboardDefaultReportingPeriod));
subMenu.add(new Separator());
subMenu.add(new SimpleAction(Messages.MenuUseDashboardDefaultReportingPeriod, a -> {
reportingPeriod = null;
delegate.getWidget().getConfiguration().remove(Dashboard.Config.REPORTING_PERIOD.name());
delegate.getClient().markDirty();
}));
delegate.getDashboardData().getDefaultReportingPeriods().stream().forEach(p -> subMenu.add(new SimpleAction(p.toString(), a -> {
reportingPeriod = p;
delegate.getWidget().getConfiguration().put(Dashboard.Config.REPORTING_PERIOD.name(), p.getCode());
delegate.getClient().markDirty();
})));
subMenu.add(new Separator());
subMenu.add(new SimpleAction(Messages.LabelReportingAddPeriod, a -> {
ReportingPeriodDialog dialog = new ReportingPeriodDialog(Display.getDefault().getActiveShell(), getReportingPeriod());
if (dialog.open() == ReportingPeriodDialog.OK) {
reportingPeriod = dialog.getReportingPeriod();
if (!delegate.getDashboardData().getDefaultReportingPeriods().contains(reportingPeriod))
delegate.getDashboardData().getDefaultReportingPeriods().add(reportingPeriod);
delegate.getWidget().getConfiguration().put(Dashboard.Config.REPORTING_PERIOD.name(), reportingPeriod.getCode());
delegate.getClient().markDirty();
}
}));
manager.add(subMenu);
}
use of name.abuchen.portfolio.snapshot.ReportingPeriod in project portfolio by buchen.
the class ChartWidget method update.
@Override
public void update() {
title.setText(getWidget().getLabel());
try {
chart.suspendUpdate(true);
chart.getTitle().setText(title.getText());
for (ISeries s : chart.getSeriesSet().getSeries()) chart.getSeriesSet().deleteSeries(s.getId());
List<DataSeries> series = new DataSeriesSerializer().fromString(dataSeriesSet, get(ChartConfig.class).getData());
ReportingPeriod reportingPeriod = get(ReportingPeriodConfig.class).getReportingPeriod();
switch(useCase) {
case STATEMENT_OF_ASSETS:
buildAssetSeries(series, reportingPeriod);
break;
case PERFORMANCE:
buildPerformanceSeries(series, reportingPeriod);
break;
case RETURN_VOLATILITY:
throw new UnsupportedOperationException();
default:
throw new IllegalArgumentException();
}
chart.adjustRange();
} finally {
chart.suspendUpdate(false);
}
chart.redraw();
}
Aggregations