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 classConvenience class that stubs all of the TaskListener interface methods. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after the Task'scancelledmethod is called.voiddoInBackground(TaskEvent<Void> event) Called just before the Task'sdoInBackgroundmethod is called, i.e.voidCalled after the Task'sfailedcompletion method is called.voidCalled after the Task'sfinishedmethod is called.voidinterrupted(TaskEvent<InterruptedException> event) Called after the Task'sinterruptedmethod is called.voidCalled each time the Task'sprocessmethod is called.voidCalled after the Task'ssucceededcompletion method is called.
-
Method Details
-
doInBackground
Called just before the Task'sdoInBackgroundmethod is called, i.e. just before the task begins running. Theevent'ssource is the Task and its value is null.- Parameters:
event- a TaskEvent whose source is theTaskobject, value is null- See Also:
-
process
Called each time the Task'sprocessmethod is called. The value of the event is the list of values passed to the process method.- Parameters:
event- a TaskEvent whose source is theTaskobject and whose value is a list of the values passed to theTask.process()method- See Also:
-
succeeded
Called after the Task'ssucceededcompletion method is called. The event's value is the value returned by the Task'sgetmethod, i.e. the value that is computed bySwingWorker.doInBackground().- Parameters:
event- a TaskEvent whose source is theTaskobject, and whose value is the value returned byTask.get().- See Also:
-
failed
-
cancelled
-
interrupted
Called after the Task'sinterruptedmethod is called. Theevent'ssource is the Task and its value is the InterruptedException passed toTask.interrupted().- Parameters:
event- a TaskEvent whose source is theTaskobject, and whose value is the InterruptedException passed toTask.interrupted().- See Also:
-
finished
-