Package uk.ac.starlink.table.gui
Class TableLoadWorker
java.lang.Object
java.lang.Thread
uk.ac.starlink.table.gui.TableLoadWorker
- All Implemented Interfaces:
Runnable
Thread which passes data from a TableLoader to a TableLoadClient.
As well as ensuring that everything happens on sensible threads,
and updating a progress bar appropriately, it provides the facility
to cancel the load in progress.
- Since:
- 13 Sept 2010
- Author:
- Mark Taylor
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionTableLoadWorker
(TableLoader loader, TableLoadClient client) Constructs a TableLoadWorker with a default progress bar.TableLoadWorker
(TableLoader loader, TableLoadClient client, JProgressBar progBar) Constructs a TableLoadWorker with a given progress bar. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels the current load.protected void
finish
(boolean cancelled) Tidies up following execution.Returns an action which will cancel the current load.Returns the table load client used by this worker.Returns the table loader used by this worker.Returns the progress bar controlled by this worker.void
run()
Performs loading until completed or cancelled.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
TableLoadWorker
Constructs a TableLoadWorker with a given progress bar.- Parameters:
loader
- table loader, supplies tablesclient
- table load client, consumes tables into a GUIprogBar
- progress bar to keep track of loading
-
TableLoadWorker
Constructs a TableLoadWorker with a default progress bar.- Parameters:
loader
- table loader, supplies tablesclient
- table load client, consumes tables into a GUI
-
-
Method Details
-
getLoader
Returns the table loader used by this worker.- Returns:
- table loader
-
getLoadClient
Returns the table load client used by this worker.- Returns:
- load client
-
getCancelAction
Returns an action which will cancel the current load.- Returns:
- cancel action
-
getProgressBar
Returns the progress bar controlled by this worker.- Returns:
- progress bar
-
run
public void run()Performs loading until completed or cancelled. -
cancel
public void cancel()Cancels the current load. It is not an error to call this multiple times. It must be called on the Event Dispatch Thread. -
finish
protected void finish(boolean cancelled) Tidies up following execution. Must be called exactly once. It must be called on the Event Dispatch Thread.- Parameters:
cancelled
- true iff cancel has been called
-