[API Review]: Node validation
david.grieve at oracle.com
Wed Jul 3 06:23:48 PDT 2013
With regard to having this work without a Scene…
I think having a method that would layout a node without the node actually having to be part of the scene-graph would be _very_ useful. Often times, developers will do the show-hide trick or add-remove trick to get a node's bounds before the node is shown for real. SceneBuilder has to do tricks like these to deal with popup controls, like tooltip.
What styles are applied from CSS depends on where the node is in the scene-graph, so the method would need to be 'if I add this node to this parent, what will be the node's bounds?'. To make this work on the CSS side would require decoupling the 'css graph' from the scene-graph. RT-30894 touches on that.
On Jul 3, 2013, at 8:33 AM, Martin Sladecek <martin.sladecek at oracle.com> wrote:
> JIRA: https://javafx-jira.kenai.com/browse/RT-31133
> I propose a single method "public final void validate()" to be added to Node class. The validate method would ensure that the metrics (layout bounds) of the Node are valid with regards to the current scenegraph (CSS & layout).
> Together with this change, Parent.layout() will be deprecated.
> In my current implementation, validate() method works only if the Node is in a Scene. To make it work without a Scene, we'd need to do do some small adjustments to CSS (doesn't work with getScene() == null). But I'm not sure if such feature would be useful.
More information about the openjfx-dev