Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSSFX doesn't monitor changes in Application stylesheet #36

Open
Liso-cz opened this issue Jan 26, 2021 · 7 comments
Open

CSSFX doesn't monitor changes in Application stylesheet #36

Liso-cz opened this issue Jan 26, 2021 · 7 comments

Comments

@Liso-cz
Copy link

Liso-cz commented Jan 26, 2021

When I define global CSS file for all stages of javafx application (see below), then changes aren't reloaded.

        final URL globalCssFile = getClass().getResource("styles/Global.css");
        Application.setUserAgentStylesheet(globalCssFile.toExternalForm());
@palexdev
Copy link

palexdev commented Mar 3, 2021

@McFoggy Any news on this issue?

@McFoggy
Copy link
Owner

McFoggy commented Mar 4, 2021

Any news on this issue?

Not really. I had a quick look at it but the global stylesheet is not Observable and is a bit special thus it will require a special handling and probably either a specific monitoring or a new API to be called by CSSFX users.

@palexdev
Copy link

palexdev commented Mar 4, 2021

Also, new JavaFX versions (9+) seems to have introduced a regression. In JavaFX 8 I was able to change the user agent stylesheet and then call reapplyCss() or impl_reapplyCss() and the new style would be applied
It doesn't work anymore though

@McFoggy
Copy link
Owner

McFoggy commented Mar 4, 2021

@palexdev please do not mix problems in the same issue, open another issue describe the problem and potentially provide a reproducer.
By the way as we do not touch the user agent style, is it related to CSSFX? did you try to reproduce without it?

@palexdev
Copy link

palexdev commented Mar 4, 2021

Sorry I thought it might be a useful information.
No, it's not related to CSSFX, it's related to this change JDK-8088253, reverting that commit fixes the problem, I'm testing it further and then I'm going to contact the devs

@Liso-cz
Copy link
Author

Liso-cz commented Mar 5, 2021

It looks like a bit tricky issue or inappropriate use case. Do you know any workaround? I'd like to use CssFx, but I also want to have one global CSS file, which I don't need to include in every new window opened by application. The code above was the only solution I'd found out. It's not the best one, because then I need to have modena.css included in my global.css file via @include. Does JavaFX provide any other solution?
Anyway, Thanks for your time!

@McFoggy
Copy link
Owner

McFoggy commented Mar 6, 2021

The only workaround I see right now is to include your CSS in the top windows instead.
If you find some other ways, fill free to send a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants