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 a 
.css recalculation & a pulse).

I would like to get stylesheet RELOADING to work in my JavaFX 8 app. By 
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.gri...@oracle.com>
To:     Werner Lehmann <lehm...@media-interactive.de>
Cc:     openjfx-dev@openjdk.java.net
Date:   12/10/2013 11:10 AM
Subject:        Re: Reloading stylesheets
Sent by:        openjfx-dev-boun...@openjdk.java.net



The way it works in 8.0 is that there is a cache of loaded stylesheets. 
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 get 
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 
<lehm...@media-interactive.de> 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. 

Reply via email to