Class ProgressWorker<T,V>

java.lang.Object
javax.swing.SwingWorker<T,V>
is.codion.swing.common.model.worker.ProgressWorker<T,V>
Type Parameters:
T - the type of result this ProgressWorker produces.
V - the type of intermediate result produced by this ProgressWorker
All Implemented Interfaces:
Runnable, Future<T>, RunnableFuture<T>

public final class ProgressWorker<T,V> extends SwingWorker<T,V>

A SwingWorker implementation. Instances of this class are not reusable.

Note that this implementation does NOT coalesce progress reports or intermediate result publishing, but simply pushes those directly to the onProgress and onPublish handlers on the Event Dispatch Thread.

Note that the onStarted handler is NOT called in case the background task finishes before the SwingWorker.StateValue.STARTED change event is fired.

 
 ProgressWorker.builder(this::performTask)
   .onStarted(this::displayDialog)
   .onDone(this::closeDialog)
   .onResult(this::handleResult)
   .onProgress(this::displayProgress)
   .onPublish(this::publishMessage)
   .onCancelled(this::displayCancelledMessage)
   .onException(this::displayException)
   .execute();
 
 
See Also: