Search in sources :

Example 1 with AbstractDropDown

use of name.abuchen.portfolio.ui.util.AbstractDropDown in project portfolio by buchen.

the class InvestmentPlanListView method addConfigButton.

private void addConfigButton(final ToolBar toolBar) {
    new AbstractDropDown(toolBar, Messages.MenuShowHideColumns, Images.CONFIG.image(), SWT.NONE) {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            MenuManager m = new MenuManager(Messages.LabelInvestmentPlans);
            planColumns.menuAboutToShow(m);
            manager.add(m);
            m = new MenuManager(Messages.LabelTransactions);
            transactions.getColumnSupport().menuAboutToShow(m);
            manager.add(m);
        }
    };
}
Also used : AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 2 with AbstractDropDown

use of name.abuchen.portfolio.ui.util.AbstractDropDown in project portfolio by buchen.

the class AccountListView method addConfigButton.

private void addConfigButton(final ToolBar toolBar) {
    new // NOSONAR
    AbstractDropDown(// NOSONAR
    toolBar, // NOSONAR
    Messages.MenuShowHideColumns, // NOSONAR
    Images.CONFIG.image(), // NOSONAR
    SWT.NONE) {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            MenuManager m = new MenuManager(Messages.LabelAccounts);
            accountColumns.menuAboutToShow(m);
            manager.add(m);
            m = new MenuManager(Messages.LabelTransactions);
            transactionsColumns.menuAboutToShow(m);
            manager.add(m);
        }
    };
}
Also used : AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 3 with AbstractDropDown

use of name.abuchen.portfolio.ui.util.AbstractDropDown in project portfolio by buchen.

the class PortfolioListView method addConfigButton.

private void addConfigButton(final ToolBar toolBar) {
    new AbstractDropDown(toolBar, Messages.MenuShowHideColumns, Images.CONFIG.image(), SWT.NONE) {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            MenuManager m = new MenuManager(Messages.LabelPortfolios);
            portfolioColumns.menuAboutToShow(m);
            manager.add(m);
            m = new MenuManager(Messages.LabelTransactions);
            transactions.getColumnSupport().menuAboutToShow(m);
            manager.add(m);
        }
    };
}
Also used : AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 4 with AbstractDropDown

use of name.abuchen.portfolio.ui.util.AbstractDropDown in project portfolio by buchen.

the class StatementOfAssetsView method addButtons.

@Override
protected void addButtons(final ToolBar toolBar) {
    AbstractDropDown dropdown = new AbstractDropDown(toolBar, getClient().getBaseCurrency()) {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            List<CurrencyUnit> available = CurrencyUnit.getAvailableCurrencyUnits();
            Collections.sort(available);
            for (final CurrencyUnit unit : available) {
                Action action = new SimpleAction(unit.getLabel(), a -> {
                    setLabel(unit.getCurrencyCode());
                    getClient().setBaseCurrency(unit.getCurrencyCode());
                });
                action.setChecked(getClient().getBaseCurrency().equals(unit.getCurrencyCode()));
                manager.add(action);
            }
        }
    };
    currencyChangeListener = e -> dropdown.setLabel(e.getNewValue().toString());
    // $NON-NLS-1$
    getClient().addPropertyChangeListener("baseCurrency", currencyChangeListener);
    addCalendarButton(toolBar);
    this.clientFilter = new ClientFilterDropDown(toolBar, getClient(), getPreferenceStore(), StatementOfAssetsView.class.getSimpleName(), filter -> notifyModelUpdated());
    Action export = new SimpleAction(null, action -> new TableViewerCSVExporter(assetViewer.getTableViewer()).export(// $NON-NLS-1$
    Messages.LabelStatementOfAssets + ".csv"));
    export.setImageDescriptor(Images.EXPORT.descriptor());
    export.setToolTipText(Messages.MenuExportData);
    new ActionContributionItem(export).fill(toolBar, -1);
    Action save = new SimpleAction(null, a -> assetViewer.showSaveMenu(getActiveShell()));
    save.setImageDescriptor(Images.SAVE.descriptor());
    save.setToolTipText(Messages.MenuSaveColumns);
    new ActionContributionItem(save).fill(toolBar, -1);
    Action config = new SimpleAction(null, a -> assetViewer.showConfigMenu(toolBar.getShell()));
    config.setImageDescriptor(Images.CONFIG.descriptor());
    config.setToolTipText(Messages.MenuShowHideColumns);
    new ActionContributionItem(config).fill(toolBar, -1);
}
Also used : Values(name.abuchen.portfolio.money.Values) Client(name.abuchen.portfolio.model.Client) CurrencyConverterImpl(name.abuchen.portfolio.money.CurrencyConverterImpl) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) CurrencyUnit(name.abuchen.portfolio.money.CurrencyUnit) ToolBar(org.eclipse.swt.widgets.ToolBar) Images(name.abuchen.portfolio.ui.Images) Inject(javax.inject.Inject) Composite(org.eclipse.swt.widgets.Composite) AbstractFinanceView(name.abuchen.portfolio.ui.AbstractFinanceView) Messages(name.abuchen.portfolio.ui.Messages) ClientFilterDropDown(name.abuchen.portfolio.ui.util.ClientFilterDropDown) Separator(org.eclipse.jface.action.Separator) ExchangeRateProviderFactory(name.abuchen.portfolio.money.ExchangeRateProviderFactory) SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Action(org.eclipse.jface.action.Action) DateSelectionDialog(name.abuchen.portfolio.ui.dialogs.DateSelectionDialog) AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) TableViewerCSVExporter(name.abuchen.portfolio.ui.util.TableViewerCSVExporter) List(java.util.List) PropertyChangeListener(java.beans.PropertyChangeListener) IMenuManager(org.eclipse.jface.action.IMenuManager) CurrencyConverter(name.abuchen.portfolio.money.CurrencyConverter) LocalDate(java.time.LocalDate) SWT(org.eclipse.swt.SWT) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) Collections(java.util.Collections) ClientSnapshot(name.abuchen.portfolio.snapshot.ClientSnapshot) Control(org.eclipse.swt.widgets.Control) CurrencyUnit(name.abuchen.portfolio.money.CurrencyUnit) SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Action(org.eclipse.jface.action.Action) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) ClientFilterDropDown(name.abuchen.portfolio.ui.util.ClientFilterDropDown) IMenuManager(org.eclipse.jface.action.IMenuManager) SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) TableViewerCSVExporter(name.abuchen.portfolio.ui.util.TableViewerCSVExporter)

