RFR: 8193442: Removing TreeItem from a TreeTableView sometime changes selectedItem [v3]

Jose Pereda jpereda at openjdk.java.net
Thu Apr 21 08:37:11 UTC 2022


> 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.

Jose Pereda has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:

 - Fix spacing in tests
 - Merge branch 'master' into 8193442-treeitemselection
 - Merge branch 'master' into 8193442-treeitemselection
 - Don't shift selection/focus if item is below removed element

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

Changes: https://git.openjdk.java.net/jfx/pull/753/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=753&range=02
  Stats: 193 lines in 5 files changed: 175 ins; 12 del; 6 mod
  Patch: https://git.openjdk.java.net/jfx/pull/753.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/753/head:pull/753

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


More information about the openjfx-dev mailing list