public interface Launcher
Asynchronous two-phase application launcher. This interface is currently unused for JavaFX applications.
It is logically-compatible with
FxLauncher
which in earlier versions of Supernaut.FX was a subclass.
It uses threads to start a background app as quickly as possible and possibly before the foreground app is started. This background app can make network requests while the foreground app is starting up, so that views in the foreground app can be updated with live data as soon as possible.
-
Method Summary
Modifier and TypeMethodDescriptionGet a future that will be completed when the Background app is initialized.Get a future that will be completed when the Foreground app is initialized.void
launch
(String[] args, Class<? extends ForegroundApp> foregroundApp) Launch and run the application on the current thread.void
launch
(String[] args, Class<? extends ForegroundApp> foregroundApp, Class<? extends BackgroundApp> backgroundApp) Launch and run the application on the current thread.launchAsync
(String[] args, Class<? extends ForegroundApp> foregroundApp, Class<? extends BackgroundApp> backgroundApp) Launch and run the application on a newly created thread.
-
Method Details
-
launch
void launch(String[] args, Class<? extends ForegroundApp> foregroundApp, Class<? extends BackgroundApp> backgroundApp) Launch and run the application on the current thread. Does not return until after foreground app closes.- Parameters:
args
- command-line argsforegroundApp
- class object for ForegroundAppbackgroundApp
- 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 foreground app closes.- Parameters:
args
- command-line argsforegroundApp
- class object for ForegroundApp
-
launchAsync
CompletableFuture<ForegroundApp> launchAsync(String[] args, Class<? extends ForegroundApp> foregroundApp, 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 argsforegroundApp
- class object for ForegroundAppbackgroundApp
- class object for BackgroundApp- Returns:
- A future that is completed when Foreground app is initialized
-
getForegroundApp
Get a future that will be completed when the Foreground app is initialized.- Returns:
- A future that is completed when Foreground app 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
-