Search in sources :

Example 1 with LabelOnly

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

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

the class BookmarksListTab method addSubmenuWithPlaceholders.

private void addSubmenuWithPlaceholders(IMenuManager manager) {
    MenuManager submenu = new MenuManager(Messages.BookmarksListView_replacements);
    manager.add(submenu);
    @SuppressWarnings("nls") List<String> defaultReplacements = Arrays.asList(new String[] { "isin", "name", "wkn", "tickerSymbol", "tickerSymbolPrefix" });
    submenu.add(new LabelOnly(Messages.BookmarksListView_LabelDefaultReplacements));
    defaultReplacements.forEach(r -> addReplacementMenu(submenu, r));
    submenu.add(new Separator());
    submenu.add(new LabelOnly(Messages.BookmarksListView_LabelAttributeReplacements));
    client.getSettings().getAttributeTypes().filter(a -> a.supports(Security.class)).filter(a -> !defaultReplacements.contains(a.getColumnLabel())).forEach(a -> addReplacementMenu(submenu, a.getColumnLabel()));
    submenu.add(new Separator());
    submenu.add(new LabelOnly(Messages.BookmarksListView_LabelReplaceFirstAvailable));
    // $NON-NLS-1$
    addReplacementMenu(submenu, "isin,wkn");
}
Also used : ContextMenu(name.abuchen.portfolio.ui.util.ContextMenu) Arrays(java.util.Arrays) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Client(name.abuchen.portfolio.model.Client) TableViewer(org.eclipse.jface.viewers.TableViewer) Images(name.abuchen.portfolio.ui.Images) Image(org.eclipse.swt.graphics.Image) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) Inject(javax.inject.Inject) ModificationListener(name.abuchen.portfolio.ui.util.viewers.ColumnEditingSupport.ModificationListener) Composite(org.eclipse.swt.widgets.Composite) Messages(name.abuchen.portfolio.ui.Messages) StringEditingSupport(name.abuchen.portfolio.ui.util.viewers.StringEditingSupport) Separator(org.eclipse.jface.action.Separator) Shell(org.eclipse.swt.widgets.Shell) CTabFolder(org.eclipse.swt.custom.CTabFolder) MenuManager(org.eclipse.jface.action.MenuManager) SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Column(name.abuchen.portfolio.ui.util.viewers.Column) Action(org.eclipse.jface.action.Action) Security(name.abuchen.portfolio.model.Security) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) DesktopAPI(name.abuchen.portfolio.ui.util.DesktopAPI) ColumnEditingSupport(name.abuchen.portfolio.ui.util.viewers.ColumnEditingSupport) ShowHideColumnHelper(name.abuchen.portfolio.ui.util.viewers.ShowHideColumnHelper) CTabItem(org.eclipse.swt.custom.CTabItem) List(java.util.List) Bookmark(name.abuchen.portfolio.model.Bookmark) IMenuManager(org.eclipse.jface.action.IMenuManager) SWT(org.eclipse.swt.SWT) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ClientSettings(name.abuchen.portfolio.model.ClientSettings) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Security(name.abuchen.portfolio.model.Security) Separator(org.eclipse.jface.action.Separator)

Example 3 with LabelOnly

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

the class AttributesPage method menuAboutToShow.

@Override
public void menuAboutToShow(IMenuManager manager) {
    manager.add(new LabelOnly(Messages.LabelAvailableAttributes));
    Set<AttributeType> existing = new HashSet<AttributeType>();
    for (AttributeDesignation d : model.getAttributes()) existing.add(d.getType());
    // 
    model.getClient().getSettings().getAttributeTypes().filter(// 
    a -> !existing.contains(a)).filter(// 
    a -> a.supports(Security.class)).forEach(attribute -> addMenu(manager, attribute));
}
Also used : UpdateValueStrategy(org.eclipse.core.databinding.UpdateValueStrategy) Images(name.abuchen.portfolio.ui.Images) HashSet(java.util.HashSet) WidgetProperties(org.eclipse.jface.databinding.swt.WidgetProperties) IConverter(org.eclipse.core.databinding.conversion.IConverter) Composite(org.eclipse.swt.widgets.Composite) Messages(name.abuchen.portfolio.ui.Messages) BindingHelper(name.abuchen.portfolio.ui.util.BindingHelper) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) Button(org.eclipse.swt.widgets.Button) MenuManager(org.eclipse.jface.action.MenuManager) GridDataFactory(org.eclipse.jface.layout.GridDataFactory) Set(java.util.Set) Action(org.eclipse.jface.action.Action) Security(name.abuchen.portfolio.model.Security) GridLayoutFactory(org.eclipse.jface.layout.GridLayoutFactory) IValidatingConverter(name.abuchen.portfolio.ui.util.IValidatingConverter) Binding(org.eclipse.core.databinding.Binding) BeanProperties(org.eclipse.core.databinding.beans.BeanProperties) IMenuManager(org.eclipse.jface.action.IMenuManager) SWT(org.eclipse.swt.SWT) AttributeDesignation(name.abuchen.portfolio.ui.wizards.security.EditSecurityModel.AttributeDesignation) AttributeType(name.abuchen.portfolio.model.AttributeType) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) Label(org.eclipse.swt.widgets.Label) IMenuListener(org.eclipse.jface.action.IMenuListener) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) AttributeType(name.abuchen.portfolio.model.AttributeType) AttributeDesignation(name.abuchen.portfolio.ui.wizards.security.EditSecurityModel.AttributeDesignation) HashSet(java.util.HashSet)

