|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPamController.AWTScheduler
public class AWTScheduler
Class to schedule SwingWorker tasks so that they execute one at a time. SwingWorkers do of course do their work in a different thread to the AWT thread. The point of this scheduler is to ensure that they execute one by one, can themselves update the GUI (for instance with progress bars or text output) but that the GUI itself is locked for user input to avoid problems causes by impatient users.
| Nested Class Summary | |
|---|---|
private class |
AWTScheduler.ScheduledWorkerTask
USed by InvokeLater to start a SwingWorker task. |
private class |
AWTScheduler.WorkerPropertyChangeListener
|
| Field Summary | |
|---|---|
private PamController |
pamController
|
private static AWTScheduler |
singleInstance
|
private java.util.List<java.lang.Runnable> |
taskList
|
| Constructor Summary | |
|---|---|
private |
AWTScheduler()
|
| Method Summary | |
|---|---|
static AWTScheduler |
getInstance()
Get singleton instance. |
int |
scheduleTask(java.lang.Runnable swingWorker)
Schedules a task for execution. |
void |
startNextTask()
Start the next task in the list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static AWTScheduler singleInstance
private PamController pamController
private java.util.List<java.lang.Runnable> taskList
| Constructor Detail |
|---|
private AWTScheduler()
| Method Detail |
|---|
public static AWTScheduler getInstance()
public int scheduleTask(java.lang.Runnable swingWorker)
This function will always return immediately, using invokeLAter to start the task on AWT when the function calling this has completed.
swingWorker - Prepared swing worker to execute
public void startNextTask()
If it's a SwingWorker, then run it as a scheduled worker task which will handle the disabling and re-enabling of the PAMGUARD GUI.
If it's a plain old runnable, then just send it off to the AWT thread with invoke later and go straight on to setting up the task after it.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||