Search in sources :

Example 1 with ClientFilterDropDown

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

the class PerformanceView method addButtons.

@Override
protected void addButtons(ToolBar toolBar) {
    super.addButtons(toolBar);
    this.clientFilter = new ClientFilterDropDown(toolBar, getClient(), getPreferenceStore(), PerformanceView.class.getSimpleName(), filter -> notifyModelUpdated());
    // NOSONAR
    new ExportDropDown(toolBar);
}
Also used : Client(name.abuchen.portfolio.model.Client) Transaction(name.abuchen.portfolio.model.Transaction) TableViewer(org.eclipse.jface.viewers.TableViewer) CurrencyConverterImpl(name.abuchen.portfolio.money.CurrencyConverterImpl) ToolBar(org.eclipse.swt.widgets.ToolBar) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) TransactionOwner(name.abuchen.portfolio.model.TransactionOwner) ESelectionService(org.eclipse.e4.ui.workbench.modeling.ESelectionService) Composite(org.eclipse.swt.widgets.Composite) ReportingPeriod(name.abuchen.portfolio.snapshot.ReportingPeriod) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) Account(name.abuchen.portfolio.model.Account) CTabFolder(org.eclipse.swt.custom.CTabFolder) ExchangeRateProviderFactory(name.abuchen.portfolio.money.ExchangeRateProviderFactory) ClientPerformanceSnapshot(name.abuchen.portfolio.snapshot.ClientPerformanceSnapshot) Security(name.abuchen.portfolio.model.Security) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) ShowHideColumnHelper(name.abuchen.portfolio.ui.util.viewers.ShowHideColumnHelper) CurrencyConverter(name.abuchen.portfolio.money.CurrencyConverter) SWT(org.eclipse.swt.SWT) TreeViewer(org.eclipse.jface.viewers.TreeViewer) SecuritySelection(name.abuchen.portfolio.ui.selection.SecuritySelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GroupEarningsByAccount(name.abuchen.portfolio.snapshot.GroupEarningsByAccount) PortfolioTransaction(name.abuchen.portfolio.model.PortfolioTransaction) Values(name.abuchen.portfolio.money.Values) NoteColumn(name.abuchen.portfolio.ui.views.columns.NoteColumn) Images(name.abuchen.portfolio.ui.Images) Image(org.eclipse.swt.graphics.Image) CrossEntry(name.abuchen.portfolio.model.CrossEntry) JFaceResources(org.eclipse.jface.resource.JFaceResources) Function(java.util.function.Function) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) MessageFormat(java.text.MessageFormat) Inject(javax.inject.Inject) Messages(name.abuchen.portfolio.ui.Messages) Font(org.eclipse.swt.graphics.Font) Portfolio(name.abuchen.portfolio.model.Portfolio) ClientFilterDropDown(name.abuchen.portfolio.ui.util.ClientFilterDropDown) Viewer(org.eclipse.jface.viewers.Viewer) AccountTransaction(name.abuchen.portfolio.model.AccountTransaction) TransactionPair(name.abuchen.portfolio.model.TransactionPair) SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Column(name.abuchen.portfolio.ui.util.viewers.Column) ColumnViewerSorter(name.abuchen.portfolio.ui.util.viewers.ColumnViewerSorter) TreeViewerCSVExporter(name.abuchen.portfolio.ui.util.TreeViewerCSVExporter) AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) TableViewerCSVExporter(name.abuchen.portfolio.ui.util.TableViewerCSVExporter) CTabItem(org.eclipse.swt.custom.CTabItem) Unit(name.abuchen.portfolio.model.Transaction.Unit) IMenuManager(org.eclipse.jface.action.IMenuManager) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) Control(org.eclipse.swt.widgets.Control) ClientFilterDropDown(name.abuchen.portfolio.ui.util.ClientFilterDropDown)

Example 2 with ClientFilterDropDown

use of name.abuchen.portfolio.ui.util.ClientFilterDropDown 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)

Aggregations

Inject (javax.inject.Inject)2 Client (name.abuchen.portfolio.model.Client)2 CurrencyConverter (name.abuchen.portfolio.money.CurrencyConverter)2 CurrencyConverterImpl (name.abuchen.portfolio.money.CurrencyConverterImpl)2 ExchangeRateProviderFactory (name.abuchen.portfolio.money.ExchangeRateProviderFactory)2 Values (name.abuchen.portfolio.money.Values)2 Images (name.abuchen.portfolio.ui.Images)2 Messages (name.abuchen.portfolio.ui.Messages)2 AbstractDropDown (name.abuchen.portfolio.ui.util.AbstractDropDown)2 ClientFilterDropDown (name.abuchen.portfolio.ui.util.ClientFilterDropDown)2 SimpleAction (name.abuchen.portfolio.ui.util.SimpleAction)2 TableViewerCSVExporter (name.abuchen.portfolio.ui.util.TableViewerCSVExporter)2 IMenuManager (org.eclipse.jface.action.IMenuManager)2 SWT (org.eclipse.swt.SWT)2 Composite (org.eclipse.swt.widgets.Composite)2 Control (org.eclipse.swt.widgets.Control)2 ToolBar (org.eclipse.swt.widgets.ToolBar)2 PropertyChangeListener (java.beans.PropertyChangeListener)1 MessageFormat (java.text.MessageFormat)1 LocalDate (java.time.LocalDate)1