use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class ExchangeRateSeriesConfig method menuAboutToShow.
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.appendToGroup(DashboardView.INFO_MENU_GROUP_NAME, new LabelOnly(getLabel()));
MenuManager subMenu = new MenuManager(Messages.LabelExchangeRate);
available.stream().forEach(ts -> {
SimpleAction action = new SimpleAction(ts.getLabel(), a -> {
series = ts;
String code = ts.getBaseCurrency() + '/' + ts.getTermCurrency();
delegate.getWidget().getConfiguration().put(Dashboard.Config.EXCHANGE_RATE_SERIES.name(), code);
delegate.getClient().markDirty();
});
action.setChecked(series.equals(ts));
subMenu.add(action);
});
manager.add(subMenu);
}
use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class LabelConfig method menuAboutToShow.
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.appendToGroup(DashboardView.INFO_MENU_GROUP_NAME, new LabelOnly(delegate.getWidget().getLabel()));
manager.add(new SimpleAction(Messages.MenuRenameLabel, a -> {
InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.MenuRenameLabel, Messages.ColumnLable, delegate.getWidget().getLabel(), null);
if (dialog.open() != InputDialog.OK)
return;
delegate.getWidget().setLabel(dialog.getValue());
delegate.getClient().markDirty();
}));
}
use of name.abuchen.portfolio.ui.util.SimpleAction 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.ui.util.SimpleAction in project portfolio by buchen.
the class DashboardView method widgetMenuAboutToShow.
private void widgetMenuAboutToShow(IMenuManager manager, WidgetDelegate delegate) {
manager.add(new Separator(INFO_MENU_GROUP_NAME));
// $NON-NLS-1$
manager.add(new Separator("edit"));
delegate.getWidgetConfigs().forEach(c -> c.menuAboutToShow(manager));
manager.add(new Separator());
manager.add(new SimpleAction(Messages.MenuDeleteWidget, a -> {
Composite composite = findCompositeFor(delegate);
if (composite == null)
throw new IllegalArgumentException();
Composite parent = composite.getParent();
Dashboard.Column column = (Dashboard.Column) parent.getData();
if (!column.getWidgets().remove(delegate.getWidget()))
throw new IllegalArgumentException();
composite.dispose();
parent.layout();
markDirty();
}));
}
use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class DataSeriesConfig method menuAboutToShow.
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.appendToGroup(DashboardView.INFO_MENU_GROUP_NAME, new LabelOnly(dataSeries.getLabel()));
MenuManager subMenu = new MenuManager(Messages.LabelDataSeries);
subMenu.add(new LabelOnly(dataSeries.getLabel()));
subMenu.add(new Separator());
subMenu.add(new SimpleAction(Messages.MenuSelectDataSeries, a -> doAddSeries(false)));
if (supportsBenchmarks)
subMenu.add(new SimpleAction(Messages.MenuSelectBenchmarkDataSeries, a -> doAddSeries(true)));
manager.add(subMenu);
}
Aggregations