Package org.openpdf.rups.model
Class BackgroundTask
java.lang.Object
org.openpdf.rups.model.BackgroundTask
- Direct Known Subclasses:
ObjectLoader,PageLoader
Allows you to perform long lasting tasks in background. If we ever move to Java 6, we should use the SwingWorker
class (included in the JDK) instead of this custom Event Dispatching code.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInner class that holds the reference to the thread. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BackgroundTask.ThreadWrapperA wrapper for the tread that executes a time-consuming task. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voiddoTask()Implement this class; the time-consuming task will go here.voidfinished()Called on the event dispatching thread once the construct method has finished its task.voidForces the thread to stop what it's doing.voidstart()Starts the thread.
-
Field Details
-
thread
A wrapper for the tread that executes a time-consuming task.
-
-
Constructor Details
-
BackgroundTask
public BackgroundTask()Starts a thread. Executes the time-consuming task in the construct method; finally calls the finish().
-
-
Method Details
-
doTask
public abstract void doTask()Implement this class; the time-consuming task will go here. -
start
public void start()Starts the thread. -
interrupt
public void interrupt()Forces the thread to stop what it's doing. -
finished
public void finished()Called on the event dispatching thread once the construct method has finished its task.
-