Skip to content
New issue

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

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

Already on GitHub? # to your account

CSS issues after #745 #760

Closed
jperedadnr opened this issue Oct 21, 2024 · 1 comment · Fixed by #761
Closed

CSS issues after #745 #760

jperedadnr opened this issue Oct 21, 2024 · 1 comment · Fixed by #761
Assignees
Labels
bug Something isn't working

Comments

@jperedadnr
Copy link
Collaborator

jperedadnr commented Oct 21, 2024

After #745, importing a control that uses its own user agent stylesheet fails, because Modena.css overwrites it.

Expected Behavior

Importing ControlsFX Rating control should show:
image

Current Behavior

Importing ControlsFX Rating control shows:
image

Steps to Reproduce

Add ControlsFX to the custom library, open a new FXML file, add an AnchorPane and a Rating control. The size is wrong, because button's padding defaults to modena's padding:

image

instead of 16 (from its rating.css)

Rating uses:

    @Override public String getUserAgentStylesheet() {
        return getUserAgentStylesheet(Rating.class, "rating.css");
    }

Your Environment

Screenshots

@jperedadnr jperedadnr added the bug Something isn't working label Oct 21, 2024
@jperedadnr jperedadnr self-assigned this Oct 21, 2024
@jperedadnr
Copy link
Collaborator Author

Actually, there was an underlying bug in Scene Builder, and this bug was already happening before #745, but after #720, with other themes.

For instance, High contrast Black and White + Rating, :

image

The problem: before #745, modena.bss was used in EditorPlatform Theme.MODENA. That was converted to css with Deprecation::getThemeTextStylesheet, but

try {
            return new URL(textCssUrlStr);
        } catch (MalformedURLException ex) {
            // should never happen
            return null;
        }

was always returning null, since this exception was totally ignored:

java.net.MalformedURLException: no protocol: com/sun/javafx/scene/control/skin/modena/modena.css
	at java.base/java.net.URL.<init>(URL.java:772)
	at java.base/java.net.URL.<init>(URL.java:654)
	at java.base/java.net.URL.<init>(URL.java:590)
	at com.gluonhq.scenebuilder.kit@24.0.0-SNAPSHOT/com.oracle.javafx.scenebuilder.kit.util.Deprecation.getThemeTextStylesheet(Deprecation.java:189)

Therefore, the default Modena theme wasn't adding any style classes at all, while other modena themes that imported directly modena.css were, and the user agent stylesheets from custom controls were also overwritten.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant