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

Jose Pereda jpereda at openjdk.java.net
Mon Apr 4 17:29:28 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 incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

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

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

Changes:
  - all: https://git.openjdk.java.net/jfx/pull/753/files
  - new: https://git.openjdk.java.net/jfx/pull/753/files/ba820e59..d514e28a

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jfx&pr=753&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=753&range=00-01

  Stats: 59179 lines in 147 files changed: 8783 ins; 25281 del; 25115 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