-
Notifications
You must be signed in to change notification settings - Fork 4
Description
It would be beneficial to move FXML parsing to build time, not just for speed, but particularly since it uses reflection. I've started a small project for generating Java source from FXML, so you instead of using an FXMLLoader can call a method on a pre-generated Java class.
The question is what is needed for it to work well with quarkus, e.g. should there be a drop-in replacement for FXMLLoader that uses the pre-generated class instead? We could use an annotation on an interface and generate an implementation that will be injected and that builds the corresponding GUI? E.g. something along the following:
public interface MyFxml {
@FxmlLoader("main-view.fxml")
public Pane buildMainView();
@FxmlLoader("settings-view.fxml")
public Pane buildSettingsView();
@FxmlBuilder("""
<Label text="$aLabel"/>
""")
public Label createALabel(String aLabel);
}
...
@Inject
MyFxml myFxml;
Another thing to consider is FXML string templates (see prototype here: https://github.com/hallvard/fxml-template-processor).
I don't know much about Quarkus' annotation processing and build magic, so would like to open up a discussion about this in this issue.