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);
}
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);
});
}
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);
}
}
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);
}
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());
}
}
});
}
Aggregations