Class AsyncTaskStage<T>
- Type Parameters:
T- the type of the result of the asynchronous task.
- All Implemented Interfaces:
EventTarget
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();
-
Property Summary
Properties inherited from class Stage
alwaysOnTop, fullScreenExitHint, fullScreenExitKey, fullScreen, iconified, maxHeight, maximized, maxWidth, minHeight, minWidth, resizable, titleProperties inherited from class Window
eventDispatcher, focused, forceIntegerRenderScale, height, onCloseRequest, onHidden, onHiding, onShowing, onShown, opacity, outputScaleX, outputScaleY, renderScaleX, renderScaleY, scene, showing, width, x, y -
Constructor Summary
ConstructorsConstructorDescriptionAsyncTaskStage(Object owner, boolean withCancel, Callable<T> callable) Creates the newAsyncTaskStagewith supplied callable.AsyncTaskStage(Object owner, boolean withCancel, Task<T> task) Creates the newAsyncTaskStagewith supplied task. -
Method Summary
Modifier and TypeMethodDescriptionDisplays this modal stage and executes the asynchronous task.Methods inherited from class Stage
alwaysOnTopProperty, close, fullScreenExitHintProperty, fullScreenExitKeyProperty, fullScreenProperty, getFullScreenExitHint, getFullScreenExitKeyCombination, getIcons, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getModality, getOwner, getStyle, getTitle, iconifiedProperty, 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, toFrontMethods inherited from class Window
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, forceIntegerRenderScaleProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getOutputScaleX, getOutputScaleY, getProperties, getRenderScaleX, getRenderScaleY, getScene, getUserData, getWidth, getWindows, getX, getY, hasProperties, heightProperty, hide, isFocused, isForceIntegerRenderScale, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, outputScaleXProperty, outputScaleYProperty, removeEventFilter, removeEventHandler, renderScaleXProperty, renderScaleYProperty, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setForceIntegerRenderScale, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setRenderScaleX, setRenderScaleY, setUserData, setWidth, setX, setY, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
-
Constructor Details
-
AsyncTaskStage
Creates the newAsyncTaskStagewith supplied callable.Argument
ownercan be aNode, aScene, aWindowornull. Ifowneris aNodethen"node.getScene().getWindow()"will become the owner. Ifowneris aScenethen"scene.getWindow()"will become the owner. Finally, ifownerisnullthen thisAsyncTaskStagewill become a top-level, unowned stage. See methodStage.initOwner(Window)for more detalis.- Parameters:
owner- the owner of this stage (can be null).withCancel- iftruedisplay a cancel button.callable- the callable to be executed asynchronously.- Throws:
NullPointerException- ifcallableisnull.
-
AsyncTaskStage
Creates the newAsyncTaskStagewith supplied task.Argument
ownercan be aNode, aScene, aWindowornull. Ifowneris aNodethen"node.getScene().getWindow()"will become the owner. Ifowneris aScenethen"scene.getWindow()"will become the owner. Finally, ifownerisnullthen thisAsyncTaskStagewill become a top-level, unowned stage. See methodStage.initOwner(Window)for more detalis.- Parameters:
owner- the owner of this stage (can be null).withCancel- iftruedisplay a cancel button.task- the task to be executed asynchronously.- Throws:
NullPointerException- iftaskisnull.
-
-
Method Details
-
showAndWaitForTaskValue
-