On Sun, 15 Jun 2025 14:23:27 GMT, Marius Hanl <[email protected]> wrote:
> 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).
Will do the CSR + try to benchmark when I have more time!
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1830#issuecomment-3350795470