Search in sources :

Example 16 with Taxonomy

use of name.abuchen.portfolio.model.Taxonomy in project portfolio by buchen.

the class ClientEditorSidebar method taxonomyContextMenuAboutToShow.

private void taxonomyContextMenuAboutToShow(Taxonomy taxonomy, Entry entry, IMenuManager manager) {
    manager.add(new Action(Messages.MenuTaxonomyRename) {

        @Override
        public void run() {
            String newName = askTaxonomyName(taxonomy.getName());
            if (newName != null) {
                taxonomy.setName(newName);
                editor.markDirty();
                entry.setLabel(newName);
            }
        }
    });
    manager.add(new Action(Messages.MenuTaxonomyCopy) {

        @Override
        public void run() {
            String newName = askTaxonomyName(MessageFormat.format(Messages.LabelNamePlusCopy, taxonomy.getName()));
            if (newName != null) {
                Taxonomy copy = taxonomy.copy();
                copy.setName(newName);
                addAndOpenTaxonomy(copy);
            }
        }
    });
    manager.add(new Action(Messages.MenuTaxonomyDelete) {

        @Override
        public void run() {
            editor.getClient().removeTaxonomy(taxonomy);
            editor.markDirty();
            entry.dispose();
            statementOfAssets.select();
            scrolledComposite.setMinSize(sidebar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }
    });
    manager.add(new Separator());
    addMoveUpAndDownActions(taxonomy, entry, manager);
    manager.add(new Separator());
    setAsStartPage.menuAboutToShow(entry, manager);
}
Also used : SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Action(org.eclipse.jface.action.Action) Taxonomy(name.abuchen.portfolio.model.Taxonomy) Separator(org.eclipse.jface.action.Separator)

Example 17 with Taxonomy

use of name.abuchen.portfolio.model.Taxonomy in project portfolio by buchen.

the class SecuritiesPerformanceView method createAdditionalColumns.

private void createAdditionalColumns() {
    for (Taxonomy taxonomy : getClient().getTaxonomies()) {
        Column column = new TaxonomyColumn(taxonomy);
        column.setVisible(false);
        recordColumns.addColumn(column);
    }
    // 
    getClient().getSettings().getAttributeTypes().filter(// 
    a -> a.supports(Security.class)).forEach(attribute -> {
        Column column = new AttributeColumn(attribute);
        column.setVisible(false);
        column.setEditingSupport(null);
        recordColumns.addColumn(column);
    });
}
Also used : NameColumn(name.abuchen.portfolio.ui.views.columns.NameColumn) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Client(name.abuchen.portfolio.model.Client) Transaction(name.abuchen.portfolio.model.Transaction) TableViewer(org.eclipse.jface.viewers.TableViewer) CurrencyConverterImpl(name.abuchen.portfolio.money.CurrencyConverterImpl) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) DND(org.eclipse.swt.dnd.DND) ToolBar(org.eclipse.swt.widgets.ToolBar) ReportingPeriodListener(name.abuchen.portfolio.ui.util.ReportingPeriodDropDown.ReportingPeriodListener) SecurityDragListener(name.abuchen.portfolio.ui.dnd.SecurityDragListener) ESelectionService(org.eclipse.e4.ui.workbench.modeling.ESelectionService) Composite(org.eclipse.swt.widgets.Composite) ColumnViewerToolTipSupport(org.eclipse.jface.viewers.ColumnViewerToolTipSupport) ReportingPeriod(name.abuchen.portfolio.snapshot.ReportingPeriod) Separator(org.eclipse.jface.action.Separator) ClientFilter(name.abuchen.portfolio.snapshot.filter.ClientFilter) CTabFolder(org.eclipse.swt.custom.CTabFolder) ExchangeRateProviderFactory(name.abuchen.portfolio.money.ExchangeRateProviderFactory) Predicate(java.util.function.Predicate) SashLayout(name.abuchen.portfolio.ui.util.swt.SashLayout) Set(java.util.Set) Security(name.abuchen.portfolio.model.Security) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) SecurityPerformanceRecord(name.abuchen.portfolio.snapshot.security.SecurityPerformanceRecord) Collectors(java.util.stream.Collectors) ColumnEditingSupport(name.abuchen.portfolio.ui.util.viewers.ColumnEditingSupport) GridLayoutFactory(org.eclipse.jface.layout.GridLayoutFactory) DividendInitialTransaction(name.abuchen.portfolio.snapshot.security.DividendInitialTransaction) Transfer(org.eclipse.swt.dnd.Transfer) ShowHideColumnHelper(name.abuchen.portfolio.ui.util.viewers.ShowHideColumnHelper) List(java.util.List) TaxonomyColumn(name.abuchen.portfolio.ui.views.columns.TaxonomyColumn) CurrencyConverter(name.abuchen.portfolio.money.CurrencyConverter) AttributeColumn(name.abuchen.portfolio.ui.views.columns.AttributeColumn) LocalDate(java.time.LocalDate) SWT(org.eclipse.swt.SWT) SecurityTransfer(name.abuchen.portfolio.ui.dnd.SecurityTransfer) SecuritySelection(name.abuchen.portfolio.ui.selection.SecuritySelection) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) PortfolioTransaction(name.abuchen.portfolio.model.PortfolioTransaction) Values(name.abuchen.portfolio.money.Values) NoteColumn(name.abuchen.portfolio.ui.views.columns.NoteColumn) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ClientFilterMenu(name.abuchen.portfolio.ui.util.ClientFilterMenu) Images(name.abuchen.portfolio.ui.Images) Image(org.eclipse.swt.graphics.Image) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) IsinColumn(name.abuchen.portfolio.ui.views.columns.IsinColumn) SecurityPerformanceSnapshot(name.abuchen.portfolio.snapshot.security.SecurityPerformanceSnapshot) MessageFormat(com.ibm.icu.text.MessageFormat) Messages(name.abuchen.portfolio.ui.Messages) ReportingPeriodDropDown(name.abuchen.portfolio.ui.util.ReportingPeriodDropDown) MarkDirtyListener(name.abuchen.portfolio.ui.util.viewers.ColumnEditingSupport.MarkDirtyListener) Taxonomy(name.abuchen.portfolio.model.Taxonomy) DividendTransaction(name.abuchen.portfolio.snapshot.security.DividendTransaction) MoneyColorLabelProvider(name.abuchen.portfolio.ui.util.viewers.MoneyColorLabelProvider) NumberColorLabelProvider(name.abuchen.portfolio.ui.util.viewers.NumberColorLabelProvider) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) SashLayoutData(name.abuchen.portfolio.ui.util.swt.SashLayoutData) Iterator(java.util.Iterator) Viewer(org.eclipse.jface.viewers.Viewer) AccountTransaction(name.abuchen.portfolio.model.AccountTransaction) Column(name.abuchen.portfolio.ui.util.viewers.Column) ColumnViewerSorter(name.abuchen.portfolio.ui.util.viewers.ColumnViewerSorter) Action(org.eclipse.jface.action.Action) DividendFinalTransaction(name.abuchen.portfolio.snapshot.security.DividendFinalTransaction) AbstractDropDown(name.abuchen.portfolio.ui.util.AbstractDropDown) TableViewerCSVExporter(name.abuchen.portfolio.ui.util.TableViewerCSVExporter) CTabItem(org.eclipse.swt.custom.CTabItem) SharesLabelProvider(name.abuchen.portfolio.ui.util.viewers.SharesLabelProvider) IMenuManager(org.eclipse.jface.action.IMenuManager) ToolTip(org.eclipse.jface.window.ToolTip) SWTHelper(name.abuchen.portfolio.ui.util.SWTHelper) AttributeColumn(name.abuchen.portfolio.ui.views.columns.AttributeColumn) Taxonomy(name.abuchen.portfolio.model.Taxonomy) NameColumn(name.abuchen.portfolio.ui.views.columns.NameColumn) TaxonomyColumn(name.abuchen.portfolio.ui.views.columns.TaxonomyColumn) AttributeColumn(name.abuchen.portfolio.ui.views.columns.AttributeColumn) NoteColumn(name.abuchen.portfolio.ui.views.columns.NoteColumn) IsinColumn(name.abuchen.portfolio.ui.views.columns.IsinColumn) Column(name.abuchen.portfolio.ui.util.viewers.Column) TaxonomyColumn(name.abuchen.portfolio.ui.views.columns.TaxonomyColumn)

