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 interface ProgressWorker.Builder<T,V>
Builds a
ProgressWorker
instance.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
execute()
Builds and executes a newProgressWorker
based on this buildermaximumProgress
(int maximumProgress) onCancelled
(Runnable onCancelled) onException
(Consumer<Exception> onException) onInterrupted
(Runnable onInterrupted) onProgress
(Consumer<Integer> onProgress) Note that this does not get called in case the background processing has finished before theSwingWorker.StateValue.STARTED
change event is fired.
-
Method Details
-
maximumProgress
- Parameters:
maximumProgress
- the maximum progress, 100 by default- Returns:
- this builder instance
-
onStarted
Note that this does not get called in case the background processing has finished before theSwingWorker.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
- Parameters:
onResult
- called on the EDT when the result of a successful run is available- Returns:
- this builder instance
-
onProgress
- Parameters:
onProgress
- called on the EDT when progress is reported- Returns:
- this builder instance
-
onPublish
- Parameters:
onPublish
- called on the EDT when chunks are available for publishing- Returns:
- this builder instance
-
onException
- Parameters:
onException
- called on the EDT if an exception occurred- Returns:
- this builder instance
-
onCancelled
- Parameters:
onCancelled
- called on the EDT if the background task was cancelled- Returns:
- this builder instance
-
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 newProgressWorker
based on this builder- Returns:
- a
ProgressWorker
based on this builder
-
build
ProgressWorker<T,V> build()- Returns:
- a
ProgressWorker
based on this builder
-