[API Review]: Node validation
Phil Race
philip.race at oracle.com
Wed Jul 3 07:28:47 PDT 2013
I think SceneBuilder would like this, and I know printing would love it :-)
-phil.
On 7/3/13 7:03 AM, Kevin Rushforth wrote:
> +1
>
> This would allow apps to dispense with the following workaround when
> taking a snapshot:
>
> // create a dummy scene so layout and CSS will work
> new Scene(new Group(node));
>
> node.shapshot(...)
>
> -- Kevin
>
>
> David Grieve wrote:
>> Hi Martin,
>>
>> 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:
>>
>>> Hi,
>>>
>>> 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.
>>>
>>> Regards,
>>> -Martin
>>
More information about the openjfx-dev
mailing list