Package org.jdesktop.application
Interface TaskListener<T,V>
- All Known Implementing Classes:
TaskListener.Adapter
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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Convenience class that stubs all of the TaskListener interface methods. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called after the Task'scancelled
method is called.void
doInBackground
(TaskEvent<Void> event) Called just before the Task'sdoInBackground
method is called, i.e.void
Called after the Task'sfailed
completion method is called.void
Called after the Task'sfinished
method is called.void
interrupted
(TaskEvent<InterruptedException> event) Called after the Task'sinterrupted
method is called.void
Called each time the Task'sprocess
method is called.void
Called after the Task'ssucceeded
completion method is called.
-
Method Details
-
doInBackground
Called just before the Task'sdoInBackground
method is called, i.e. just before the task begins running. Theevent's
source is the Task and its value is null.- Parameters:
event
- a TaskEvent whose source is theTask
object, value is null- See Also:
-
process
Called each time the Task'sprocess
method is called. The value of the event is the list of values passed to the process method.- Parameters:
event
- a TaskEvent whose source is theTask
object and whose value is a list of the values passed to theTask.process()
method- See Also:
-
succeeded
Called after the Task'ssucceeded
completion method is called. The event's value is the value returned by the Task'sget
method, i.e. the value that is computed bySwingWorker.doInBackground()
.- Parameters:
event
- a TaskEvent whose source is theTask
object, and whose value is the value returned byTask.get()
.- See Also:
-
failed
Called after the Task'sfailed
completion method is called. The event's value is the Throwable passed toTask.failed()
.- Parameters:
event
- a TaskEvent whose source is theTask
object, and whose value is the Throwable passed toTask.failed()
.- See Also:
-
cancelled
Called after the Task'scancelled
method is called. Theevent's
source is the Task and its value is null.- Parameters:
event
- a TaskEvent whose source is theTask
object, value is null- See Also:
-
interrupted
Called after the Task'sinterrupted
method is called. Theevent's
source is the Task and its value is the InterruptedException passed toTask.interrupted()
.- Parameters:
event
- a TaskEvent whose source is theTask
object, and whose value is the InterruptedException passed toTask.interrupted()
.- See Also:
-
finished
Called after the Task'sfinished
method is called. Theevent's
source is the Task and its value is null.- Parameters:
event
- a TaskEvent whose source is theTask
object, value is null.- See Also:
-