Class MicronautFxmlLoaderFactory

java.lang.Object
app.supernaut.fx.micronaut.fxml.MicronautFxmlLoaderFactory
All Implemented Interfaces:
FxmlLoaderFactory

public class MicronautFxmlLoaderFactory extends Object implements FxmlLoaderFactory
Factory for providing FXMLLoaders that do full DI. This singleton is added to the Micronaut BeanContext with BeanContext#registerSingleton.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MicronautFxmlLoaderFactory(io.micronaut.context.BeanContext context)
    Constructor that gets BeanContext of the SupernautFX application injected.
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.fxml.FXMLLoader
    get()
    Get an FXMLLoader without setting a location
    javafx.fxml.FXMLLoader
    get(URL location)
    Get an FXMLLoader for the given location
    <T> T
    Get the FXML controller from the BeanContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MicronautFxmlLoaderFactory

      public MicronautFxmlLoaderFactory(io.micronaut.context.BeanContext context)
      Constructor that gets BeanContext of the SupernautFX application injected.
      Parameters:
      context - The BeanContext of the SupernautFX application
  • Method Details

    • getControllerFactory

      public <T> T getControllerFactory(Class<T> clazz)
      Get the FXML controller from the BeanContext
      Specified by:
      getControllerFactory in interface FxmlLoaderFactory
      Type Parameters:
      T - The class type of the controller
      Parameters:
      clazz - The controller class we are looking for
      Returns:
      A controller instance
    • get

      public javafx.fxml.FXMLLoader get()
      Get an FXMLLoader without setting a location
      Specified by:
      get in interface FxmlLoaderFactory
      Returns:
      An FXMLLoader
    • get

      public javafx.fxml.FXMLLoader get(URL location)
      Get an FXMLLoader for the given location
      Specified by:
      get in interface FxmlLoaderFactory
      Parameters:
      location - The location of the FXML resource
      Returns:
      An FXMLLoader