public class TaskAction<C extends ApplicationContext> extends ZAction<C>
AsyncTask
created by createTask()
.
The task is run within the ExecutorService
of the ApplicationContext
.
During execution the built-in SwingTaskMonitor
receives progress notifications
and calls the according taskXXX methods.
The getActionCancel()
method provides an according action for canceling the task.
Similar createProgressBar()
provides a readily configured ZProgressBar
attached to the task.Constructor and Description |
---|
TaskAction(C ctx) |
TaskAction(C ctx,
NlsActionKey nls) |
TaskAction(C ctx,
NlsActionKey nls,
IconKey icon) |
Modifier and Type | Method and Description |
---|---|
protected void |
actionFired(java.awt.event.ActionEvent e)
Is called when the action is fired.
|
protected void |
actionPrepare()
Runs sync BEFORE the
ZAction.actionFired(ActionEvent) method is called. |
void |
cancel() |
void |
cancelAndWait() |
protected boolean |
checkEnableCondition()
This condition is evaluated automatically after construction.
|
ZProgressBar |
createProgressBar() |
protected AsyncTask |
createTask()
Is called each time the action is fired.
|
TaskCancelAction |
getActionCancel() |
AsyncTask |
getCurrentTask() |
void |
setTask(AsyncTask newTask) |
protected void |
taskCancelled()
Is called after the has been cancelled.
|
protected void |
taskFailed(java.lang.Exception e)
Is called after the task has been failed.
|
protected void |
taskFinished()
Is called by the ET after the action has been finished, no matter
whether it succeeded or failed.
|
protected void |
taskStarted()
Is called when the task has been started
|
protected void |
taskSucceeded()
Is called when the task has been succeeded
|
actionConfirmed, actionDenied, actionFailed, actionPerformed, actionSucceeded, fire, getApplicationContext, getButtonText, getIcon, getLogChannel, getMenuText, getName, getPressedIcon, getTipText, isForced, isHandleError, isLogDebug, isLogVerbose, isPermitted, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, performAvailabilityCheck, setBusyAnimationEnabled, setHandleError, setIcon, setIcon, setLogChannel, setName, setPressedIcon, setPressedIcon, setText, setTipText, setValidator, showError, showError, showError, showInfo, showInfo, showWarning, showWarning, toString
public TaskAction(C ctx)
public TaskAction(C ctx, NlsActionKey nls)
public TaskAction(C ctx, NlsActionKey nls, IconKey icon)
public void setTask(AsyncTask newTask)
public AsyncTask getCurrentTask()
public void cancel()
public void cancelAndWait()
public ZProgressBar createProgressBar()
public TaskCancelAction getActionCancel()
protected boolean checkEnableCondition()
ZAction
checkEnableCondition
in class ZAction<C extends ApplicationContext>
protected void actionPrepare() throws java.lang.Exception
ZAction
ZAction.actionFired(ActionEvent)
method is called.
Any preconditional checks or settings may be implemented here.actionPrepare
in class ZAction<C extends ApplicationContext>
java.lang.Exception
protected final void actionFired(java.awt.event.ActionEvent e) throws java.lang.Exception
ZAction
actionFired
in class ZAction<C extends ApplicationContext>
java.lang.Exception
protected AsyncTask createTask() throws java.lang.Exception
AsyncTask
instance should be executed on
firing, then this method may return a singleton instead of creating a new task each time.java.lang.Exception
ZAction.actionConfirmed()
protected void taskStarted()
protected void taskSucceeded()
protected void taskCancelled()
protected void taskFailed(java.lang.Exception e)
protected void taskFinished()
Copyright © 2014 EsprIT-Systems. All Rights Reserved.