Module is.codion.swing.common.model
Interface ProgressWorker.Builder<T,V>
- Type Parameters:
T- the worker result typeV- the intermediate result type
- Enclosing class:
ProgressWorker<T,V>
public static sealed interface ProgressWorker.Builder<T,V>
Builds a
ProgressWorker instance.-
Method Summary
Modifier and TypeMethodDescriptionbuild()execute()Builds and executes a newProgressWorkerbased on this buildermaximum(int maximum) Overrides any maximum progress specified by the task itself.onCancelled(Runnable onCancelled) Called in case the background task is cancelled viaSwingWorker.cancel(boolean)or if it throws aCancelExceptiononException(Consumer<Exception> onException) onInterrupted(Runnable onInterrupted) onProgress(Consumer<Integer> onProgress)
-
Method Details
-
maximum
Overrides any maximum progress specified by the task itself.- Parameters:
maximum- the maximum progress,ProgressWorker.DEFAULT_MAXIMUM(100) by default- Returns:
- this builder instance
- See Also:
-
onStarted
- Parameters:
onStarted- called on the EDT before background processing is started- Returns:
- this builder instance
-
onDone
- Parameters:
onDone- called on the Event Dispatch Thread when the task is done running, successfully or not, before the result is processed- Returns:
- this builder instance
-
onResult
- Parameters:
onResult- called on the Event Dispatch Thread when the result of a successful run is available- Returns:
- this builder instance
-
onResult
- Parameters:
onResult- called on the Event Dispatch Thread when the result of a successful run is available- Returns:
- this builder instance
-
onProgress
- Parameters:
onProgress- called on the Event Dispatch Thread when progress is reported- Returns:
- this builder instance
-
onPublish
- Parameters:
onPublish- called on the Event Dispatch Thread when chunks are available for publishing- Returns:
- this builder instance
-
onException
- Parameters:
onException- called on the Event Dispatch Thread if an exception occurred- Returns:
- this builder instance
-
onCancelled
Called in case the background task is cancelled viaSwingWorker.cancel(boolean)or if it throws aCancelException- Parameters:
onCancelled- called on the Event Dispatch Thread if the background task was cancelled- Returns:
- this builder instance
-
onInterrupted
- Parameters:
onInterrupted- called on the Event Dispatch Thread if the background task was interrupted- Returns:
- this builder instance
-
execute
ProgressWorker<T,V> execute()Builds and executes a newProgressWorkerbased on this builder- Returns:
- a
ProgressWorkerbased on this builder
-
build
ProgressWorker<T,V> build()- Returns:
- a
ProgressWorkerbased on this builder
-