gluonhq / scenebuilder

Scene Builder is a visual, drag 'n' drop, layout tool for designing JavaFX application user interfaces.
https://gluonhq.com/products/scene-builder/
Other
721 stars 219 forks source link

Scene Builder's CSS Analyzer not working on Windows #170

Open gluon-bot opened 6 years ago

gluon-bot commented 6 years ago

Originally reported by: Anonymous


I have a problem with Scene Builder's CSS Analyzer but only on Windows.

I have 2 environments (Windows 7 and Ubuntu 16.04) and here is what I have done in both:

The Label does show the style contained in the styleSheet (I have changed the Font Size and color and I do see the change on the Label) so the styleSheet is "working".

I then opened Scene Builder's CSS Analyzer and select the Label.

On Ubuntu, in the column "styleSheets", I do see what I have set in my styleSheet file. That's fine.

On Windows7, the column "styleSheets" is empty. Only the column "Defaults" is filled and the information looks incorrect: It says the the Font is "System 11.773585319519043px" which is not correct because I have set a Font Size of 26px. Is that a bug of CSS Analyzer?

This is very annoying because it prevents from seeing which CSS rule will be applied.

Thanks for your advices.


depascalis commented 4 years ago

Same issue on all Windows 10 machines I've tested with.

In the example bellow the css sets -fx-text-fill: green. To enhance the issue, text fill is then set to red in Scene Builder. The green property value is not shown in the CSS Analyzer.

scenebuilder_cssanlz

JavaFX Scene Builder 11.0.0 Windows 10, amd64, 10.0

dwhitla commented 2 years ago

Doesn't work on MacOS either

RobinDenaux commented 2 years ago

Still not working on windows 10 :

Product Version JavaFX Scene Builder 18.0.0

Build Information Version 18.0.0 Date: 2022-03-31 20:20:30 JavaFX Version: 18 Java Version: 17, OpenJDK Runtime Environment

JavaFX 18

Java 18, OpenJDK Runtime Environment

Java Library Path(s):

Missing or invalid Java Library Path(s): runtime\bin runtime\lib

Operating System Windows 10, amd64, 10.0

Oliver-Loeffler commented 1 year ago

Hi @AlmasB, how about giving this issue a higher priority so that we probably can solve it with Scene Builder 20? The CSS Analyzer is core functionality and this should work. I did not review yet how it works in detail but it is something I'll dive into. If you agree, you can assign this one to me.

AlmasB commented 1 year ago

I've added this to 20, though we still seem to have trailing issues for 18 and 19 that need to be looked at.

Oliver-Loeffler commented 1 year ago

Do we have kind of a roadmap which things to resolve first and which things later? Same like #353

credmond commented 10 months ago

This doesn't work on Linux either. This issue has been reported a few times recently. This issue should be given some priority...

credmond commented 10 months ago

I can confirm the behaviour works as expected on 8.5.0 , so it was introduced since. E.g., I can see Stylesheet or Inline Styles in that version.

The bug is also present in SceneBuilder-18.0.0-SNAPSHOT.msi, which seems to be the last downloadable version of SB. Therefore whatever change broke it, was before 18.

I don't know why Gluon links all GitHub releases to this page: https://gluonhq.com/products/scene-builder ... but only provides the latest when you actually land on it (or 8.5.0). People often have reasons for reverting.

@Oliver-Loeffler @AlmasB @johanvos this is a pretty bad bug, I think it should be fixed with priority.

credmond commented 10 months ago

Update: after hacking the download URLs, I was able to download SB 15. The bug is also present there also.

Works in 8.5:

image

Doesn't work with 15:

image

Note: I have found at least 6 other separate bug reports about this spanning a couple of years, to it's definitely a desired fix!

Oliver-Loeffler commented 10 months ago

@credmond Thanks for your research in this topic. I'll look into this and get in touch with @AlmasB. Would be great if we find a way to revert this into how it was supposed to work.

credmond commented 10 months ago

I think there was a big "Java 9" readiness commit which changes a few of these classes used in this panel, I'd bet it was introduced then somehow...

https://github.com/gluonhq/scenebuilder/pull/198/files

Oliver-Loeffler commented 10 months ago

It feels like so. I'll dig into this. Its really a huge commit - it touches almost everything.

credmond commented 10 months ago

It feels like so. I'll dig into this. Its really a huge commit - it touches almost everything.

Yeah :) I think SceneBuilder is a great tool that has lacked some love recently, fixing this (which might fix other associated bugs) would boost the JavaFX ecosystem overall...

credmond commented 6 months ago

Hi all -- any progress on this?

Oliver-Loeffler commented 4 months ago