Example 18 with Taxonomy

use of name.abuchen.portfolio.model.Taxonomy in project portfolio by buchen.

the class StatementOfAssetsViewer method addTaxonomyColumns.

private void addTaxonomyColumns() {
    for (Taxonomy t : client.getTaxonomies()) {
        Column column = new TaxonomyColumn(t);
        column.setVisible(false);
        if (column.getSorter() != null)
            column.getSorter().wrap(ElementComparator::new);
        support.addColumn(column);
    }
}
Also used : GroupByTaxonomy(name.abuchen.portfolio.snapshot.GroupByTaxonomy) Taxonomy(name.abuchen.portfolio.model.Taxonomy) NameColumn(name.abuchen.portfolio.ui.views.columns.NameColumn) TaxonomyColumn(name.abuchen.portfolio.ui.views.columns.TaxonomyColumn) AttributeColumn(name.abuchen.portfolio.ui.views.columns.AttributeColumn) NoteColumn(name.abuchen.portfolio.ui.views.columns.NoteColumn) IsinColumn(name.abuchen.portfolio.ui.views.columns.IsinColumn) Column(name.abuchen.portfolio.ui.util.viewers.Column) TaxonomyColumn(name.abuchen.portfolio.ui.views.columns.TaxonomyColumn)

Example 19 with Taxonomy

use of name.abuchen.portfolio.model.Taxonomy in project portfolio by buchen.

the class StatementOfAssetsViewer method menuAboutToShow.

