-
Notifications
You must be signed in to change notification settings - Fork 221
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
Dynamic scene size breaks scene builder #327
Comments
This is related to #402, with PR #403 an error message will be shown to the user.
|
It seems that the error occurs when the FXOMNormalizer is applied to the FXOMDocument. After loading the FXML: <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.GridPane?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="500.0" prefHeight="${screen.visualBounds.height}" prefWidth="${screen.visualBounds.width}" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<fx:define>
<Screen fx:id="screen" fx:factory="getPrimary" />
</fx:define>
</GridPane> FXML with normalization applied: <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.GridPane?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="500.0" prefHeight="${screen.visualBounds.height}" prefWidth="${screen.visualBounds.width}" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<fx:define>
<Screen fx:id="screen" fx:factory="getPrimary" />
</fx:define>
</GridPane> Interestingly the normalization process does not change the FXML text. However, the refresh step causes the exception. public void normalize() {
changeCount = 0;
normalizeExpandedPaneProperties();
normalizeGridPanes();
if (changeCount >= 1) {
// the exception is caused here, this task is delegated to the FXOMRefresher
fxomDocument.refreshSceneGraph();
}
} The FXOMRefresher basically creates a new FXOMDocument. Here, the FXMLLoader raises the exception. I think, that is is caused by the actually missing import declaration So the cause of the trouble seems to be the FXMLDocument loading process which removes essentially the required imports. Without the import, the FXMLLoader tries to resolve what is defined in <fx:define>
<Screen fx:factory="getPrimary" fx:id="screen" />
</fx:define> In a very similar form, this is described in other issues such as:
I have no clear idea yet, how this can be solved but in my opinion, but at least the user should get an appropriate notification. |
If a project uses dynamic scene sizes by using the current screen, i.e.
scene builder will refuse to load the fxml file, or even crash when called from for example the
e(fx)clipse
plugin for Eclipse.JavaFX however will accept the fxml file and run as intended.
Additionally, on some platforms it appears that after such a file has been encountered, scene builder is unable to terminate when closed. Only after manually killing SceneBuilder (i.e. with SIGKILL), can you reopen it. This is bad because it seems that only one instance of SceneBuilder can be open, resulting in effectively a dead program.
Expected Behavior
Scene builder should be able to load the file, at best with the size as intended.
Current Behavior
Scene builder does not load the file when opened using internal
Open
button, or does not start at all when called externally, i.e. through thee(fx)clipse
plugin for Eclipse.Steps to Reproduce
Extract the code given above into an fxml file and attempt opening it in SceneBuilder: Scene builder will not open the given file.
If you try running it with pure JavaFX, it should work.
Your Environment
Has been observed on many Linux platforms, including
Ubuntu 18.04
,Kubuntu 20.04
,Gentoo stable
,Arch 1.4
.Screenshots
Not relevant, as simply nothing happens.
The text was updated successfully, but these errors were encountered: