The bug occurs when showRoot is set to false on a root with no children, the 
expanded item count drops is 0 causing `isFocused(0)` to return false even 
though `focusedIndex` is still 0. When items are added afterwards the 
`treeItemListener` sees `focusedIndex=0` and incorrectly shifts it to 1 placing 
the focus on second item of the `TreeTableView`.
The fix replaces `isFocused(0)` with `getFocusedIndex() >= 0`, which reads the 
raw stored index.

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

Commit messages:
 - Minor changes
 - Fix TreeTableView focus and added test

Changes: https://git.openjdk.org/jfx/pull/2104/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2104&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8379662
  Stats: 130 lines in 2 files changed: 127 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jfx/pull/2104.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2104/head:pull/2104

PR: https://git.openjdk.org/jfx/pull/2104

Reply via email to