Search in sources :

Example 1 with TableViewerCSVExporter

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

the class SecuritiesPerformanceView method addExportButton.

private void addExportButton(ToolBar toolBar) {
    Action export = new Action() {

        @Override
        public void run() {
            // $NON-NLS-1$
            new TableViewerCSVExporter(records).export(getTitle() + ".csv");
        }
    };
    export.setImageDescriptor(Images.EXPORT.descriptor());
    export.setToolTipText(Messages.MenuExportData);
    new ActionContributionItem(export).fill(toolBar, -1);
}
Also used : Action(org.eclipse.jface.action.Action) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) TableViewerCSVExporter(name.abuchen.portfolio.ui.util.TableViewerCSVExporter)

Example 2 with TableViewerCSVExporter

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

the class SecurityListView method addExportButton.

private void addExportButton(ToolBar toolBar) {
    Action export = new Action() {

        @Override
        public void run() {
            // 
            new TableViewerCSVExporter(securities.getTableViewer()).export(// $NON-NLS-1$
            getTitle() + ".csv");
        }
    };
    export.setImageDescriptor(Images.EXPORT.descriptor());
    export.setToolTipText(Messages.MenuExportData);
    new ActionContributionItem(export).fill(toolBar, -1);
}
Also used : ConvertBuySellToDeliveryAction(name.abuchen.portfolio.ui.views.actions.ConvertBuySellToDeliveryAction) ConvertDeliveryToBuySellAction(name.abuchen.portfolio.ui.views.actions.ConvertDeliveryToBuySellAction) SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Action(org.eclipse.jface.action.Action) OpenDialogAction(name.abuchen.portfolio.ui.dialogs.transactions.OpenDialogAction) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) TableViewerCSVExporter(name.abuchen.portfolio.ui.util.TableViewerCSVExporter)

Example 3 with TableViewerCSVExporter

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

TableViewerCSVExporter (name.abuchen.portfolio.ui.util.TableViewerCSVExporter)3 Action (org.eclipse.jface.action.Action)3 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)3 SimpleAction (name.abuchen.portfolio.ui.util.SimpleAction)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 Messages (name.abuchen.portfolio.ui.Messages)1 DateSelectionDialog (name.abuchen.portfolio.ui.dialogs.DateSelectionDialog)1