This PR fixes a bug where a `TableView` inside a `TitledPane` may 'duplicate' the cells. This actually has nothing to do with the `TitledPane`, but it triggered the bug easily due to its nature to change the size of his content when collapsing.
The expansion change of a `TitledPane` triggered an event where the underlying `VirtualFlow` was adding cells to the pile (for reuse) and later cleaning them all up without resetting the index to -1. This led to a bug where two cells had the same index and therefore received an edit event, although just one should (and is visible, the other cell has no parent -> orphan node). The fix is to always reset the index to -1. This was already done before, just not everywhere, for all cells. So before we clear the pile (or cells), we always reset the index to -1. Added a bunch of tests, some pass before and after. ------------- Commit messages: - 8320232: Add some documentation to the tests - 8320232: Formatting - 8320232: Another test for cell factory change - 8320232: Cells duplicated when table collapsed and expanded Changes: https://git.openjdk.org/jfx/pull/1521/files Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1521&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8320232 Stats: 184 lines in 4 files changed: 177 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jfx/pull/1521.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1521/head:pull/1521 PR: https://git.openjdk.org/jfx/pull/1521