Virtual Flow enhancements

Johan Vos johan.vos at gluonhq.com
Thu Sep 15 19:10:29 UTC 2022


On Tue, Sep 13, 2022 at 8:18 PM John Hendrikx <john.hendrikx at gmail.com>
wrote:

> For example, I scrolled my list so that the first Item is half visible
> (at the top), and the fifth item is a quarter visible (at the bottom)
> and I double click the 3rd item to go to a new screen (destroying the
> original list view in the process), I find there is no way to recreate
> the list view in the exact same state as it was before.
>

Great usecase.
Actually, this is possible already though with the current set of methods
exposed by VirtualFlow.
For example:

IndexedCell ic = getFirstVisibleCell()

gives you the first cell that is visible. You can ask its index, andwhen
you restore the list you scroll to that index.
By asking its layoutY() you know how it is positioned and you can invoke
scrollPixels(double) when you want to restore the list. If the height of
the items didn't change, the item at the bottom will still match the item
before you left the list.

Granted, this requires some boilerplate code. But unless I miss something,
there is in theory nothing that prevents doing this with the current set of
API's?

- Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20220915/192d25fa/attachment.htm>


More information about the openjfx-dev mailing list