Event when CSS is applied
Tom Eugelink
tbee at tbee.org
Tue Feb 17 15:06:27 UTC 2015
needsLayoutProperty() is not available on Text, and I figure that on the container it in the end will call layoutChildren, which I'm using already.
On 17-2-2015 14:24, Benjamin Gudehus wrote:
>> Basically I would like to be informed when the styling of a node has been applied or changed.
> There are isNeedsLayout() and needsLayoutProperty() and they might
> give Node-based information whether the the layout and thus the
> styling was applied. I guess this might be true, since doCSSPass() is
> called before doLayoutPass() in the JavaFX thread, but could be wrong
> on this regard.
>
> As another (more fuzzy) option you could place a custom Logger into
> PulseLogger and handle calls to the newPhase() method. The problem is,
> that it only gives Scene-based information, i.e. you don't see which
> Node was processed, so it might be unreliable information. I use a
> custom PulseLogger for performance tests.
>
> --Benjamin
>
>
> On 2/17/15, Tom Eugelink <tbee at tbee.org> wrote:
>> I have a skin (of a control) that centers a Text node. This Text node can be
>> styled via CSS, so this styling is a factor when centering. because larger
>> font means wider text.
>>
>> The centering works perfectly, the only problem is figuring out when to
>> center the node. At the moment I'm centering the node on every
>> layoutChildren call of the skin, but this is way to often, because after
>> applying the CSS chances are very low that the node will need to be
>> repositioned.
>>
>> Basically I would like to be informed when the styling of a node has been
>> applied or changed. Is there some place that can provide this information?
>>
>>
>> Tom
>>
More information about the openjfx-dev
mailing list