Interface ProgressWorker.Builder<T,V>

Type Parameters:
T - the worker result type
V - the intermediate result type
Enclosing class:
ProgressWorker<T,V>

public static interface ProgressWorker.Builder<T,V>
Builds a ProgressWorker instance.
  • Method Details

    • maximumProgress

      ProgressWorker.Builder<T,V> maximumProgress(int maximumProgress)
      Parameters:
      maximumProgress - the maximum progress, 100 by default
      Returns:
      this builder instance
    • onStarted

      ProgressWorker.Builder<T,V> onStarted(Runnable onStarted)
      Note that this does not get called in case the background processing has finished before the SwingWorker.StateValue.STARTED change event is fired.
      Parameters:
      onStarted - called on the EDT before background processing is started
      Returns:
      this builder instance
    • onDone

      Parameters:
      onDone - called on the EDT when the task is done running, successfully or not, before the result is processed
      Returns:
      this builder instance
    • onResult

      ProgressWorker.Builder<T,V> onResult(Consumer<T> onResult)
      Parameters:
      onResult - called on the EDT when the result of a successful run is available
      Returns:
      this builder instance
    • onProgress

      ProgressWorker.Builder<T,V> onProgress(Consumer<Integer> onProgress)
      Parameters:
      onProgress - called on the EDT when progress is reported
      Returns:
      this builder instance
    • onPublish

      ProgressWorker.Builder<T,V> onPublish(Consumer<List<V>> onPublish)
      Parameters:
      onPublish - called on the EDT when chunks are available for publishing
      Returns:
      this builder instance
    • onException

      ProgressWorker.Builder<T,V> onException(Consumer<Exception> onException)
      Parameters:
      onException - called on the EDT if an exception occurred
      Returns:
      this builder instance
    • onCancelled

      ProgressWorker.Builder<T,V> onCancelled(Runnable onCancelled)
      Parameters:
      onCancelled - called on the EDT if the background task was cancelled
      Returns:
      this builder instance
    • onInterrupted

      ProgressWorker.Builder<T,V> onInterrupted(Runnable onInterrupted)
      Parameters:
      onInterrupted - called on the EDT if the background task was interrupted
      Returns:
      this builder instance
    • execute

      ProgressWorker<T,V> execute()
      Builds and executes a new ProgressWorker based on this builder
      Returns:
      a ProgressWorker based on this builder
    • build

      ProgressWorker<T,V> build()
      Returns:
      a ProgressWorker based on this builder