public class SwingTaskMonitor<C extends ApplicationContext> extends AbstractTaskMonitor<C> implements TaskEvent.Source
AsyncTask about it's RunState changes. It
converts the asynchronous RunState change notifications to thread-safe TaskEvents
which you can register for. The events can i.e. be used for driving a ZProgressBar.
Note that this monitor does nothing when it is running in a non graphics environment (headless).
| Constructor and Description |
|---|
SwingTaskMonitor(C ctx) |
SwingTaskMonitor(C ctx,
LogChannel logCh) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(RunState stateFlag)
|
void |
addTaskListener(TaskEvent.Listener l) |
int |
getTaskListenerCount() |
protected boolean |
isAutoReportError() |
void |
removeTaskListener(TaskEvent.Listener l) |
void |
setAutoReportError(boolean isAutoReportError)
Tells whether a a GUI error dialog should be raised on failure.
|
void |
setBlockingEventNotification(boolean isBlocking) |
void |
setTestMode(boolean isTestMode) |
void |
taskCancelled(RunStateFlag stateFlag)
Called when the async task has discovered that it was cancelled
|
void |
taskChildFinished(RunStateFlag stateFlag)
Indicates that a child task has been finished.
|
void |
taskChildStarted(RunStateFlag stateFlag)
Indicates that a child task has been started.
|
void |
taskChildSucceeded(RunStateFlag stateFlag,
java.lang.Object result)
Indicates that a child task has been succeeded with the given result.
|
void |
taskFailed(RunStateFlag stateFlag,
java.lang.Exception error)
Called when the async task failed
|
void |
taskFinished(RunStateFlag stateFlag)
Called when the async task finished
|
void |
taskProceeded(RunStateFlag stateFlag,
java.lang.Object info,
int step,
int maxSteps,
java.lang.String message)
Is called on task progress.
|
void |
taskStarted(RunStateFlag stateFlag)
Called when the async task started
|
void |
taskSucceeded(RunStateFlag stateFlag,
java.lang.Object result)
Called when the async task succeeded
|
getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetApplicationContextpublic SwingTaskMonitor(C ctx)
public SwingTaskMonitor(C ctx, LogChannel logCh)
public void setTestMode(boolean isTestMode)
public void setBlockingEventNotification(boolean isBlocking)
public void taskStarted(RunStateFlag stateFlag)
TaskMonitortaskStarted in interface TaskMonitor<C extends ApplicationContext>public void taskSucceeded(RunStateFlag stateFlag, java.lang.Object result)
TaskMonitortaskSucceeded in interface TaskMonitor<C extends ApplicationContext>public void taskCancelled(RunStateFlag stateFlag)
TaskMonitortaskCancelled in interface TaskMonitor<C extends ApplicationContext>public void taskFailed(RunStateFlag stateFlag, java.lang.Exception error)
TaskMonitortaskFailed in interface TaskMonitor<C extends ApplicationContext>public void taskFinished(RunStateFlag stateFlag)
TaskMonitortaskFinished in interface TaskMonitor<C extends ApplicationContext>public void taskProceeded(RunStateFlag stateFlag, java.lang.Object info, int step, int maxSteps, java.lang.String message)
TaskMonitortaskProceeded in interface TaskMonitor<C extends ApplicationContext>info - may be anything the running task has produced (i.e. a DBRecord)step - the number of steps performedmaxSteps - the maximum number of steps expected (0 if not known)public void taskChildStarted(RunStateFlag stateFlag)
TaskMonitorRunStateFlag.getCurrentChild();taskChildStarted in interface TaskMonitor<C extends ApplicationContext>public void taskChildSucceeded(RunStateFlag stateFlag, java.lang.Object result)
TaskMonitortaskChildSucceeded in interface TaskMonitor<C extends ApplicationContext>public void taskChildFinished(RunStateFlag stateFlag)
TaskMonitortaskChildFinished in interface TaskMonitor<C extends ApplicationContext>public boolean accept(RunState stateFlag)
RunState before actually firing a TaskEvent.
By default firing only happens, when there are listeners.accept in interface TaskMonitor<C extends ApplicationContext>accept in class AbstractTaskMonitor<C extends ApplicationContext>protected boolean isAutoReportError()
setAutoReportError(boolean)public void setAutoReportError(boolean isAutoReportError)
isAutoReportError - is by default trueisAutoReportError()public final void addTaskListener(TaskEvent.Listener l)
addTaskListener in interface TaskEvent.Sourcepublic final void removeTaskListener(TaskEvent.Listener l)
removeTaskListener in interface TaskEvent.Sourcepublic final int getTaskListenerCount()
Copyright © 2014 EsprIT-Systems. All Rights Reserved.