Doesn't help. The patterns of this property being changed are just as
unusable for my purposes as with the other approaches (e.g. I can clearly
see that item is set to a different value for a cell that is still visible,
so this would falsely cancel the loading of that cell's image). And since
none of these things are documented in the api, i.e. how the relationship
between visibility and those properties really are, this is not a god
approach in the first place because my application might behave completely
differently after a Java update, completely screwing up usability.

I am running out of ideas. It just cannot be the case that it is not
possible to write a decent file browser using JFX.

On Tue, Jan 27, 2015 at 10:32 PM, Tomas Mikula <tomas.mik...@gmail.com>
wrote:

> If the cells don't ever get removed from the scene, then I guess your
> best bet is to start and cancel loading when the item changes, i.e.
> listening to itemProperty(). This is similar to your original
> updateItem() approach, but also don't forget to cancel loading of the
> old item: cancel loading of the old item, if not null, and start
> loading the new item, if not null. I don't think you can yourself do
> much about the inefficiency that more cells than needed are created
> and hold non-null items.
>
> Let's see if others have something to suggest.
>
> Tomas
>
> On Tue, Jan 27, 2015 at 3:49 PM, Robert Krüger <krue...@lesspain.de>
> wrote:
> > 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 <krue...@lesspain.de>
> >> 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
> >> > https://community.oracle.com/message/12810930).
> >> >
> >> > 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
> >
> > www.lesspain-software.com
> >
>



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

www.lesspain-software.com

Reply via email to