use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class DividendsMatrixTab method addConfigActions.
@Override
public void addConfigActions(IMenuManager manager) {
Action action = new SimpleAction(Messages.LabelShowOnlyOneYear, a -> {
showOnlyOneYear = !showOnlyOneYear;
updateColumns(tableViewer, tableLayout);
});
action.setChecked(showOnlyOneYear);
manager.add(action);
}
use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class TaxonomyView method addView.
private void addView(final ToolBar toolBar, String label, Images image, final int index) {
Action showDefinition = new SimpleAction(label, Action.AS_CHECK_BOX, a -> activateView(index));
showDefinition.setImageDescriptor(image.descriptor());
showDefinition.setToolTipText(label);
new ActionContributionItem(showDefinition).fill(toolBar, -1);
viewActions.add(showDefinition);
}
use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class DataSeriesConfigurator method addCopyFromOtherChartsMenu.
private void addCopyFromOtherChartsMenu(IMenuManager manager) {
String[] charts = new String[] { // $NON-NLS-1$
"StatementOfAssetsHistoryView", // $NON-NLS-1$
Messages.LabelStatementOfAssetsHistory, // $NON-NLS-1$
"PerformanceChartView", // $NON-NLS-1$
Messages.LabelPerformanceChart, "ReturnsVolatilityChartView", // $NON-NLS-1$
Messages.LabelHistoricalReturnsAndVolatiltity };
MenuManager copyFromOthers = new MenuManager(Messages.ChartSeriesCopySeriesFromOtherChart);
manager.add(copyFromOthers);
MenuManager replaceByOthers = new MenuManager(Messages.ChartSeriesReplaceSeriesByOtherChart);
manager.add(replaceByOthers);
String currentConfigUUID = store.getActiveUUID();
for (int ii = 0; ii < charts.length; ii += 2) {
ConfigurationSet set = client.getSettings().getConfigurationSet(charts[ii] + IDENTIFIER_POSTFIX);
MenuManager menuCopy = new MenuManager(charts[ii + 1]);
copyFromOthers.add(menuCopy);
MenuManager menuReplace = new MenuManager(charts[ii + 1]);
replaceByOthers.add(menuReplace);
set.getConfigurations().forEach(config -> {
if (Objects.equals(currentConfigUUID, config.getUUID()))
return;
menuCopy.add(new SimpleAction(config.getName(), a -> {
List<DataSeries> list = new DataSeriesSerializer().fromString(dataSeriesSet, config.getData());
list.stream().filter(s -> !selectedSeries.contains(s)).forEach(s -> selectedSeries.add(s));
fireUpdate();
}));
menuReplace.add(new SimpleAction(config.getName(), a -> {
List<DataSeries> list = new DataSeriesSerializer().fromString(dataSeriesSet, config.getData());
selectedSeries.clear();
list.stream().forEach(s -> selectedSeries.add(s));
fireUpdate();
}));
});
}
}
use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class DataSeriesConfigurator method configMenuAboutToShow.
private // NOSONAR
void configMenuAboutToShow(// NOSONAR
IMenuManager manager) {
for (final DataSeries series : selectedSeries) {
Action action = new SimpleAction(series.getLabel(), a -> doDeleteSeries(series));
action.setChecked(true);
manager.add(action);
}
manager.add(new Separator());
manager.add(new SimpleAction(Messages.ChartSeriesPickerAddItem, a -> doAddSeries(false)));
if (dataSeriesSet.getUseCase() != DataSeries.UseCase.STATEMENT_OF_ASSETS)
manager.add(new SimpleAction(Messages.ChartSeriesPickerAddBenchmark, a -> doAddSeries(true)));
addCopyFromOtherChartsMenu(manager);
manager.add(new SimpleAction(Messages.MenuResetChartSeries, a -> doResetSeries(null)));
}
use of name.abuchen.portfolio.ui.util.SimpleAction in project portfolio by buchen.
the class ClientEditorSidebar method menuAboutToShow.
public void menuAboutToShow(IMenuManager menuManager) {
// entries is a flat list of all entries
MenuManager subMenu = null;
for (Entry entry : sidebar.getEntries()) {
int indent = entry.getIndent();
Action action = entry.getAction();
if (indent == 0) {
subMenu = new MenuManager(entry.getLabel());
menuManager.add(subMenu);
} else {
if (subMenu == null || action == null)
continue;
// cannot use the original action b/c it will not highlight the selected entry
// in the sidebar
// $NON-NLS-1$
String text = indent > Sidebar.STEP ? "- " + action.getText() : action.getText();
SimpleAction menuAction = new SimpleAction(text, a -> sidebar.select(entry));
menuAction.setImageDescriptor(action.getImageDescriptor());
subMenu.add(menuAction);
}
}
}
Aggregations