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 Type
    Method
    Description
    default void
    Called on the Event Dispatch Thread if the background task was cancelled.
    default void
    Called on the Event Dispatch Thread when the task is done, successfully or not, before the result is processed.
    default void
    Called on the Event Dispatch Thread if an exception occurred during the background task.
    default void
    Called on the Event Dispatch Thread if the background task was interrupted.
    default void
    Called on the Event Dispatch Thread before the background task executes.
    default void
    Called on the Event Dispatch Thread after a successful task execution, before ProgressWorker.ResultTaskHandler.onResult(Object) or ProgressWorker.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, before ProgressWorker.ResultTaskHandler.onResult(Object) or ProgressWorker.ProgressResultTaskHandler.onResult(Object) for result-producing tasks.
    • onException

      default void onException(Exception exception)
      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.