Example 5 with AbstractDropDown

use of name.abuchen.portfolio.ui.util.AbstractDropDown in project portfolio by buchen.

the class DividendsView method addButtons.

@Override
protected void addButtons(ToolBar toolBar) {
    new StartYearSelectionDropDown(toolBar, model);
    AbstractDropDown dropDown = AbstractDropDown.create(toolBar, Messages.MenuChooseClientFilter, model.getClientFilterMenu().hasActiveFilter() ? Images.FILTER_ON.image() : Images.FILTER_OFF.image(), SWT.NONE, model.getClientFilterMenu()::menuAboutToShow);
    model.getClientFilterMenu().addListener(f -> dropDown.getToolItem().setImage(model.getClientFilterMenu().hasActiveFilter() ? Images.FILTER_ON.image() : Images.FILTER_OFF.image()));
    new AbstractDropDown(toolBar, Messages.MenuExportData, Images.EXPORT.image(), SWT.NONE) {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            final int itemCount = folder.getItemCount();
            for (int ii = 0; ii < itemCount; ii++) {
                DividendsTab tab = (DividendsTab) folder.getItem(ii).getData();
                if (tab != null)
                    tab.addExportActions(manager);
            }
        }
    };
    new AbstractDropDown(toolBar, Messages.MenuConfigureChart, Images.CONFIG.image(), SWT.NONE) {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            Action action = new SimpleAction(Messages.LabelUseGrossDividends, a -> model.setUseGrossValue(!model.usesGrossValue()));
            action.setChecked(model.usesGrossValue());
            manager.add(action);
            DividendsTab tab = (DividendsTab) folder.getSelection().getData();
            if (tab != null) {
                manager.add(new Separator());
                tab.addConfigActions(manager);
            }
        }
    };
}
Also used : SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Action(org.eclipse.jface.action.Action) AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) IMenuManager(org.eclipse.jface.action.IMenuManager) SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Separator(org.eclipse.jface.action.Separator)

Aggregations

AbstractDropDown (name.abuchen.portfolio.ui.util.AbstractDropDown)5 IMenuManager (org.eclipse.jface.action.IMenuManager)5 MenuManager (org.eclipse.jface.action.MenuManager)3 SimpleAction (name.abuchen.portfolio.ui.util.SimpleAction)2 Action (org.eclipse.jface.action.Action)2 Separator (org.eclipse.jface.action.Separator)2 PropertyChangeListener (java.beans.PropertyChangeListener)1 LocalDate (java.time.LocalDate)1 Collections (java.util.Collections)1 List (java.util.List)1 Inject (javax.inject.Inject)1 Client (name.abuchen.portfolio.model.Client)1 CurrencyConverter (name.abuchen.portfolio.money.CurrencyConverter)1 CurrencyConverterImpl (name.abuchen.portfolio.money.CurrencyConverterImpl)1 CurrencyUnit (name.abuchen.portfolio.money.CurrencyUnit)1 ExchangeRateProviderFactory (name.abuchen.portfolio.money.ExchangeRateProviderFactory)1 Values (name.abuchen.portfolio.money.Values)1 ClientSnapshot (name.abuchen.portfolio.snapshot.ClientSnapshot)1 AbstractFinanceView (name.abuchen.portfolio.ui.AbstractFinanceView)1 Images (name.abuchen.portfolio.ui.Images)1