Package io.jmix.ui.executor
Class LocalizedTaskWrapper<T,V>
java.lang.Object
io.jmix.ui.executor.BackgroundTask<T,V>
io.jmix.ui.executor.LocalizedTaskWrapper<T,V>
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.executor.BackgroundTask
BackgroundTask.ProgressListener<T,
V>, BackgroundTask.ProgressListenerAdapter<T, V> -
Field Summary
Modifier and TypeFieldDescriptionprotected Messages
protected Screen
protected BackgroundTask<T,
V> -
Constructor Summary
ConstructorDescriptionLocalizedTaskWrapper
(BackgroundTask<T, V> wrappedTask, Screen screen, Messages messages) -
Method Summary
Modifier and TypeMethodDescriptionvoid
canceled()
Called by the execution environment in UI thread if the task is canceled byBackgroundTaskHandler.cancel()
invocation.void
Called by the execution environment in UI thread when the task is completed.Called by the execution environment in UI thread to prepare some execution parameters.protected ScreenContext
boolean
Called by the execution environment in UI thread if the taskBackgroundTask.run(TaskLifeCycle)
method raised an exception.boolean
Called by the execution environment in UI thread if the task timeout is exceeded.void
Called by the execution environment in UI thread on progress change.run
(TaskLifeCycle<T> lifeCycle) Main method that performs a task.protected void
Methods inherited from class io.jmix.ui.executor.BackgroundTask
addProgressListener, getOwnerFrame, getOwnerScreen, getProgressListeners, getTimeoutMilliseconds, getTimeoutSeconds, removeProgressListener
-
Field Details
-
wrappedTask
-
screen
-
messages
-
-
Constructor Details
-
LocalizedTaskWrapper
-
-
Method Details
-
getParams
Description copied from class:BackgroundTask
Called by the execution environment in UI thread to prepare some execution parameters. These parameters can be requested by the working thread inside theBackgroundTask.run(TaskLifeCycle)
method by callingTaskLifeCycle.getParams()
.- Overrides:
getParams
in classBackgroundTask<T,
V> - Returns:
- parameters map or null if parameters are not needed
-
run
Description copied from class:BackgroundTask
Main method that performs a task.
Called by the execution environment in a separate working thread.
Implementation of this method should support interruption:- In long loops check
TaskLifeCycle.isInterrupted()
and return if it is true - Don't swallow
InterruptedException
- return from the method or don't catch it at all
- Specified by:
run
in classBackgroundTask<T,
V> - Parameters:
lifeCycle
- lifecycle object that allows the main method to interact with the execution environment- Returns:
- task result
- Throws:
Exception
- exception in working thread
- In long loops check
-
handleException
Description copied from class:BackgroundTask
Called by the execution environment in UI thread if the taskBackgroundTask.run(TaskLifeCycle)
method raised an exception.- Overrides:
handleException
in classBackgroundTask<T,
V> - Parameters:
ex
- exception- Returns:
- true if this method implementation actually handles the exception. Used for chaining handlers.
-
handleTimeoutException
public boolean handleTimeoutException()Description copied from class:BackgroundTask
Called by the execution environment in UI thread if the task timeout is exceeded.- Overrides:
handleTimeoutException
in classBackgroundTask<T,
V> - Returns:
- true if this method implementation actually handles this event. Used for chaining handlers.
-
done
Description copied from class:BackgroundTask
Called by the execution environment in UI thread when the task is completed.- Overrides:
done
in classBackgroundTask<T,
V> - Parameters:
result
- result of execution returned byBackgroundTask.run(TaskLifeCycle)
method
-
canceled
public void canceled()Description copied from class:BackgroundTask
Called by the execution environment in UI thread if the task is canceled byBackgroundTaskHandler.cancel()
invocation.
This method is not called in case of timeout expiration or owner window closing.- Overrides:
canceled
in classBackgroundTask<T,
V>
-
progress
Description copied from class:BackgroundTask
Called by the execution environment in UI thread on progress change.- Overrides:
progress
in classBackgroundTask<T,
V> - Parameters:
changes
- list of changes since previous invocation
-
getScreenContext
-
showExecutionError
-