public class LocalizedTaskWrapper<T,V> extends BackgroundTask<T,V>
BackgroundTask.ProgressListener<T,V>, BackgroundTask.ProgressListenerAdapter<T,V>
Modifier and Type | Field and Description |
---|---|
protected Screen |
screen |
protected BackgroundTask<T,V> |
wrappedTask |
Modifier | Constructor and Description |
---|---|
protected |
LocalizedTaskWrapper(BackgroundTask<T,V> wrappedTask,
Screen screen) |
Modifier and Type | Method and Description |
---|---|
void |
canceled()
Called by the execution environment in UI thread if the task is canceled by
BackgroundTaskHandler.cancel() invocation. |
void |
done(V result)
Called by the execution environment in UI thread when the task is completed.
|
java.util.Map<java.lang.String,java.lang.Object> |
getParams()
Called by the execution environment in UI thread to prepare some execution parameters.
|
protected ScreenContext |
getScreenContext() |
boolean |
handleException(java.lang.Exception ex)
Called by the execution environment in UI thread if the task
BackgroundTask.run(TaskLifeCycle) method raised an
exception. |
boolean |
handleTimeoutException()
Called by the execution environment in UI thread if the task timeout is exceeded.
|
void |
progress(java.util.List<T> changes)
Called by the execution environment in UI thread on progress change.
|
V |
run(TaskLifeCycle<T> lifeCycle)
Main method that performs a task.
|
protected void |
showExecutionError(java.lang.Exception ex) |
addProgressListener, getOwnerFrame, getOwnerScreen, getProgressListeners, getTimeoutMilliseconds, getTimeoutSeconds, removeProgressListener
protected BackgroundTask<T,V> wrappedTask
protected Screen screen
protected LocalizedTaskWrapper(BackgroundTask<T,V> wrappedTask, Screen screen)
public java.util.Map<java.lang.String,java.lang.Object> getParams()
BackgroundTask
BackgroundTask.run(TaskLifeCycle)
method by calling
TaskLifeCycle.getParams()
.getParams
in class BackgroundTask<T,V>
public V run(TaskLifeCycle<T> lifeCycle) throws java.lang.Exception
BackgroundTask
TaskLifeCycle.isInterrupted()
and return if it is trueInterruptedException
- return from the method or don't catch it at allrun
in class BackgroundTask<T,V>
lifeCycle
- lifecycle object that allows the main method to interact with the execution environmentjava.lang.Exception
- exception in working threadpublic boolean handleException(java.lang.Exception ex)
BackgroundTask
BackgroundTask.run(TaskLifeCycle)
method raised an
exception.handleException
in class BackgroundTask<T,V>
ex
- exceptionpublic boolean handleTimeoutException()
BackgroundTask
handleTimeoutException
in class BackgroundTask<T,V>
public void done(V result)
BackgroundTask
done
in class BackgroundTask<T,V>
result
- result of execution returned by BackgroundTask.run(TaskLifeCycle)
methodpublic void canceled()
BackgroundTask
BackgroundTaskHandler.cancel()
invocation.
canceled
in class BackgroundTask<T,V>
public void progress(java.util.List<T> changes)
BackgroundTask
progress
in class BackgroundTask<T,V>
changes
- list of changes since previous invocationprotected ScreenContext getScreenContext()
protected void showExecutionError(java.lang.Exception ex)