TableView API, no lazy retrieval of visible cell content possible?

Robert Krüger krueger at
Tue Jan 27 20:49:32 UTC 2015

Hi Tomas,

When I do that, the property is never set to null. If I use it for
triggering the loading (when it is set to a non-null value) it is set for a
lot more rows than those actually visible. In my test with a model
containing 200 items of which the first 4 were visible, it was set to
non-null for the first 23 items.

Am Dienstag, 27. Januar 2015 schrieb Tomas Mikula :

> Hi Robert,
> instead of listening to visibleProperty(), listen to sceneProperty()
> and cancel loading when scene becomes null.
> Tomas
> On Tue, Jan 27, 2015 at 1:16 PM, Robert Krüger <krueger at
> <javascript:;>> wrote:
> > Hi,
> >
> > either I don't see the forest for the trees or something is missing in
> the
> > TableView API as I cannot seem to implement something that seems a common
> > requirement and was rather easy (not pretty though) in Swing.
> >
> > Imagine an application like OSX finder in its list view, i.e. something
> > that displays a possibly very long list of files and displays thumbnails
> > for them generated on the fly. For many files (e.g. video files)
> extracting
> > these thumbnails is an expensive operation and has to be performed in the
> > background. My application does a very similar thing and uses a
> TableView.
> > What I want is to begin extracting video thumbnails as soon as their
> > corresponding table row has become visible. I have done that in Swing in
> > the past without any problem (for more info, you can read
> >
> >
> > With JavaFX I have tried the following:
> >
> > 1) Trigger loading the thumbnail in the table cell when it is updated and
> > the corresponding thumbnail isn't already there
> >
> > Result: Triggering works more or less as desired but how do I stop the
> > loading process if the cell becomes invisible? If the user quickly
> scrolls
> > through a large number of rows and puts tons of thumbnail loading jobs on
> > the queue I have not found a way to dequeue them, so this is unusable. I
> > added output to the calls to the update method of the TableCell to see
> > which instances are used and how their data is reset but the pattern I
> see
> > is not suitable for deciding which cell is currently visible.
> >
> > 2) Register a change listener to the TableCell’s visible property to make
> > that control the image loading.
> >
> > Result: I don’t seem to get any change events when I do that, so it does
> > not work at all for my purpose.
> >
> > I see no public API in table view to explicitly compute the items visible
> > in the current viewport either. What am I missing. It can't be an
> oversight
> > in the API design, as the thing, I am trying to achieve appears rather
> > basic.
> >
> > Thanks in advance for any hints,
> >
> > Robert

Robert Krüger
Managing Partner
Lesspain GmbH & Co. KG

More information about the openjfx-dev mailing list