gluonhq / scenebuilder

Scene Builder is a visual, drag 'n' drop, layout tool for designing JavaFX application user interfaces.

Home Page:https://gluonhq.com/products/scene-builder/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using com.gluonhq.charm.glisten.mvc.View makes intellij embedded SceneBuilder unable to open corresponding fxml

phmaes opened this issue · comments

commented

Hello,

first, happy new year 2023 :)

I've created a new gluon (multiview with FXML with maven) project in intellij (using the javafx gluon plugin). The embedded intellij JavaFX plugin is enabled.
When I open one the generated fxml files, the content is correctly displayed in the Text tab. But when I switch to the Scene Builder tab, it displays an error:
java.lang.IllegalArgumentException: EventType "LIFECYCLE_EVENT"with parent "EVENT" already exists

Here is the comprehensive stacktrace from intellij:
2023-01-10 15:52:51,927 [1230853] INFO - ceneBuilder.SceneBuilderEditor - java.lang.ExceptionInInitializerError at com.gluonhq.charm.glisten.mvc.View.<init>(View.java:111) at com.gluonhq.charm.glisten.mvc.View.<init>(View.java:101) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at java.base/java.lang.Class.newInstance(Class.java:584) at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1019) at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754) at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2450) at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:96) at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:91) at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:108) at com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:2507) at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:710) at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:695) at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderImpl.loadFile(SceneBuilderImpl.java:280) at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderImpl.lambda$reload$6(SceneBuilderImpl.java:244) at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:429) at java.base/java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:428) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.IllegalArgumentException: EventType "LIFECYCLE_EVENT"with parent "EVENT" already exists at javafx.event.EventType.register(EventType.java:186) at javafx.event.EventType.<init>(EventType.java:128) at com.gluonhq.charm.glisten.control.LifecycleEvent.<clinit>(LifecycleEvent.java:23) ... 27 more

When I open the fxml file directly from the Scene Builder standalone, it correctly works.
Opening fxml files not generated with the gluon plugin works fine.

Expected Behavior

It should open the embedded scene builder showing the selected fxml file's content.

Investigation & possible cause

Reading the stacktrace, I thought the problem is that the View component is registering a event handler for EventType "LIFECYCLE_EVENT" that has already been registered by intellij javafx plugin or gluon plugin.
And indeed, this is a correct guess. When I replace the com.gluonhq.charm.glisten.mvc.View component with javafx.scene.layout.BorderPane, the embedded Scene Builder now open the fxml without any error!

Current Behavior

See description.

Steps to Reproduce

See description.

Your Environment

Ubuntu Ubuntu 22.04.1 LTS 64 bits
Openjdk 19
JavaFX SDK 19
Intellij 2021.2.4

Screenshots

Error:
gluon2
gluon1

View component replaced by BorderPane:
gluon3
gluon4

Best regards,

Philip

Late happy new year @phmaes!
Thank you for the very good description. I'll try to stage this error (even running the standalone version). I have not yet worked with the Gluon controls, so this will take some time.