T - The result type of the SwingTaskpublic final class SwingTaskExecutorBuilder<T> extends Object
SwingTaskExecutor instances, returned by
SwingTaskExecutors.create(SwingTask). It allows setting
all parameters for the execution of a SwingTask, in
a fluent style, and finally obtaining the SwingTaskExecutor
instance by calling build().| Modifier and Type | Method and Description |
|---|---|
SwingTaskExecutor<T> |
build()
Build the
SwingTaskExecutor based on the current
configuration of this builder |
SwingTaskExecutorBuilder<T> |
setCancelable(boolean cancelable)
Set whether the
SwingTask should be cancelable, and the
SwingTaskView should contain a button for canceling the task |
SwingTaskExecutorBuilder<T> |
setDialogUncaughtExceptionHandler()
Set a handler for potential uncaught exceptions that happen during
the execution of the
SwingTask. |
SwingTaskExecutorBuilder<T> |
setMillisToDecideToPopup(int millisToDecideToPopup)
Set the number of milliseconds that the Event Dispatch Thread
should be blocked when calling
SwingTaskExecutor.execute()
before the decision is made about whether to show a
SwingTaskView or not |
SwingTaskExecutorBuilder<T> |
setMillisToPopup(int millisToPopup)
Set the number of milliseconds that the task has to take so
that a
SwingTaskView will be shown. |
SwingTaskExecutorBuilder<T> |
setModal(boolean modal)
Set whether the
SwingTaskView that may be shown should be modal |
SwingTaskExecutorBuilder<T> |
setParentComponent(Component parentComponent)
Set the parent component for the
SwingTaskView. |
SwingTaskExecutorBuilder<T> |
setParentWindow(Window parentWindow)
Set the parent window for the
SwingTaskView that may be shown. |
SwingTaskExecutorBuilder<T> |
setSwingTaskViewFactory(SwingTaskViewFactory swingTaskViewFactory)
Set the factory that will be called to create the
SwingTaskView
that will be displayed while the task is running. |
SwingTaskExecutorBuilder<T> |
setTitle(String title)
Set the title of the
SwingTaskView that may be shown |
SwingTaskExecutorBuilder<T> |
setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Set the handler that should be assigned to the
SwingTask
in order to handle potential uncaught exceptions that happen
during the execution |
public SwingTaskExecutorBuilder<T> setParentWindow(Window parentWindow)
SwingTaskView that may be shown.
If this is not explicitly set, then the window ancestor
of the parent component
will be used. If no parent component was set, then the
currently focused java.awt.Frame (or the first
one that is visible) will be used. If the parent is explicitly set to
null, then the SwingTaskView will have no parent.parentWindow - The parent window.public SwingTaskExecutorBuilder<T> setParentComponent(Component parentComponent)
SwingTaskView. If no
parent window was explicitly
set, then the window ancestor of the parent component will
be used as the parent window of the SwingTaskViewparentComponent - The parent component for the SwingTaskViewpublic SwingTaskExecutorBuilder<T> setTitle(String title)
SwingTaskView that may be showntitle - The title of the SwingTaskViewpublic SwingTaskExecutorBuilder<T> setModal(boolean modal)
SwingTaskView that may be shown should be modalmodal - Whether the SwingTaskView should be modalpublic SwingTaskExecutorBuilder<T> setCancelable(boolean cancelable)
SwingTask should be cancelable, and the
SwingTaskView should contain a button for canceling the taskcancelable - Whether the SwingTask should be cancelablepublic SwingTaskExecutorBuilder<T> setMillisToDecideToPopup(int millisToDecideToPopup)
SwingTaskExecutor.execute()
before the decision is made about whether to show a
SwingTaskView or notmillisToDecideToPopup - The number of millisecondspublic SwingTaskExecutorBuilder<T> setMillisToPopup(int millisToPopup)
SwingTaskView will be shown. After the
decision delay has
passed, the completion time of the task will be predicted,
based on the progress
that has been reported by the task so far. If the completion
time is greater than the time that is passed to this method,
then a SwingTaskView will be shown. Also, when the task
actually takes longer than the time that is passed to this method,
a SwingTaskView will be shown.millisToPopup - The number of millisecondspublic SwingTaskExecutorBuilder<T> setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
SwingTask
in order to handle potential uncaught exceptions that happen
during the executionuncaughtExceptionHandler - The exception handlersetDialogUncaughtExceptionHandler()public SwingTaskExecutorBuilder<T> setDialogUncaughtExceptionHandler()
SwingTask. This handler will
show a dialog containing the exception stack trace.#setUncaughtExceptionHandler(UncaughtExceptionHandler)public SwingTaskExecutorBuilder<T> setSwingTaskViewFactory(SwingTaskViewFactory swingTaskViewFactory)
SwingTaskView
that will be displayed while the task is running.swingTaskViewFactory - The SwingTaskViewFactorypublic SwingTaskExecutor<T> build()
SwingTaskExecutor based on the current
configuration of this builderSwingTaskExecutorCopyright © 2016. All rights reserved.