T
- the type of the result of the asynchronous task.public final class AsyncTaskStage<T> extends Stage
Stage
used to execute an asynchronous task.
The following code fragment demonstrates typical usage:
// Define callable to be executed asynchronously Callable<Integer> callable = () -> computeResult(); // Create AsyncTaskStage to execute callable with owner and cancel button AsyncTaskStage<Integer> asyncStage = new AsyncTaskStage<>(owner, true, callable); // Display AsyncTaskStage, execute and obtain result Integer result = asyncStage.showAndWaitForTaskValue();
impl_peer, peerListener
Constructor and Description |
---|
AsyncTaskStage(Object owner,
boolean withCancel,
Callable<T> callable)
Creates the new
AsyncTaskStage with supplied callable. |
AsyncTaskStage(Object owner,
boolean withCancel,
Task<T> task)
Creates the new
AsyncTaskStage with supplied task. |
Modifier and Type | Method and Description |
---|---|
T |
showAndWaitForTaskValue()
Displays this modal stage and executes the asynchronous task.
|
alwaysOnTopProperty, close, fullScreenExitHintProperty, fullScreenExitKeyProperty, fullScreenProperty, getFullScreenExitHint, getFullScreenExitKeyCombination, getIcons, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getModality, getOwner, getStyle, getTitle, iconifiedProperty, impl_getMXWindowType, impl_setImportant, impl_setPrimary, impl_visibleChanged, impl_visibleChanging, initModality, initOwner, initStyle, isAlwaysOnTop, isFullScreen, isIconified, isMaximized, isResizable, maxHeightProperty, maximizedProperty, maxWidthProperty, minHeightProperty, minWidthProperty, resizableProperty, setAlwaysOnTop, setFullScreen, setFullScreenExitHint, setFullScreenExitKeyCombination, setIconified, setMaxHeight, setMaximized, setMaxWidth, setMinHeight, setMinWidth, setResizable, setScene, setTitle, show, showAndWait, titleProperty, toBack, toFront
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getProperties, getScene, getUserData, getWidth, getX, getY, hasProperties, heightProperty, hide, impl_getPeer, impl_getWindows, isFocused, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, removeEventFilter, removeEventHandler, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setFocused, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setUserData, setWidth, setX, setY, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
public AsyncTaskStage(Object owner, boolean withCancel, Callable<T> callable)
AsyncTaskStage
with supplied callable.
Argument owner
can be a Node
, a Scene
, a Window
or null
. If owner
is a Node
then "node.getScene().getWindow()"
will become the owner. If owner
is
a Scene
then "scene.getWindow()"
will become the owner.
Finally, if owner
is null
then this AsyncTaskStage
will become a top-level, unowned stage. See method Stage.initOwner(Window)
for more detalis.
owner
- the owner of this stage (can be null).withCancel
- if true
display a cancel button.callable
- the callable to be executed asynchronously.NullPointerException
- if callable
is null
.public AsyncTaskStage(Object owner, boolean withCancel, Task<T> task)
AsyncTaskStage
with supplied task.
Argument owner
can be a Node
, a Scene
, a Window
or null
. If owner
is a Node
then "node.getScene().getWindow()"
will become the owner. If owner
is
a Scene
then "scene.getWindow()"
will become the owner.
Finally, if owner
is null
then this AsyncTaskStage
will become a top-level, unowned stage. See method Stage.initOwner(Window)
for more detalis.
owner
- the owner of this stage (can be null).withCancel
- if true
display a cancel button.task
- the task to be executed asynchronously.NullPointerException
- if task
is null
.Copyright © OBCOM INGENIERIA S.A. (Chile). All Rights Reserved.