-
Notifications
You must be signed in to change notification settings - Fork 639
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
Feature grouped accounts #4476
base: master
Are you sure you want to change the base?
Feature grouped accounts #4476
Conversation
Hello @buchen many thanks for the review. I will look into it. Regarding the Named interface : the goal was to make the label/name appear in the Information Pane : a Named adaption is used at some point to print the label. without it :
If it is better to update setInput, it can be modified there instead. Good catch for the two open points. I will look into it. For the ordering of the accounts : I think the Taxonomy drag & drop way could be reused. There it is possible to drag elements and not just main nodes. I went the easy way and used the drag&drop methods from EditClientFilterDialog which was straightforward instead of taxonomy. Otherwise it is possible to sort by the Value column. |
Yes, you are right. Now I remember. The problem is, that a filtered client may not have all instruments and then it does not work to resolve the assignments. I'll fix that. (We are "on the road" this weekend so it will take a couple days).
Ok, okay, understood. It is unfortunate that the Named (the name) and the Annotated (the note) depend on each other.
To be honest, I found that also confusing. Particularly, if I select an account, it does not mean that the group of this account is shown. It could be an arbitrary other one. Why not show infos for the group, if the group is selected? and the infos for the account, if the account is selected? Then one can easily check for example in the holdings chart where does the position come from. |
I have started some propositions there : master...mierin12:portfolio:pr-4476-modified
Yes I was not super satisfied by this either. I will look into it. The challenge is that the different panes are not the same depending on if a Cash Account or a Security Account or a Grouped Account is selected. |
Proposition done in https://github.com/mierin12/portfolio/tree/pr-4476-modified
I think it is possible for Holdings and Statement of Assets, but for Balance Chart this seems less trivial. I reused c4347d2 and its needs more info than clientFilter. |
I have proposed an extension of the drag and drop. To be noted : it has no effect if a column is sorted (such as the Balance column or Note column). Should a drag & drop action reset the sorted state of a column ? In addition, maybe the Name column could be sortable but only for the sub elements, while top level Grouped Account are only movable through the d&d. |
Good point. I agree. Drag & Drop does not make sense if it then creates no change because the values remain as sorted by the column. Maybe drag & drop for the accounts (cash and portfolio) does not make sense... What about this behavior:
|
Or there is also the behaviour of the Taxonomy which I think is quite good, it allows both drag and drop and sorting. There, the sort is not a "continuous" sort but a one time action, which therefore does not prevent a future drag & drop. |
Well, in the groups you can have the same account in multiple cash groups. If we allow drag and drop there, you also have to take care of this. For example, if you drop the account in a group where the account is already present, does it just remove the account from the previous group? If we do drag and drop, then I would say we should split the view. On the left side are the groups, on the right side is a list of all accounts. And one can drag and drop an account from the left side into a group. Within the group, I do not think we need an order. Or, more precisely, we should just use the order that is given from ordering a particular column. I am not sure I want to apply the taxonomy behavior here. It is custom ordering which is then persisted in the XML. In the taxonomy, the thinking was that uses want a specific order of classifications and want to order securities (I do that often when thinking about rebalancing - my "favorite" of a category is on the top). But a group does not need an order. I'll have a look at your additional commits later this week. |
Hello @buchen, I apologize for the delay ! Understood, I have now revert the "taxonomy drag& drop" :
I think I have also fixed the TaxonomyView. I think it is looking good from UI point of view ! Maybe the code can be optimized though. Maybe a detail still, in Taxonomy View : the "non null filter" stays on even outside of the list and rebalancing view (only views where it is used). I am not sure if it should grey out when switching view or if this would be a strange behaviour. There is an hardcode limit of 30 grouped account. I found this : #738 (comment) |
Hey, no need to apologize. If somebody has to apologize than it is me. I just did not find a big enough chunk of time to look into this one. It might not work out during the week. Hopefully next weekend. |
Good catch. I think we can get rid of this now. It was back when there was no way to delete the filter. Plus the menu would become arbitrarily long. |
* New navigation item to managed 'grouped account' * Allow editing groups (= filter) in the new view * Allow drag & drop to reorder the groups * New icon representing grouped accounts * Update information pane with grouped account (= filter) Issue: #446
4ae182f
to
37e5e42
Compare
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.
Hello Andreas, I have mode some comments (I finally learned how to use the code review feature).
My notes and summary:
Main new comments :
- There was one bug with the Taxonomy view, where the active ClientFilter was not taken into account when initialiazing the view. I have made a proposition of fix in the review.
- Proposition to grey-out the inactive accounts of the Grouped Filters
Then, some notes to sum up the current UI behavior (I tend to forget what is the current behavior, as there was some back & forth):
SORT and DRAG & DROP :
- Main nodes can be ordered through drag & drop and therefore not by column sort.
- On the opposite, sub-elements are not dragable, but are sortable by column sort.
-> Ok with this behavior ?
-> Should a hint be provided that drag & drop is available in this view ?
RENAME THROUGH DOUBLE CLICK :
- Double click on the main nodes allows to rename them and makes the client dirty.
- Double click on sub accounts does not allow to rename them.
-> I do not know how to deal with it. We can't have two different StringEditingSupport, right ?
new StringEditingSupport(ClientFilterMenu.Item.class, "label").setMandatory(true).addListener(this).attachTo(column);
gives the current behavior, while :
new StringEditingSupport(Named.class, "name").setMandatory(true).addListener(this).attachTo(column);
allows to rename the subaccounts but not the main ones.
If ClientFilterMenu.Item is made into a Named class, this can work, but the Named class brings Annotated.
NOTE COLUMN :
- Notes are active for sub-element, but not for the main nodes.
-> Ok with it ?
-> Maybe the column could be simply removed and not available at all
EXPANDED/COLLAPSE STATE :
- Is remembered when switching view or when reopening a closed file.
-> Would a "Collapse all" action be interesting ?
LABELS :
- There are some MessageLabels can we can further modify to complete the change from "filter" to "grouped accounts" labels.
-> If the semantic change is confirmed, I can propose the changes.
BOTTOM PANES :
- Statement of Asset : I tried to shoehorn Account in this, I think this work, but I am assuming some code improvement could be existing, lots of if/else as you said.
- Holding Chart : I tried to shoehorn Account in this, I think this work, but I am assuming some code improvement could be existing, several of if/else as you said. It is adding a SnapshotName attribute to ClientSnapshot. To be noted that a Holding chart for an Account is simply 100% holdings.
- Balance Chart : this one is more complex, first a new Pane class has been created to see if the input is an Account or not. If yes, we use the AccountBalancePane, otherwise the PortfolioBalancePane. PortfolioBalancePane and the PortfolioBalanceChart are modified to take into account ClientFilterMenu.Item as input.
CODE DUPLICATION :
I used in GroupedAccountListView several methods from EditClientFilterDialog (drag and drop, insert/delete elements actions). The methods are quite close. I am not sure how to optimize/factorize this (and if we should).
|
||
this.clientFilterDropDown = new ClientFilterDropDown(getClient(), getPreferenceStore(), | ||
TaxonomyView.class.getSimpleName() + "-" + taxonomy.getId(), filter -> { | ||
setInformationPaneInput(null); | ||
Client filteredClient = filter.filter(getClient()); | ||
setToContext(UIConstants.Context.FILTERED_CLIENT, filteredClient); | ||
model.updateClientSnapshot(filteredClient); | ||
updateTitle(getDefaultTitle()); | ||
}); | ||
|
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.
this.clientFilterDropDown = new ClientFilterDropDown(getClient(), getPreferenceStore(), | |
TaxonomyView.class.getSimpleName() + "-" + taxonomy.getId(), filter -> { | |
setInformationPaneInput(null); | |
Client filteredClient = filter.filter(getClient()); | |
setToContext(UIConstants.Context.FILTERED_CLIENT, filteredClient); | |
model.updateClientSnapshot(filteredClient); | |
updateTitle(getDefaultTitle()); | |
}); | |
this.model = new TaxonomyModel(factory, getClient(), taxonomy); | |
Consumer<ClientFilter> listener = filter -> { | |
setInformationPaneInput(null); | |
Client filteredClient = filter.filter(getClient()); | |
setToContext(UIConstants.Context.FILTERED_CLIENT, filteredClient); | |
model.updateClientSnapshot(filteredClient); | |
}; | |
this.clientFilterDropDown = new ClientFilterDropDown(getClient(), getPreferenceStore(), | |
TaxonomyView.class.getSimpleName() + "-" + taxonomy.getId(), listener); //$NON-NLS-1$ | |
// As the taxonomy model is initially calculated in the #init | |
// method, we must recalculate the values if an active filter | |
// exists. | |
if (this.clientFilterDropDown.hasActiveFilter()) | |
listener.accept(this.clientFilterDropDown.getSelectedFilter()); | |
this.clientFilterDropDown.getClientFilterMenu().addListener(filter -> updateTitle(getDefaultTitle())); | |
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 think the Taxonomy view was not initialized correctly while a ClientFilter was active (despite an active client filter, the whole portfolio was still used by taxonomy view. It worked while changing the selection but not at initialization) :
1-
if (this.clientFilterDropDown.hasActiveFilter())
listener.accept(this.clientFilterDropDown.getSelectedFilter());
fixes this (and was already there before), we just need this.model
to be non null, so I moved it on top
2- however after this change, the updateTitle
in the listener fails at initialization (Label title
in AbstractFinanceView is null) so I am adding it outside of the initial listener
I think it works now, Consumer and ClientFilter needs to be imported again, and the second this.model
has to be removed (but i did not manage to review unmodified lines), so like this: 7a21b16
else | ||
return super.getImage(element); | ||
} | ||
}); |
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.
}); | |
@Override | |
public Color getForeground(Object e) | |
{ | |
boolean isRetired; | |
switch (e) | |
{ | |
case Portfolio portfolio -> isRetired = portfolio.isRetired(); | |
case Account account -> isRetired = account.isRetired(); | |
default -> isRetired = false; | |
} | |
return isRetired ? Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY) : null; | |
} | |
}); |
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.
Grouped Accounts can possess both active and retired accounts : proposition to show the retired accounts as gray, same as in Portfolio List/Account List. it needs import org.eclipse.swt.graphics.Color
LocalDate start = now; // init to be changed ? | ||
LocalDate end = now; // init to be changed ? |
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.
LocalDate start = now; // init to be changed ? | |
LocalDate end = now; // init to be changed ? | |
LocalDate start = now; | |
LocalDate end = now; |
public Interval getInterval(ClientFilterMenu.Item groupedAccount) | ||
{ |
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.
This is from me, maybe there is a better approach for this method getInterval. Concatenating all transactions of all portfolios in a single list and then take the min/max of this list ?
Could account and portfolio transactions be combined by
groupedAccount.getFilter().filter(client).getAllTransactions(); ?
But then Collections.sort(tx, Transaction.BY_DATE); fails.
Continuation of #4466
(possible) open items: