| java.lang.Object edu.rice.cs.util.swing.AsyncTaskLauncher
AsyncTaskLauncher | abstract public class AsyncTaskLauncher (Code) | | This is the base class to the component that launches the AsyncTask. It
manages the multi-threading and ensures that the correct methods of the task
are performed on the correct thread.
author: jlugo |
Method Summary | |
abstract protected 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. | public void | 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.
< Parameters: R - >The type of result to pass from runAsync tocomplete Parameters: task - The task to execute on its own worker thread Parameters: showProgress - Whether the progress monitor should be displayed to the user. | abstract protected void | setParentContainerEnabled(boolean enabled) Sets the enabled state of the parent component. | abstract protected boolean | shouldSetEnabled() Returns whether the launcher should call
setParentContainerEnabled both to disable and to re-enable
the parent. |
createProgressMonitor | abstract protected IAsyncProgress createProgressMonitor(String description, int min, int max)(Code) | | Creates a progress monitor that can be used to provide feedback to the user
during the asynchronous task. This progress monitor will also be used to
allow the user to request the task to be canceled.
Note: this method is called strictly on the event-handling
thread.
The progress monitor used to provide feedback. |
executeTask | public void executeTask(AsyncTask<P, R> task, P param, boolean showProgress, boolean lockUI)(Code) | | Executes the AsyncTask in its own thread after performing any needed steps
to prepare the UI for its execution.
< Parameters: R - >The type of result to pass from runAsync tocomplete Parameters: task - The task to execute on its own worker thread Parameters: showProgress - Whether the progress monitor should be displayed to the user. Ifit's value is false, the user will not be able to make anycancelation requests to the task. Parameters: lockUI - Whether the user should be able to interact with the rest of theUI while the task is in progress |
setParentContainerEnabled | abstract protected void setParentContainerEnabled(boolean enabled)(Code) | | Sets the enabled state of the parent component. If the parent component is
set to dissabled, this means that the user is unable to invoke any
operations via mouse clicks or key strokes. Note: this method
is called strictly on the event-handling thread.
Parameters: enabled - Whether the parent container should be enabled |
shouldSetEnabled | abstract protected boolean shouldSetEnabled()(Code) | | Returns whether the launcher should call
setParentContainerEnabled both to disable and to re-enable
the parent. This gives the concrete implementation of the launcher more
control in case dissabling and re-enabling the view could cause
inconsistent behavior.
In some cases this should always be true, for instance, 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 there is only on and off, you wouldn't want to re-enable
the component if it was dissabled to begin with.
whether the launcher should callsetParentContainerEnabled |
|
|