@ConsumerType
public interface Fxml
getLocation() will be
loaded.
If the Fxml instance implements the Fxml.Application interface,
IoCFX will automatically create and show a Stage containing the
FXML's layout.
If the Fxml instance implements the Fxml.Root interface, it will
be set as the root of the FXML object.
If the Fxml instance implements the Fxml.Controller interface, it
will be set as the controller of the FXML object.
If the Fxml instance implements the Fxml.Consumer interface, the
loaded object will be passed to its accept
method.
If the Fxml instance implements the Fxml.Resources interface, the
provided ResourceBundle will be used while loading the FXML file.
If a component needs to have direct control over the FXMLLoader
instance, it might not be a good idea to implement this interface. Instead
declare a dependency on an FXMLLoader prototype service like this:
@Reference(scope = ReferenceScope.PROTOTYPE_REQUIRED) private FXMLLoader loader;IoCFX will provide the component with its own instance of an
FXMLLoader that is able to utilize OSGi Bundle class loaders, thus
allowing to instantiate classes from other bundles which would normally cause
a ClassNotFoundExceptions when using a vanilla
FXMLLoader.| Modifier and Type | Interface and Description |
|---|---|
static interface |
Fxml.Application
Interface for components that represent an application main window.
|
static interface |
Fxml.Consumer<T>
Fxml components implementing the Consumer interface will be passed the loaded
object once the fxml file has been successfully loaded.
|
static interface |
Fxml.Controller
Marker interface for components that need to be set as the controller of the
FXML file they want to be loaded.
|
static interface |
Fxml.ErrorHandler
If an
Fxml instance implements this interface, any IOExceptions that happen while loading the FXML file will be caught and
propagated to the Fxml.ErrorHandler.onError(IOException) method. |
static interface |
Fxml.Resources
Fxml components implementing the Resources interface can supply a
ResourceBundle that will be used by the FXMLLoader. |
static interface |
Fxml.Root
Marker interface for components that need to be set as the document root of
the FXML file they want to be loaded.
|
| Modifier and Type | Method and Description |
|---|---|
default URL |
getLocation()
Provide a
URL that points to the FXML file that needs to be loaded. |
Copyright © 2019. All rights reserved.