use of name.abuchen.portfolio.ui.Sidebar.Entry in project portfolio by buchen.
the class ClientEditorSidebar method createWatchlistEntry.
private void createWatchlistEntry(Entry section, final Watchlist watchlist) {
Entry entry = new Entry(section, watchlist.getName());
entry.setAction(new // $NON-NLS-1$
ActivateViewAction(// $NON-NLS-1$
watchlist.getName(), // $NON-NLS-1$
"SecurityList", // $NON-NLS-1$
watchlist, Images.WATCHLIST.descriptor()));
entry.setContextMenu((e, m) -> watchlistContextMenuAboutToShow(watchlist, e, m));
entry.addDropSupport(DND.DROP_MOVE, new Transfer[] { SecurityTransfer.getTransfer() }, new DropTargetAdapter() {
@Override
public void drop(DropTargetEvent event) {
if (SecurityTransfer.getTransfer().isSupportedType(event.currentDataType)) {
Security security = SecurityTransfer.getTransfer().getSecurity();
if (security != null) {
// a deep copy to the client's securities list
if (!editor.getClient().getSecurities().contains(security)) {
security = security.deepCopy();
editor.getClient().addSecurity(security);
}
if (!watchlist.getSecurities().contains(security))
watchlist.addSecurity(security);
editor.markDirty();
editor.notifyModelUpdated();
}
}
}
});
}
use of name.abuchen.portfolio.ui.Sidebar.Entry in project portfolio by buchen.
the class ClientEditorSidebar method createMiscSection.
private void createMiscSection(Sidebar sidebar) {
Entry section = new Entry(sidebar, Messages.ClientEditorLabelGeneralData);
// $NON-NLS-1$
new Entry(section, new ActivateViewAction(Messages.LabelConsumerPriceIndex, "ConsumerPriceIndexList")).setContextMenu(setAsStartPage);
// $NON-NLS-1$
new Entry(section, new ActivateViewAction(Messages.LabelCurrencies, "ExchangeRatesList")).setContextMenu(setAsStartPage);
// $NON-NLS-1$
new Entry(section, new ActivateViewAction(Messages.LabelSettings, "settings.Settings")).setContextMenu(setAsStartPage);
if (// $NON-NLS-1$ //$NON-NLS-2$
"yes".equals(System.getProperty("name.abuchen.portfolio.debug")))
// $NON-NLS-1$ //$NON-NLS-2$
new Entry(section, new ActivateViewAction("Browser Test", "BrowserTest"));
}
use of name.abuchen.portfolio.ui.Sidebar.Entry in project portfolio by buchen.
the class ClientEditorSidebar method createPerformanceSection.
private void createPerformanceSection(Sidebar sidebar) {
Entry section = new Entry(sidebar, Messages.ClientEditorLabelReports);
statementOfAssets = new Entry(section, // $NON-NLS-1$
new ActivateViewAction(Messages.LabelStatementOfAssets, "StatementOfAssets"));
statementOfAssets.setContextMenu(setAsStartPage);
new Entry(statementOfAssets, // $NON-NLS-1$
new ActivateViewAction(Messages.ClientEditorLabelChart, "StatementOfAssetsHistory")).setContextMenu(setAsStartPage);
// $NON-NLS-1$
new Entry(statementOfAssets, new ActivateViewAction(Messages.ClientEditorLabelHoldings, "HoldingsPieChart")).setContextMenu(setAsStartPage);
Entry performance = new Entry(section, // $NON-NLS-1$
new ActivateViewAction(Messages.ClientEditorLabelPerformance, "dashboard.Dashboard"));
performance.setContextMenu(setAsStartPage);
// $NON-NLS-1$
new Entry(performance, new ActivateViewAction(Messages.ClientEditorPerformanceCalculation, "Performance")).setContextMenu(setAsStartPage);
// $NON-NLS-1$
new Entry(performance, new ActivateViewAction(Messages.ClientEditorLabelChart, "PerformanceChart")).setContextMenu(setAsStartPage);
new Entry(performance, // $NON-NLS-1$
new ActivateViewAction(Messages.ClientEditorLabelReturnsVolatility, "ReturnsVolatilityChart")).setContextMenu(setAsStartPage);
// $NON-NLS-1$
new Entry(performance, new ActivateViewAction(Messages.LabelSecurities, "SecuritiesPerformance")).setContextMenu(setAsStartPage);
// $NON-NLS-1$
new Entry(performance, new ActivateViewAction(Messages.LabelDividends, "dividends.Dividends")).setContextMenu(setAsStartPage);
}
use of name.abuchen.portfolio.ui.Sidebar.Entry 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