TableView API, no lazy retrieval of visible cell content possible?
tomas.mikula at gmail.com
Tue Jan 27 18:25:47 UTC 2015
instead of listening to visibleProperty(), listen to sceneProperty()
and cancel loading when scene becomes null.
On Tue, Jan 27, 2015 at 1:16 PM, Robert Krüger <krueger at lesspain.de> wrote:
> 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
> Thanks in advance for any hints,
More information about the openjfx-dev