Interface FxLauncher

All Known Implementing Classes:
FxLauncherAbstract, MicronautFxLauncher, SimpleFxLauncher

public interface FxLauncher
Launcher for Supernaut.FX (JavaFX) applications. By using this launcher, your applications can implement the ApplicationDelegate interface instead of extending Application and have their constructor dependency injected -- see ApplicationDelegate for an explanation of the advantages and details of this approach.
  • Method Details

    • launch

      void launch(String[] args, Class<? extends ApplicationDelegate> appDelegate, Class<? extends BackgroundApp> backgroundApp)
      Launch and run the application on the current thread. Does not return until after ApplicationDelegate closes.
      Parameters:
      args - command-line args
      appDelegate - class object for ApplicationDelegate
      backgroundApp - class object for BackgroundApp
    • launch

      void launch(String[] args, Class<? extends ApplicationDelegate> appDelegate)
      Launch and run the application on the current thread. Uses default/no-op background application. Does not return until after ApplicationDelegate closes.
      Parameters:
      args - command-line args
      appDelegate - class object for ApplicationDelegate
    • launchAsync

      CompletableFuture<ApplicationDelegate> launchAsync(String[] args, Class<? extends ApplicationDelegate> appDelegate, Class<? extends BackgroundApp> backgroundApp)
      Launch and run the application on a newly created thread. This method is useful for testing and possibly for other application startup scenarios.
      Parameters:
      args - command-line args
      appDelegate - class object for ApplicationDelegate
      backgroundApp - class object for BackgroundApp
      Returns:
      A future that is completed when ApplicationDelegate app is initialized
    • getAppDelegate

      Get a future that will be completed when the ApplicationDelegate is initialized.
      Returns:
      A future that is completed when ApplicationDelegate is initialized
    • getBackgroundApp

      Get a future that will be completed when the Background app is initialized.
      Returns:
      A future that is completed when Background app is initialized
    • createAppDelegate

      ApplicationDelegate createAppDelegate(javafx.application.Application jfxApplication)
      Construct a ApplicationDelegate that is a delegate to OpenJfxProxyApplication.
      Parameters:
      jfxApplication - The OpenJfx "proxy" app instance
      Returns:
      A newly constructed (and possibly injected) ApplicationDelegate
    • name

      Implementations must implement this method to return a unique name
      Returns:
      A unique name for this DI-capable FxLauncher implementation
    • byName

      static FxLauncher byName(String name)
      Find a FxLauncher provider by name
      Parameters:
      name - Name (e.g. "micronaut")
      Returns:
      an FxLaunder instance
      Throws:
      NoSuchElementException - if not found
    • find

      static FxLauncher find()
      Find default FxLauncher
      Returns:
      an FxLaunder instance
      Throws:
      NoSuchElementException - if not found
    • findFirst

      Find a launcher using a custom predicate
      Parameters:
      filter - predicate for finding a launcher
      Returns:
      the first launcher matching the predicate, if any