Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PortfolioListView: Add column with balance of reference account #4388

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.text.MessageFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;

import jakarta.annotation.PostConstruct;
Expand Down Expand Up @@ -256,6 +258,23 @@ public String getText(Object element)
}));
portfolioColumns.addColumn(column);

column = new Column("ref_cash_bal", "Balance of reference account", SWT.RIGHT, 100); //$NON-NLS-1$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing translations

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should re-use the label from the account view: ColumnBalance

It works nicely in German: Depotvolumen vs. Kontostand

But maybe not so well in other languages.

column.setLabelProvider(new ColumnLabelProvider()
{
CurrencyConverter converter = new CurrencyConverterImpl(factory, getClient().getBaseCurrency());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The converter is not used. The balance will be shown in the account currency. Is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The converter is not used. The balance will be shown in the account currency. Is this intended?

Yeah, it's clearly was a copy-paste issue, where label provider was initially copied from security balance column, but the getText() then was copied from AccountListView, leaving converter unused.

Thanks for taking care of the patch!


@Override
public String getText(Object element)
{
Portfolio p = (Portfolio) element;
var refAcc = p.getReferenceAccount();
return Values.Amount.format((refAcc.getCurrentAmount(LocalDateTime.now().with(LocalTime.MAX))));
}
});
ColumnViewerSorter.create(o -> ((Portfolio) o).getReferenceAccount().getCurrentAmount(LocalDateTime.now().with(LocalTime.MAX)))
.attachTo(column);
portfolioColumns.addColumn(column);

column = new NoteColumn();
column.getEditingSupport().addListener(this);
portfolioColumns.addColumn(column);
Expand Down
Loading