Reloading stylesheets

ngalarneau at ABINITIO.COM ngalarneau at ABINITIO.COM
Thu Dec 12 07:02:10 PST 2013


Sounds good.



From:   David Grieve <david.grieve at>
To:     ngalarneau at
Cc:     "openjfx-dev at List" <openjfx-dev at>
Date:   12/12/2013 08:52 AM
Subject:        Re: Reloading stylesheets

Thanks, Neil. The underlying cause is likely to be the same. I'm going to 
resolve the one you created as a duplicate so the fact that this is 
critical to scene builder is not lost. 

On Dec 12, 2013, at 7:48 AM, ngalarneau at wrote:

> The Jira I filed is at:
> The slight difference is that I applied the stylesheet on the scene 
> instead of the button.
> Neil
> From:   Jerome Cambon <jerome.cambon at>
> To:     openjfx-dev at
> Date:   12/12/2013 04:26 AM
> Subject:        Re: Reloading stylesheets
> Sent by:        openjfx-dev-bounces at
> This is also impacting Scene Builder.
> I have filed a Jira with a test case:
> Jerome
> On 12/11/13 6:19 PM, David Grieve wrote:
>> There is clearly a bug there somewhere. Would you mind filing an issue 
> on
>> On Dec 11, 2013, at 11:51 AM, ngalarneau at wrote:
>>> Hi David,
>>> I have stylesheet SWITCHING working fine. I can switch between 2 
> different
>>> stylesheets on disk without tearing down & rebuilding my Scene. To do 
> this
>>> I simply do:
>>>        scene.stylesheets.clear()
>>>        scene.stylesheets.add(differentStylesheet)
>>> and the changes show up immediately (I'm assuming those 2 lines cause 
>>> .css recalculation & a pulse).
>>> I would like to get stylesheet RELOADING to work in my JavaFX 8 app. 
>>> this I mean picking up changes in a single .css file. This would allow 

> the
>>> developers to tweak the stylesheet & reload to see the effects
>>> immediately.
>>> Unfortunately, it feels like the Filename of the stylesheet is the Key 

> in
>>> a cache that isn't getting cleared by my code above. Nothing visible
>>> happens when I do:
>>>        scene.stylesheets.clear()
>>>        scene.stylesheets.add(sameStylesheet)
>>> Given your description below, my impression is that RELOADING should 
> also
>>> work...
>>> Thank you for any suggestions,
>>> Neil
>>> From:   David Grieve <david.grieve at>
>>> To:     Werner Lehmann <lehmann at>
>>> Cc:     openjfx-dev at
>>> Date:   12/10/2013 11:10 AM
>>> Subject:        Re: Reloading stylesheets
>>> Sent by:        openjfx-dev-bounces at
>>> The way it works in 8.0 is that there is a cache of loaded 
>>> When a scene or parent adds a stylesheet, the stylesheet is added to 
> the
>>> cache. Any other scene or parent that uses the same stylesheet will 
>>> the one from cache. If a scene or parent later removes the stylesheet, 

> the
>>> stylesheet is removed from the cache and the css style cache for any 
> scene
>>> or parent that referenced that stylesheet is cleared (since the set of
>>> styles may have changed). Any scene or parent that referenced the now
>>> removed stylesheet is told to reapply its styles. Since the stylesheet 

> is
>>> no longer in cache, it will be re-parsed (or reloaded if there is a 
> binary
>>> version of the stylesheet) when it is called for by a scene or parent.
>>> The way it worked in 2.x was an abomination.
>>> On Dec 10, 2013, at 10:30 AM, Werner Lehmann
>>> <lehmann at> wrote:
>>>> Interesting. Assuming the stylesheets are still cached, how would it
>>> know when to reload and not use the cached sheet? Or has sheet 
> processing
>>> been optimized so much that caching is not necessary anymore...
>>>> On 10.12.2013 16:15, Tom Schindl wrote:
>>>>> No on FX8 you need to remove and readd them! So the only thing
>>> different
>>>>> is that you omit the reload-call on FX8.

NOTICE from Ab Initio: This email (including any attachments) may contain 
information that is subject to confidentiality obligations or is legally 
privileged, and sender does not waive confidentiality or privilege. If 
received in error, please notify the sender, delete this email, and make 
no further use, disclosure, or distribution. 

More information about the openjfx-dev mailing list