RFR: 8359599: Calling refresh() for all virtualized controls recreates all cells instead of refreshing the cells [v2]

Marius Hanl mhanl at openjdk.org
Thu Oct 2 19:47:41 UTC 2025


> 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).

Marius Hanl 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' of https://github.com/openjdk/jfx into 8359599-refresh-recreates-all
 - Calling refresh() for all virtualized controls recreates all cells instead of refreshing the cells

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/1830/files
  - new: https://git.openjdk.org/jfx/pull/1830/files/c9843e79..940f7cbd

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1830&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1830&range=00-01

  Stats: 920876 lines in 10194 files changed: 399713 ins; 396789 del; 124374 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


More information about the openjfx-dev mailing list