|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TaskListener<T,V>
Listener used for observing Task
execution.
A TaskListener
is particularly
useful for monitoring the the intermediate results
published
by a Task in situations
where it's not practical to override the Task's
process
method. Note that if
what you really want to do is monitor a Task's state
and progress, a PropertyChangeListener is probably more
appropriate.
The Task class runs all TaskListener methods on the event dispatching thread and the source of all TaskEvents is the Task object.
Task.addTaskListener(org.jdesktop.application.TaskListener)
,
Task.removeTaskListener(org.jdesktop.application.TaskListener)
,
SwingWorker.addPropertyChangeListener(java.beans.PropertyChangeListener)
Nested Class Summary | |
---|---|
static class |
TaskListener.Adapter<T,V>
Convenience class that stubs all of the TaskListener interface methods. |
Method Summary | |
---|---|
void |
cancelled(TaskEvent<java.lang.Void> event)
Called after the Task's cancelled method
is called. |
void |
doInBackground(TaskEvent<java.lang.Void> event)
Called just before the Task's doInBackground method is called, i.e. |
void |
failed(TaskEvent<java.lang.Throwable> event)
Called after the Task's failed completion
method is called. |
void |
finished(TaskEvent<java.lang.Void> event)
Called after the Task's finished method is called. |
void |
interrupted(TaskEvent<java.lang.InterruptedException> event)
Called after the Task's interrupted method is called. |
void |
process(TaskEvent<java.util.List<V>> event)
Called each time the Task's process method is called. |
void |
succeeded(TaskEvent<T> event)
Called after the Task's succeeded
completion method is called. |
Method Detail |
---|
void doInBackground(TaskEvent<java.lang.Void> event)
doInBackground
method is called, i.e. just before the task
begins running. The event's
source is the Task and its
value is null.
event
- a TaskEvent whose source is the Task
object, value is nullSwingWorker.doInBackground()
,
EventObject.getSource()
void process(TaskEvent<java.util.List<V>> event)
process
method is called.
The value of the event is the list of values passed to the process method.
event
- a TaskEvent whose source is the Task
object and whose
value is a list of the values passed to the Task.process()
methodSwingWorker.doInBackground()
,
Task.process(java.util.List)
,
EventObject.getSource()
,
TaskEvent.getValue()
void succeeded(TaskEvent<T> event)
succeeded
completion method is called. The event's value is the value
returned by the Task's get
method, i.e. the value that
is computed by SwingWorker.doInBackground()
.
event
- a TaskEvent whose source is the Task
object, and
whose value is the value returned by Task.get()
.Task.succeeded(T)
,
EventObject.getSource()
,
TaskEvent.getValue()
void failed(TaskEvent<java.lang.Throwable> event)
failed
completion
method is called. The event's value is the Throwable passed to
Task.failed()
.
event
- a TaskEvent whose source is the Task
object, and
whose value is the Throwable passed to Task.failed()
.Task.failed(java.lang.Throwable)
,
EventObject.getSource()
,
TaskEvent.getValue()
void cancelled(TaskEvent<java.lang.Void> event)
cancelled
method
is called. The event's
source is the Task and its
value is null.
event
- a TaskEvent whose source is the Task
object, value is nullTask.cancelled()
,
SwingWorker.get()
,
EventObject.getSource()
void interrupted(TaskEvent<java.lang.InterruptedException> event)
interrupted
method is called.
The event's
source is the Task and its value is
the InterruptedException passed to Task.interrupted()
.
event
- a TaskEvent whose source is the Task
object, and
whose value is the InterruptedException passed to Task.interrupted()
.Task.interrupted(java.lang.InterruptedException)
,
EventObject.getSource()
,
TaskEvent.getValue()
void finished(TaskEvent<java.lang.Void> event)
finished
method is called.
The event's
source is the Task and its value is null.
event
- a TaskEvent whose source is the Task
object, value is null.Task.interrupted(java.lang.InterruptedException)
,
EventObject.getSource()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |