Package io.jmix.flowui.backgroundtask
Class LocalizedTaskWrapper<T,V> 
java.lang.Object
io.jmix.flowui.backgroundtask.BackgroundTask<T,V>
 
io.jmix.flowui.backgroundtask.LocalizedTaskWrapper<T,V> 
- Type Parameters:
- T- task progress measurement unit
- V- result type
@Component("flowui_LocalizedTaskWrapper")
@Scope("prototype")
public class LocalizedTaskWrapper<T,V> 
extends BackgroundTask<T,V> 
INTERNAL!
 Supposed to use when showing 
Dialog or some View. For instance
 if we need to show some dialog when task is running (e.g. updating the progress).
 
 See example in DialogsImpl.BackgroundTaskDialogBuilderImpl.
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class io.jmix.flowui.backgroundtask.BackgroundTaskBackgroundTask.ProgressListener<T,V>, BackgroundTask.ProgressListenerAdapter<T, V> 
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Consumer<LocalizedTaskWrapper.CloseViewContext>protected Messagesprotected Notificationsprotected BackgroundTask<T,V> 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcanceled()Called by the execution environment in UI thread if the task is canceled byBackgroundTaskHandler.cancel()invocation.voidCalled 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.booleanCalled by the execution environment in UI thread if the taskBackgroundTask.run(TaskLifeCycle)method raised an exception.booleanCalled by the execution environment in UI thread if the task timeout is exceeded.protected voidvoidCalled by the execution environment in UI thread on progress change.run(TaskLifeCycle<T> lifeCycle) Main method that performs a task.voidsetCloseViewHandler(Consumer<LocalizedTaskWrapper.CloseViewContext> closeViewHandler) voidsetMessages(Messages messages) voidsetNotifications(Notifications notifications) protected voidMethods inherited from class io.jmix.flowui.backgroundtask.BackgroundTaskaddProgressListener, getOwnerView, getProgressListeners, getTimeoutMilliseconds, getTimeoutSeconds, removeProgressListener
- 
Field Details- 
messages
- 
notifications
- 
wrappedTask
- 
closeViewHandler
 
- 
- 
Constructor Details- 
LocalizedTaskWrapper
 
- 
- 
Method Details- 
setMessages
- 
setNotifications
- 
getCloseViewHandler
- 
setCloseViewHandlerpublic void setCloseViewHandler(@Nullable Consumer<LocalizedTaskWrapper.CloseViewContext> closeViewHandler) 
- 
getParamsDescription copied from class:BackgroundTaskCalled 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:
- getParamsin class- BackgroundTask<T,- V> 
- Returns:
- parameters map or null if parameters are not needed
 
- 
runDescription copied from class:BackgroundTaskMain 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:
- runin class- BackgroundTask<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 
- 
handleExceptionDescription copied from class:BackgroundTaskCalled by the execution environment in UI thread if the taskBackgroundTask.run(TaskLifeCycle)method raised an exception.- Overrides:
- handleExceptionin class- BackgroundTask<T,- V> 
- Parameters:
- ex- exception
- Returns:
- true if this method implementation actually handles the exception. Used for chaining handlers.
 
- 
handleTimeoutExceptionpublic boolean handleTimeoutException()Description copied from class:BackgroundTaskCalled by the execution environment in UI thread if the task timeout is exceeded.- Overrides:
- handleTimeoutExceptionin class- BackgroundTask<T,- V> 
- Returns:
- true if this method implementation actually handles this event. Used for chaining handlers.
 
- 
doneDescription copied from class:BackgroundTaskCalled by the execution environment in UI thread when the task is completed.- Overrides:
- donein class- BackgroundTask<T,- V> 
- Parameters:
- result- result of execution returned by- BackgroundTask.run(TaskLifeCycle)method
 
- 
canceledpublic void canceled()Description copied from class:BackgroundTaskCalled 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 view closing.- Overrides:
- canceledin class- BackgroundTask<T,- V> 
 
- 
progressDescription copied from class:BackgroundTaskCalled by the execution environment in UI thread on progress change.- Overrides:
- progressin class- BackgroundTask<T,- V> 
- Parameters:
- changes- list of changes since previous invocation
 
- 
showExecutionError
- 
notifyCloseViewHandlerprotected void notifyCloseViewHandler()
 
-