Example 4 with LabelOnly

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

the class AccountTransactionDialog method sharesMenuAboutToShow.

private // NOSONAR
void sharesMenuAboutToShow(// NOSONAR
IMenuManager manager) {
    manager.add(new LabelOnly(Messages.DividendsDialogTitleShares));
    CurrencyConverter converter = new CurrencyConverterImpl(model.getExchangeRateProviderFactory(), client.getBaseCurrency());
    ClientSnapshot snapshot = ClientSnapshot.create(client, converter, model().getDate());
    if (snapshot != null && model().getSecurity() != null) {
        PortfolioSnapshot jointPortfolio = snapshot.getJointPortfolio();
        addAction(manager, jointPortfolio, Messages.ColumnSharesOwned);
        List<PortfolioSnapshot> list = snapshot.getPortfolios();
        if (list.size() > 1) {
            for (PortfolioSnapshot ps : list) addAction(manager, ps, ps.getPortfolio().getName());
        }
    }
    manager.add(new Action(Messages.DividendsDialogLabelSpecialDistribution) {

        @Override
        public void run() {
            model().setShares(0);
        }
    });
}
Also used : ClientSnapshot(name.abuchen.portfolio.snapshot.ClientSnapshot) Action(org.eclipse.jface.action.Action) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) PortfolioSnapshot(name.abuchen.portfolio.snapshot.PortfolioSnapshot) CurrencyConverterImpl(name.abuchen.portfolio.money.CurrencyConverterImpl) CurrencyConverter(name.abuchen.portfolio.money.CurrencyConverter)

Example 5 with LabelOnly

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

the class ClientEditorSidebar method taxonomyCreateMenuAboutToShow.

private void taxonomyCreateMenuAboutToShow(IMenuManager manager) {
    manager.add(new Action(Messages.MenuTaxonomyCreate) {

        @Override
        public void run() {
            String name = askTaxonomyName(Messages.LabelNewTaxonomy);
            if (name == null)
                return;
            Taxonomy taxonomy = new Taxonomy(name);
            taxonomy.setRootNode(new Classification(UUID.randomUUID().toString(), name));
            addAndOpenTaxonomy(taxonomy);
        }
    });
    manager.add(new Separator());
    manager.add(new LabelOnly(Messages.LabelTaxonomyTemplates));
    for (final TaxonomyTemplate template : TaxonomyTemplate.list()) {
        manager.add(new Action(template.getName()) {

            @Override
            public void run() {
                addAndOpenTaxonomy(template.build());
            }
        });
    }
}
Also used : SimpleAction(name.abuchen.portfolio.ui.util.SimpleAction) Action(org.eclipse.jface.action.Action) Taxonomy(name.abuchen.portfolio.model.Taxonomy) LabelOnly(name.abuchen.portfolio.ui.util.LabelOnly) Classification(name.abuchen.portfolio.model.Classification) TaxonomyTemplate(name.abuchen.portfolio.model.TaxonomyTemplate) Separator(org.eclipse.jface.action.Separator)

Aggregations

LabelOnly (name.abuchen.portfolio.ui.util.LabelOnly)11 IMenuManager (org.eclipse.jface.action.IMenuManager)8 Messages (name.abuchen.portfolio.ui.Messages)7 SimpleAction (name.abuchen.portfolio.ui.util.SimpleAction)7 Action (org.eclipse.jface.action.Action)7 MenuManager (org.eclipse.jface.action.MenuManager)6 Separator (org.eclipse.jface.action.Separator)6 List (java.util.List)4 Images (name.abuchen.portfolio.ui.Images)4 SWT (org.eclipse.swt.SWT)4 Composite (org.eclipse.swt.widgets.Composite)4 Display (org.eclipse.swt.widgets.Display)4 Client (name.abuchen.portfolio.model.Client)3 Collections (java.util.Collections)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 Dashboard (name.abuchen.portfolio.model.Dashboard)2 Security (name.abuchen.portfolio.model.Security)2 CurrencyConverter (name.abuchen.portfolio.money.CurrencyConverter)2 CurrencyConverterImpl (name.abuchen.portfolio.money.CurrencyConverterImpl)2