Hi @credmond, unfortunately not yet. I'll still try to see the difference. Actually I have never seen this thing working.

Oliver-Loeffler commented 4 months ago

Very cool, I've got Scene Builder 8.5.0 running. With your input I'm now playing with git bisect. May be this helps to identify the relevant change. But first I've to try the CSS inspector.

Oliver-Loeffler commented 4 months ago

Well, highest chance candidate is a combination of 011b36870b61f41ee5c7ab6e0c433d940f794028 and 4f07490d2b098f0c5721ce71b038f344715f3c26.

This one is still working: 7eda5ceda0a90b9137fb6f18b919deb490211dea

This is a test candidate (merge conflict resolution) 8b9b73a89a20a03c59ce85c01065ce23e2aee714

This one is also a candidate: 4f07490d2b098f0c5721ce71b038f344715f3c26

bad 01cccf0 good f61d405

Oliver-Loeffler commented 4 months ago

To get the debugger in Eclipse running, I had to add following VM parameters:

--module-path "javafx-sdk-22\lib"
--add-modules javafx.controls
--add-modules javafx.base
--add-modules javafx.graphics
--add-modules javafx.fxml
--add-modules javafx.media
--add-exports javafx.media/com.sun.media.jfxmedia.events=ALL-UNNAMED
--add-exports javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.prism=ALL-UNNAMED 
--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.glass.utils=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.geom.transform=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.font=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.util=ALL-UNNAMED
--add-exports javafx.base/com.sun.javafx.logging=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.text=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.scene.text=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-opens javafx.fxml/javafx.fxml=ALL-UNNAMED

When started without exports, the CssPanel will fail to load.

credmond commented 4 months ago

I am excited... :)

ctoabidmaqbool1 commented 3 months ago

Hi! I have trid in Scene Builder 21 latest yet, still there is a issue in it!

I always have to switch to old Scene Builder 8.5, beacause it have nice feature which one is still missing in new version!

Oliver-Loeffler commented 3 months ago

Hi, we aware of this issue and I am investigating the problem. I cannot promise but hope to be able to fix this before the next release.

Oliver-Loeffler commented 2 months ago

Hi all, just an update on my recent work/findings.
Reviewing the Scene Builder 8.5 and 21/22 code it seems that certain functionality has been disabled as the required APIs are no longer public since the modularization of OpenJFX. Hence, there is some OpenJFX related work needed to re-enable the CSS inspectors full functionality (so it seems to me). As of now I am looking into OpenJFX and Scene Builder sources to fully understand whats needed. Next step is for me, to create a local OpenJFX build where I make the supposed APIs public and see if I can get the CSS inspector working with that. Once thats understood, I probably put this into discussion and will see that either a feature request for OpenJFX is issued or an existing one is prioritized.

credmond commented 2 months ago

Good findings. Thanks for looking into it. Not a simple fix afterall, eh? :/

How did stacktraces and errors not appear if APIs started disappearing? Did someone disable (remove) code intentionally, and not say anything?

Oliver-Loeffler commented 2 months ago

Well, ea reasonable amount of the CSS related code delegates to com.oracle.javafx.scenebuilder.kit.util.Deprecation in the kit module. There are multiple mentions of items/tickets such as RT-21247 and RT-21096. As of now I am reviewing the OpenJFX code in jfx\modules\javafx.graphics\src\main\java\javafx\scene\Node.java. Please apologize that stuff is not linked yet.

RT-21096 in jfx, javafx.scene.Node RT-21247 in jfx, javafx.scene.Parent

However, I am kind of glad as I today managed to create my own personal JavaFX build for Windows as of today.

Still, the concept how the CSS details are collected is not yet transparent to me. It is not yet as easy as just making the releated methods public. Stuff is not working with that yet.

Following CSS related classes in package com.oracle.javafx.scenebuilder.kit.editor.panel.css make use of methods defined in com.oracle.javafx.scenebuilder.kit.util.Deprecation:

List<CssStyle> CssContentMaker.getNotAppliedStyles(List<Style> appliedStyles, Node node, CssMetaData<?, ?> cssMeta))
List<CssContentMaker.CssPropertyState.CssStyle> NodeCssState.CssProperty.getFxThemeHiddenByModel()

Furthermore there is the CssInternal class in com.oracle.javafx.scenebuilder.kit.util:

static void attachMapToNode(Node node)
static Map<StyleableProperty, List<Style>> collectCssState(Node node)
static void detachMapToNode(Node node)
static List<String> getThemeStyleClasses(Theme theme)

I'll need to play with SB 8.5 to understand how this is supposed to work.