- 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 Summary
Modifier and TypeMethodDescriptionstatic FxLauncherFind a FxLauncher provider by namecreateAppDelegate(javafx.application.Application jfxApplication) Construct aApplicationDelegatethat is a delegate toOpenJfxProxyApplication.static FxLauncherfind()Find default FxLauncherstatic Optional<FxLauncher>findFirst(Predicate<FxLauncher> filter) Find a launcher using a custom predicateGet a future that will be completed when the ApplicationDelegate is initialized.Get a future that will be completed when the Background app is initialized.voidlaunch(String[] args, Class<? extends ApplicationDelegate> appDelegate) Launch and run the application on the current thread.voidlaunch(String[] args, Class<? extends ApplicationDelegate> appDelegate, Class<? extends BackgroundApp> backgroundApp) Launch and run the application on the current thread.launchAsync(String[] args, Class<? extends ApplicationDelegate> appDelegate, Class<? extends BackgroundApp> backgroundApp) Launch and run the application on a newly created thread.name()Implementations must implement this method to return a unique name
-
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 argsappDelegate- class object for ApplicationDelegatebackgroundApp- class object for BackgroundApp
-
launch
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 argsappDelegate- 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 argsappDelegate- class object for ApplicationDelegatebackgroundApp- 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
Construct aApplicationDelegatethat is a delegate toOpenJfxProxyApplication.- 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
FxLauncherimplementation
-
byName
Find a FxLauncher provider by name- Parameters:
name- Name (e.g. "micronaut")- Returns:
- an FxLaunder instance
- Throws:
NoSuchElementException- if not found
-
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
-