-
Notifications
You must be signed in to change notification settings - Fork 614
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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$ | ||
column.setLabelProvider(new ColumnLabelProvider() | ||
{ | ||
CurrencyConverter converter = new CurrencyConverterImpl(factory, getClient().getBaseCurrency()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing translations
There was a problem hiding this comment.
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.