When calling `refresh()` on virtualized Controls (`ListView`, `TreeView`, 
`TableView`, `TreeTableView`), all cells will be recreated completely, instead 
of just refreshing them.

This is because `recreateCells()` of the `VirtualFlow` is called when 
`refresh()` was called. This is not needed, since refreshing the cells can be 
done much cheaper with `rebuildCells()`.

This will reset all cells (`index = -1`), add them to the pile and fill them 
back in the viewport with an index again. This ensures `updateItem()` is called.

The contract of `refresh()` is also a big vague, stating:

Calling {@code refresh()} forces the XXX control to recreate and repopulate the 
cells 
necessary to populate the visual bounds of the control.
In other words, this forces the XXX to update what it is showing to the user. 
This is useful in cases where the underlying data source has changed in a way 
that is not observed by the XXX itself.


As written above, recreating is not needed in order to fulfull the contract of 
updating what is shown to the user in case the underlying data source changed 
without JavaFX noticing (e.g. calling a normal Setter without any Property and 
therefore listener involved).

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

Commit messages:
 - Calling refresh() for all virtualized controls recreates all cells instead 
of refreshing the cells

Changes: https://git.openjdk.org/jfx/pull/1830/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1830&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8359599
  Stats: 476 lines in 14 files changed: 316 ins; 109 del; 51 mod
  Patch: https://git.openjdk.org/jfx/pull/1830.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1830/head:pull/1830

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

Reply via email to