[API Review]: Node validation
martin.sladecek at oracle.com
Wed Jul 3 23:19:24 PDT 2013
Without tests, there are actually only 2 in graphics (Parent, Text) and
2 in controls (XYChart).
XYChart seems to invoke the layout of both axes during the layout of the
chart. Not sure if this is necessary. The layout() method of children
should be normally called after the layoutChildren() of a parent.
The Text usage is because of TextFlow and calls layout() on it's parent.
Seems very strange to me, but maybe Felipe can provide some additional
While I don't think it's necessary to invoke just layout pass on a Node,
I don't strongly insist on deprecating the method. Invoking it at any
time shouldn't break anything, so it's cannot be misused or anything.
On 07/03/2013 09:22 PM, Richard Bair wrote:
> Why does layout() need to be deprecated? Find Usages from IntelliJ reports 481 usages (139 in controls 2 in designTime, 339 in Graphics, including tests and such). We should only deprecate the method if it should not be used anymore by anybody for any reason, in which case we need to replace all of our own internal usages before we deprecate it (or we will just add to our compiler warning total).
> It seems like layout() is used for something different than validate(), unless we are collapsing our CSS & layout passes into a single pass?
> On Jul 3, 2013, at 5: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