Spec-Zone .ru
спецификации, руководства, описания, API
|
public abstract class Preloader extends Application
A preloader is a small application that is started before the main application to customize the startup experience. The preloader:
The default preloader is shown on top of the application Stage, which is not visible until the preloader is visible. The preloader need to hide itself to make the application visible. Good practice is to do this no earlier than right before application.start() is called, as otherwise application itself is not visible.
The preloader may also cooperate with the application to achieve advanced visual effects or share data (e.g. to implement login screen). The preloader gets a reference to the application and may pull data it needs for cooperation from the application if the application implements an interface that the preloader knows about and relies upon. Generally it is not recommended to design preloaders in such a way that an application would call them directly, as this will result in bad user experience if the application is signed and the preloader is not.
If the application does not specify a preloader, then the default preloader is used. Default preloader appearance can be customized (set of parameters is TBD).
Custom preloader implementations should follow these rules:
Applications may also send custom notification to the preloader using the notifyCurrentPreloader() method. This way a preloader may also show application initialization progress.
Note that preloaders are subject to the same rules as other JavaFX applications including FX threading rules. In particular, the class constructor and init() method will be called on a non-FX thread and start() will be executed on the FX application thread. This also means that the application constructor/init() will run concurrently with preloader start().
Callbacks on preloader notification will be delivered on the FX application thread.
Shutdown (including when stop() is called) is TBD.
Modifier and Type | Class and Description |
---|---|
static class |
Preloader.ErrorNotification
Preloader notification that reports an error.
|
static interface |
Preloader.PreloaderNotification
Marker interface for all Preloader notification.
|
static class |
Preloader.ProgressNotification
Preloader notification that reports progress.
|
static class |
Preloader.StateChangeNotification
A notification that signals a change in the application state.
|
Application.Parameters
Constructor and Description |
---|
Preloader() |
Modifier and Type | Method and Description |
---|---|
void |
handleApplicationNotification(Preloader.PreloaderNotification info)
Indicates an application-generated notification.
|
boolean |
handleErrorNotification(Preloader.ErrorNotification info)
Called when an error occurs.
|
void |
handleProgressNotification(Preloader.ProgressNotification info)
Indicates progress.
|
void |
handleStateChangeNotification(Preloader.StateChangeNotification info)
Indicates a change in application state.
|
getHostServices, getParameters, init, launch, launch, notifyPreloader, start, stop
public void handleProgressNotification(Preloader.ProgressNotification info)
The implementation of this method provided by the Preloader class does nothing.
info
- the progress notificationpublic void handleStateChangeNotification(Preloader.StateChangeNotification info)
The implementation of this method provided by the Preloader class does nothing.
info
- the state change notificationpublic void handleApplicationNotification(Preloader.PreloaderNotification info)
The implementation of this method provided by the Preloader class does nothing.
info
- the application-generated notificationpublic boolean handleErrorNotification(Preloader.ErrorNotification info)
The implementation of this method provided by the Preloader class returns false, indicating that the default error handler should show the message to the user.
info
- the error notification describing the cause of this errorCopyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to