|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.util.swing.AsyncTaskLauncher
public abstract class AsyncTaskLauncher
The base class of the component that launches an AsyncTask. It manages the multi-threading and ensures that the correct methods of the task are performed on the correct thread.
Constructor Summary | |
---|---|
AsyncTaskLauncher()
|
Method Summary | ||
---|---|---|
protected abstract IAsyncProgress |
createProgressMonitor(String description,
int min,
int max)
Creates a progress monitor that can be used to provide feedback to the user during the asynchronous task. |
|
|
executeTask(AsyncTask<P,R> task,
P param,
boolean showProgress,
boolean lockUI)
Executes the AsyncTask in its own thread after performing any needed steps to prepare the UI for its execution. |
|
protected abstract void |
setParentContainerEnabled(boolean enabled)
Sets the enabled state of the parent component. |
|
protected abstract boolean |
shouldSetEnabled()
Returns whether the launcher should call setParentContainerEnabled both to disable and to re-enable
the parent. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsyncTaskLauncher()
Method Detail |
---|
protected abstract boolean shouldSetEnabled()
setParentContainerEnabled
both to disable and to re-enable
the parent. This facility gives launchers more control over the view in case dissabling or re-enabling the view
produces inconsistent behavior. In some cases, this method should always return true, e.g., when for each call to lock the UI, you must call the unlock method an equal number of times to actually unlock the frame. If this were dissabling a normal swing component, where can only be on/off, you wouldn't want to re-enable the component if it was already disabled.
setParentContainerEnabled
protected abstract void setParentContainerEnabled(boolean enabled)
enabled
- Whether the parent container should be enabledprotected abstract IAsyncProgress createProgressMonitor(String description, int min, int max)
This method only executes in the event-handling thread.
public <P,R> void executeTask(AsyncTask<P,R> task, P param, boolean showProgress, boolean lockUI)
R
- The type of result to pass from runAsync
to complete
task
- The task to execute on its own worker threadshowProgress
- Whether the progress monitor should be displayed to the user. If it is false, the user will
not be able to make any cancelation requests to the task.lockUI
- Whether the user should be able to interact with the rest of the UI while the task is in progress.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |