- All Known Implementing Classes:
BaseFxmlAppDelegate,NoopAppDelegate
public interface ApplicationDelegate
Interface for delegated JavaFX applications.
Supernaut.FX applications implement this interface.
Supernaut.FX applications implement this interface instead of subclassing JavaFX Application. This has several
advantages over directly extending Application:
- Supports flexible construction of application object hierarchies using Dependency Injection provided by Micronaut framework and possibly other D.I. frameworks in the future.
-
Applications
implementaninterfacerather thanextendaclass. This increases the testability and architectural flexibility of the application. -
Supports faster, multi-threaded launching with the
FxLauncherinterface.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidinit()The application initialization method.default voidsetApplication(javafx.application.Application application) Pass the JavaFXApplicationto the delegate.voidstart(javafx.stage.Stage primaryStage) The main entry point for Supernaut.fx applications.default voidstop()This method is called when the application should stop, and provides a convenient place to prepare for application exit and destroy resources.
-
Method Details
-
setApplication
Pass the JavaFXApplicationto the delegate. Override this method if your application needs access toHostServicesor other functionality available through theApplicationobject.NOTE: This method will be called on the same thread as the JavaFX
Applicationconstructor.- Parameters:
application- A reference to the delegating JavaFXApplicationinstance
-
init
The application initialization method. This method is called from the JavaFXApplication.init()method after the dependency injection context is initialized and the application is constructed and dependency injected.NOTE: This method is not called on the JavaFX Application Thread. An application must not construct a Scene or a Stage in this method. An application may construct other JavaFX objects in this method.
- Throws:
Exception- if something goes wrong
-
start
The main entry point for Supernaut.fx applications. Called fromApplication.start(Stage). At a minimum, you must implement this method.NOTE: This method is called on the JavaFX Application Thread.
- Parameters:
primaryStage- the primary stage- Throws:
Exception- something went wrong
-
stop
This method is called when the application should stop, and provides a convenient place to prepare for application exit and destroy resources. Called fromApplication.stop()NOTE: This method is called on the JavaFX Application Thread.
- Throws:
Exception- if something goes wrong
-