-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fixing unwanted tree group node expansion selection bug #10111
Fixing unwanted tree group node expansion selection bug #10111
Conversation
…nt: JabRef#8785. Now, once again, the mouse click is handled and consumed at the capture stage if the expansion pane is licked, therefore preventing the node from being selected.
3582ea7
to
9f18d3d
Compare
@Siedlerchr: had to fix two comment typos (apologies, was a rushed PR) -- can you re-approve please? |
Thanks for investigating the issue underneath and for your PR. However, I'm not that happy with the implementation yet, as this modifies a common utility class to fix a very specific bug and also it is not clear, what the boolean flag means from the viewpoint of the user. I will try to look into it in the next days and would ask the other reviewers not yet to merge this PR. |
Currently ViewModelTreeTableRowFactory is used only in one class (GroupTreeView) and was introduced only in March for unspecified reasons (which introduced the bug). I don't like the fix either (I didn't actually want to raise a PR, my time is limited to do any major refactoring), but I also don't like the constraints a utility class such as ViewModelTreeTableRowFactory enforces (and the many variations of it I've noticed). The idea of the class is obviously a good thing, but you cannot control where you listen: capture or bubbling phase. Would be good to have a common pattern or approach (for all of these factory utils) with a way to allow you to specify whether what you need is a listener vs. handler. Happy to implement it whatever way you want, if it isn't a mountain of work... |
I introduced this utility class back then, because we already have a pattern of similar utility classes and I wanted to clean up the GroupTreeView class, which was a mess back then. jabref/src/main/java/org/jabref/gui/groups/GroupTreeView.java Lines 227 to 233 in 5e4cb4e
|
I explained this a little bit in the comment here: #8785 The event.consume() is working in main, it's just too late (bubbling phase) -- the node has already selected itself during the capture phase. It worked before your refactor in March because it was using an event filter, which is called during the capture stage, and consumed before the node could select itself. But your March change, unknowingly, changed it to use an event handler, which is called during the bubbling stage; that is too late as the node is already selected.
E.g.:
My PR changes it back to using an event filter, and it works again. ExampleE.g.: the arrow gets clicked, and something like the following happens:
The main branch with the bug is this:
My PR (and pre-March) is this:
The boolean controlling this is also documented in src/main/java/org/jabref/gui/util/ViewModelTreeTableRowFactory.java:
|
I worked a little bit on your PR and modified the utility class to also forward event filters. Tested it, the bug is still fixed, but we can avoid the boolean and and the a misunderstandable withOnMouseClicked method by providing a more generic utility class. |
Thanks for your effort debugging this issue and providing the solution rationale. |
Looks good! |
Fixing bug introduced in #9728 which undid/broke this improvement: #8785, which prevented the group node from being selected when the user is just attempting to expand or shrink the tree node. Now, once again, the mouse click is handled and consumed at the capture stage if the expansion pane is clicked, therefore preventing the node from being selected.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)