Developing controls based on Canvas?
richard.bair at oracle.com
Thu Aug 8 14:25:52 PDT 2013
> Though not directly analogous, consider your typical spreadsheet
> application like Excel where the user is able to pan to the right
> effectively without limits and that grid lines are constantly being
> rendered as the panning takes place. Given that screens can be very large
> these days it is conceivable that a complex spreadsheet will be displaying
> hundreds of lines to define the cells in a grid at any one time and that it
> is way more concise to programmatically define how this grid is rendered
> rather than having a scenegraph containing a node for each line etc. Also,
> the panning and zooming responses are much simpler to implement
> programmatically than continually fiddling around with the scenegraph.
> Then there's the whole issue of virtualisation and keeping the actual
> number of "active" nodes to a minimum if it were to be done using a
Actually I would have thought that panning / zooming would be very simple with a scene graph based approach. The difficult part is the virtualization. Although if you were building a spreadsheet like control it seems like you could build it on top of the ListView, which would give you vertical virtualization for free. You're then left with horizontal virtualization. I suppose you could use horizontal list views for that as well if you didn't want to implement your own virtualization (which might be much more efficient with domain knowledge).
If you know that you're grid will always be drawn underneath the other controls, then it seems reasonable to use a Canvas (or MeshView) to implement the grid, and then position controls on top of the grid as appropriate. I don't really see it as being any more difficult than immediate mode, really. YOu have a pool of Labels or whatever, grab one from the pool, position it where you want it, do the next one, etc. Heck, you could have a GraphicsContext interface with drawString(x, y, String) that handles all this behind an abstraction. All you're doing is positioning and defining content, right?
More information about the openjfx-dev