|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.util.swing.AsyncTask<ParamType,ResType>
public abstract class AsyncTask<ParamType,ResType>
The AsyncTask base class is a framework that facilitates execution of operations asynchronously in order to free up the event-handling thread. This task is passed to an implementation of the AsyncTaskLauncher to be run.
Any code that should be performed in asynchronously with the UI should be put
in the runAsync
method. Any code that is run in this method
should NOT modify any Swing components at all. All modifications to Swing
components must either be enqueued on the event-handling thread or performed
in the complete
method. If there is any data that must be
passed from the asynchronous step to the completion step, it should be
returned by the runAsync
method. The same data returned by the
runAsync
method will be given to the complete
method. In short, implementations of an AsyncTask need not manage the
information passing between the task thread and the UI thread.
The runAsync
method is given a progress monitor in order for
the task to provide feedback to the user as to the progress of the task. The
min and max values for the progress are specified by the
getMinProgress
and getMaxProgress
methods in
the task.
Constructor Summary | |
---|---|
AsyncTask()
Default Constructor |
|
AsyncTask(String name)
Creates a task that has the given name |
Method Summary | |
---|---|
abstract void |
complete(AsyncCompletionArgs<ResType> args)
Performs te completion step where modifications to swing components are made. |
abstract String |
getDiscriptionMessage()
Sets the description of the task that should be displayed in the progress monitor that the user sees. |
int |
getMaxProgress()
Reutrns the minimum value of the progress monitor |
int |
getMinProgress()
Returns the minimum value of the progress monitor |
String |
getName()
Returns the name of this specific type of task. |
abstract ResType |
runAsync(ParamType param,
IAsyncProgress monitor)
This is the method of the task that is run on the separate thread. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AsyncTask()
public AsyncTask(String name)
name
- The name of the task.Method Detail |
---|
public abstract ResType runAsync(ParamType param, IAsyncProgress monitor) throws Exception
complete
method.
param
- Any parameter that should be passed to the task when it is executedmonitor
- An object that controls the flow of information about task progress both to and from the runAsync
method. This also offers a means of passing a result from the async step to the completion step.
RuntimeException
Exception
public abstract void complete(AsyncCompletionArgs<ResType> args)
public abstract String getDiscriptionMessage()
ProgressMonitor.setNote
public String getName()
public int getMinProgress()
public int getMaxProgress()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |