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

Jose Pereda jpereda at openjdk.java.net
Fri Apr 22 19:29:33 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.

This pull request has now been integrated.

Changeset: 3bb2db12
Author:    Jose Pereda <jpereda at openjdk.org>
URL:       https://git.openjdk.java.net/jfx/commit/3bb2db12a4ae3fe4a26420f0af57c189b2549edb
Stats:     193 lines in 5 files changed: 175 ins; 12 del; 6 mod

8193442: Removing TreeItem from a TreeTableView sometime changes selectedItem
8187596: TreeView selection incorrectly changes after deleting an unselected row

Reviewed-by: aghaisas, kcr

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

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


More information about the openjfx-dev mailing list