use of name.abuchen.portfolio.ui.views.columns.AttributeColumn 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.ui.views.columns.AttributeColumn in project portfolio by buchen.
the class SecuritiesTable method addAttributeColumns.
private void addAttributeColumns() {
//
getClient().getSettings().getAttributeTypes().filter(//
a -> a.supports(Security.class)).forEach(attribute -> {
Column column = new AttributeColumn(attribute);
column.setVisible(false);
column.getEditingSupport().addListener(this);
support.addColumn(column);
});
}
use of name.abuchen.portfolio.ui.views.columns.AttributeColumn in project portfolio by buchen.
the class StatementOfAssetsViewer method addAttributeColumns.
private void addAttributeColumns() {
//
client.getSettings().getAttributeTypes().filter(//
a -> a.supports(Security.class)).forEach(attribute -> {
Column column = new AttributeColumn(attribute);
column.setVisible(false);
if (column.getSorter() != null)
column.getSorter().wrap(ElementComparator::new);
column.getEditingSupport().addListener(new MarkDirtyListener(this.owner));
support.addColumn(column);
});
}
use of name.abuchen.portfolio.ui.views.columns.AttributeColumn in project portfolio by buchen.
the class AbstractNodeTreeViewer method addAdditionalColumns.
protected // NOSONAR
void addAdditionalColumns(// NOSONAR
ShowHideColumnHelper support) {
// $NON-NLS-1$
Column column = new Column("exchangeRate", Messages.ColumnExchangeRate, SWT.RIGHT, 80);
column.setGroupLabel(Messages.ColumnForeignCurrencies);
column.setLabelProvider(new // NOSONAR
ColumnLabelProvider() {
@Override
public String getText(Object element) {
TaxonomyNode node = (TaxonomyNode) element;
if (!node.isAssignment())
return null;
String baseCurrency = node.getAssignment().getInvestmentVehicle().getCurrencyCode();
if (baseCurrency == null)
return null;
CurrencyConverter converter = getModel().getCurrencyConverter();
ExchangeRate rate = converter.getRate(LocalDate.now(), baseCurrency);
if (useIndirectQuotation)
rate = rate.inverse();
return Values.ExchangeRate.format(rate.getValue());
}
@Override
public String getToolTipText(Object e) {
String text = getText(e);
if (text == null)
return null;
String term = getModel().getCurrencyConverter().getTermCurrency();
String base = ((TaxonomyNode) e).getAssignment().getInvestmentVehicle().getCurrencyCode();
return text + ' ' + (useIndirectQuotation ? base + '/' + term : term + '/' + base);
}
});
column.setVisible(false);
support.addColumn(column);
// $NON-NLS-1$
column = new Column("actBaseCurrency", Messages.ColumnActualValue + Messages.BaseCurrencyCue, SWT.RIGHT, 100);
column.setDescription(Messages.ColumnActualValueBaseCurrency);
column.setGroupLabel(Messages.ColumnForeignCurrencies);
column.setLabelProvider(new // NOSONAR
ColumnLabelProvider() {
@Override
public String getText(Object element) {
TaxonomyNode node = (TaxonomyNode) element;
if (node.isClassification() || getModel().getCurrencyCode().equals(node.getAssignment().getInvestmentVehicle().getCurrencyCode())) {
return Values.Money.format(node.getActual(), getModel().getCurrencyCode());
} else if (node.getAssignment().getInvestmentVehicle().getCurrencyCode() != null) {
// currency code (e.g. is not an stock market index)
return Values.Money.format(getModel().getCurrencyConverter().with(node.getAssignment().getInvestmentVehicle().getCurrencyCode()).convert(LocalDate.now(), node.getActual()), getModel().getCurrencyCode());
} else {
return null;
}
}
});
column.setVisible(false);
support.addColumn(column);
//
getModel().getClient().getSettings().getAttributeTypes().filter(//
a -> a.supports(Security.class)).forEach(attribute -> {
Column col = new AttributeColumn(attribute);
col.setVisible(false);
col.setSorter(null);
col.getEditingSupport().addListener(this);
support.addColumn(col);
});
}
Aggregations