[API Review] RT-24916 - TableView.scrollTo(TableColumn)

Claus Luethje Claus.Luethje at osys.ch
Mon Feb 4 23:09:51 PST 2013

+1. It makes more sense this way (= keeping the focus of the user).
Just my 0.02$

-----Original Message-----
From: openjfx-dev-bounces at openjdk.java.net [mailto:openjfx-dev-bounces at openjdk.java.net] On Behalf Of John Hendrikx
Sent: Dienstag, 5. Februar 2013 07:57
To: jonathan.giles at oracle.com
Cc: openjfx-dev at openjdk.java.net
Subject: Re: [API Review] RT-24916 - TableView.scrollTo(TableColumn)

On 4/02/2013 21:02, Jonathan Giles wrote:
> This is a fair comment: scrollTo has been designed with a 
> 'fire-and-forget' approach in mind, but I would be loath to add a 
> means of requesting a self-correcting scrollTo function. Wouldn't a 
> suitable workaround be to call scrollTo after the image loading has 
> completed in all cells?
The problem is that image loading occurs in the background, and it is not really predictable when all of them are completed.  In my example application, these images are loaded from a database (when cached) or from the internet when not.  It may take 10 seconds before one has been loaded if it wasn't cached.  Waiting that long before I restore the position of the view for the user is not acceptable.  Also, calling scrollTo may trigger more image loading (as new cells come into view), so I'd have to call it in a loop until no more images are getting loaded...

I realize that self-correcting the position seems wierd, but on the other hand, why is the control adjusting position when some cell changes height?  Should the View control not take every effort to stay in the same position?  In other words, if my last interaction with the View class was to tell it "show me cell 313 nicely centered", and then cells
304-312 change their height, should they not simply be pushed up and out of view and keep my cell 313 centered?

I think it should store its "position" not as some absolute Y coordinate (which would change whenever any intermediate cell changes height), but more relative to the cell.  ie. the position is cell 313, centered at 45% down from the top of the control.  That way when a cell changes, it will try to keep the position stable.

I cannot predict when image loading will happen, nor when it will finish.  Even if I could, I'd probably have to call scrollTo in a loop for a few times as it would not be acceptable to wait calling it.  
Also... as soon as I do call it, other cells are likely to scroll into view, triggering more image loading...

> Regarding a lower-level API for exact positioning, please file a jira 
> tweak request.
I've filed http://javafx-jira.kenai.com/browse/RT-28192


More information about the openjfx-dev mailing list