private // NOSONAR
void menuAboutToShow(// NOSONAR
IMenuManager manager) {
    manager.add(new LabelOnly(Messages.LabelTaxonomies));
    for (final Taxonomy t : client.getTaxonomies()) {
        Action action = new Action(t.getName()) {

            @Override
            public void run() {
                taxonomy = t;
                if (clientSnapshot != null)
                    internalSetInput(clientSnapshot.groupByTaxonomy(taxonomy));
                else
                    internalSetInput(portfolioSnapshot.groupByTaxonomy(taxonomy));
            }
        };
        action.setChecked(t.equals(taxonomy));
        manager.add(action);
    }
    manager.add(new Separator());
    manager.add(new LabelOnly(Messages.LabelColumns));
    support.menuAboutToShow(manager);
}
Also used : Action(org.eclipse.jface.action.Action) GroupByTaxonomy(name.abuchen.portfolio.snapshot.GroupByTaxonomy) Taxonomy(name.abuchen.portfolio.model.Taxonomy) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) Separator(org.eclipse.jface.action.Separator)

Example 20 with Taxonomy

use of name.abuchen.portfolio.model.Taxonomy in project portfolio by buchen.

the class OpenSampleHandler method applyTaxonomyLabels.

private void applyTaxonomyLabels(TaxonomyTemplate template, Taxonomy taxonomy) {
    Taxonomy original = template.buildOriginal();
    taxonomy.setName(original.getName());
    taxonomy.setDimensions(original.getDimensions());
    Map<String, Classification> translated = // 
    original.getAllClassifications().stream().collect(Collectors.toMap(c -> c.getId(), c -> c));
    taxonomy.foreach(new Visitor() {

        @Override
        public void visit(Classification classification) {
            Classification t = translated.get(classification.getId());
            if (t != null) {
                classification.setName(t.getName());
                classification.setNote(t.getNote());
            }
        }
    });
}
Also used : Client(name.abuchen.portfolio.model.Client) IServiceConstants(org.eclipse.e4.ui.services.IServiceConstants) ProgressMonitorInputStream(name.abuchen.portfolio.util.ProgressMonitorInputStream) EPartService(org.eclipse.e4.ui.workbench.modeling.EPartService) Execute(org.eclipse.e4.core.di.annotations.Execute) Classification(name.abuchen.portfolio.model.Classification) MPartStack(org.eclipse.e4.ui.model.application.ui.basic.MPartStack) Visitor(name.abuchen.portfolio.model.Taxonomy.Visitor) Inject(javax.inject.Inject) MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) TokenReplacingReader(name.abuchen.portfolio.util.TokenReplacingReader) ResourceBundle(java.util.ResourceBundle) Map(java.util.Map) ClientFactory(name.abuchen.portfolio.model.ClientFactory) Named(javax.inject.Named) ITokenResolver(name.abuchen.portfolio.util.TokenReplacingReader.ITokenResolver) Taxonomy(name.abuchen.portfolio.model.Taxonomy) TaxonomyTemplate(name.abuchen.portfolio.model.TaxonomyTemplate) UIConstants(name.abuchen.portfolio.ui.UIConstants) MApplication(org.eclipse.e4.ui.model.application.MApplication) Shell(org.eclipse.swt.widgets.Shell) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) MissingResourceException(java.util.MissingResourceException) IOException(java.io.IOException) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) InvocationTargetException(java.lang.reflect.InvocationTargetException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) UISynchronize(org.eclipse.e4.ui.di.UISynchronize) PortfolioPlugin(name.abuchen.portfolio.ui.PortfolioPlugin) EModelService(org.eclipse.e4.ui.workbench.modeling.EModelService) PartState(org.eclipse.e4.ui.workbench.modeling.EPartService.PartState) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) InputStream(java.io.InputStream) Visitor(name.abuchen.portfolio.model.Taxonomy.Visitor) Taxonomy(name.abuchen.portfolio.model.Taxonomy) Classification(name.abuchen.portfolio.model.Classification)

Aggregations

Taxonomy (name.abuchen.portfolio.model.Taxonomy)32 Client (name.abuchen.portfolio.model.Client)25 Security (name.abuchen.portfolio.model.Security)24 LocalDate (java.time.LocalDate)22 Test (org.junit.Test)22 TestCurrencyConverter (name.abuchen.portfolio.TestCurrencyConverter)21 Classification (name.abuchen.portfolio.model.Classification)19 IOException (java.io.IOException)17 ArrayList (java.util.ArrayList)17 Collectors (java.util.stream.Collectors)17 List (java.util.List)16 AccountTransaction (name.abuchen.portfolio.model.AccountTransaction)16 ClientFactory (name.abuchen.portfolio.model.ClientFactory)16 Values (name.abuchen.portfolio.money.Values)16 PerformanceIndex (name.abuchen.portfolio.snapshot.PerformanceIndex)16 ReportingPeriod (name.abuchen.portfolio.snapshot.ReportingPeriod)16 ClientClassificationFilter (name.abuchen.portfolio.snapshot.filter.ClientClassificationFilter)16 LocalDateTime (java.time.LocalDateTime)15 CurrencyUnit (name.abuchen.portfolio.money.CurrencyUnit)15 Money (name.abuchen.portfolio.money.Money)15