vaadin/tori — Issue #22: Implement the lazy scrolling table for threads
Author: wolfie
Created: 2011-11-16 19:48:48+00:00
State: open

Hereby called `AwesomeLayout`, preferably spelled with three exclamation points, but Java probably doesn't allow them in class names. So maybe `ThreadLayout` might be more suitable.

Anyhoo...

An idea for implementation:

* Guesstimate an `avgHeight` that represents the average height of a rendered post in pixels (200px seems reasonable. May be configurable per installation, if we want to get real fancy)
* Place the same amount of empty divs, each 200px high (`avgHeight`), as there are posts in the thread.
* As the viewport lands on one (or more) of those empty divs, load the corresponding `n`:th `Post` on that `Thread`.
* Swap the empty div with a `PostComponent`, loaded with the data from previous step.
* Do the same for a certain amount of posts below and above, for good measure.

This way we get a good approximation of how high the layout needs to be initially. Also, if there are more posts than the first screenful, but the visitor reads all the posts one-by-one, the associated scrollbar will stretch appropriately. It will jump each time a new post is rendered (unless the post is exactly `avgHeight` pixels high). If this is deemed a problem, the replacing of the div/`PostComponent` could be animated heightwise, so the layout stretching (i.e. scrollbar size changes) will be smoother.