Module is.codion.swing.common.model
Interface ProgressWorker.Handler
- All Known Subinterfaces:
ProgressWorker.ProgressHandler<V>,ProgressWorker.ProgressResultTaskHandler<T,,V> ProgressWorker.ProgressTaskHandler<V>,ProgressWorker.ResultTaskHandler<T>,ProgressWorker.TaskHandler
- All Known Implementing Classes:
DomainGeneratorModel.PopulateTask
- Enclosing class:
ProgressWorker<T,V>
public static interface ProgressWorker.Handler
Provides default handler methods for the ProgressWorker lifecycle.
All handler methods are called on the Event Dispatch Thread.
Combined with a task interface (via ProgressWorker.TaskHandler, ProgressWorker.ResultTaskHandler, etc.),
this allows a single class to encapsulate both the background task and its handlers.
Handler methods from this interface are automatically wired when the task is passed to
ProgressWorker.BuilderFactory.task(Task), and called first. Any handlers added via the ProgressWorker.Builder
are called after, in the order they were added.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidCalled on the Event Dispatch Thread if the background task was cancelled.default voidonDone()Called on the Event Dispatch Thread when the task is done, successfully or not, before the result is processed.default voidonException(Exception exception) Called on the Event Dispatch Thread if an exception occurred during the background task.default voidCalled on the Event Dispatch Thread if the background task was interrupted.default voidCalled on the Event Dispatch Thread before the background task executes.default voidCalled on the Event Dispatch Thread after a successful task execution, beforeProgressWorker.ResultTaskHandler.onResult(Object)orProgressWorker.ProgressResultTaskHandler.onResult(Object)for result-producing tasks.
-
Method Details
-
onStarted
default void onStarted()Called on the Event Dispatch Thread before the background task executes. -
onDone
default void onDone()Called on the Event Dispatch Thread when the task is done, successfully or not, before the result is processed. -
onSuccess
default void onSuccess()Called on the Event Dispatch Thread after a successful task execution, beforeProgressWorker.ResultTaskHandler.onResult(Object)orProgressWorker.ProgressResultTaskHandler.onResult(Object)for result-producing tasks. -
onException
Called on the Event Dispatch Thread if an exception occurred during the background task.- Parameters:
exception- the exception
-
onCancelled
default void onCancelled()Called on the Event Dispatch Thread if the background task was cancelled. -
onInterrupted
default void onInterrupted()Called on the Event Dispatch Thread if the background task was interrupted.
-