RFR: 8193442: Removing TreeItem from a TreeTableView sometime changes selectedItem

Kevin Rushforth kcr at openjdk.java.net
Tue Mar 15 19:00:50 UTC 2022


On Mon, 14 Mar 2022 14:49:41 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> This PR fixes JDK-[8193442](https://bugs.openjdk.java.net/browse/JDK-8193442), but also [JDK-8187596](https://bugs.openjdk.java.net/browse/JDK-8187596), and verifies that the tests mentioned in [JDK-8088157](https://bugs.openjdk.java.net/browse/JDK-8088157) are working (with a minor fix).
> 
> When removing an item that is below the selected item from TreeTableView or TreeView controls the selection and/or focus was wrongly changed in some occasions, because a shift in the selection was applied.
> 
> This PR adds a method to ControlUtils to get the index of the sibling that is selected/focused or contains the descendant item with the current selection/focus. 
> 
> This index is required to compare properly if the selected/focus item is above or below the item that was removed, by comparing the indices of siblings.
> 
> Tests have been added to TreeViewTest and TreeTableViewTest based on the existing tests on JDK-8193442 and JDK-8187596. The four tests fail without this PR, pass with it.
> 
> In the process, I noticed that the ignored tests referred from JDK-8088157 were already passing, after removing some obsolete asserts, even without this PR.

The GHA test failure on macOS was due to [JDK-8282449](https://bugs.openjdk.java.net/browse/JDK-8282449) and not anything in this PR. I filed a new bug to skip the failing tests until that bug can be fixed. See PR #754.

-------------

PR: https://git.openjdk.java.net/jfx/pull/753


More information about the openjfx-dev mailing list