java.lang.Object
java.lang.Thread
eu.steffo.cleaver.logic.job.Job
- All Implemented Interfaces:
Runnable
public abstract class Job extends Thread
A task that can be executed by Cleaver in a separate
Thread
, and that keeps track of its progress and can display progress updates on a Swing GUI.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields Modifier and Type Field Description private Runnable
onProgressChange
ARunnable
that will be invoked on the GUIThread
(withSwingUtilities.invokeLater(Runnable)
) every timesetProgress(Progress)
is called.private Progress
progress
The currentProgress
of the job. -
Constructor Summary
Constructors Constructor Description Job()
Construct a Job and set its progress toNot started
.Job(Runnable onProgressChange)
Construct a Job, set its progress toNot started
and set theRunnable
that will be called on the GUIThread
every time the progress changes. -
Method Summary
Modifier and Type Method Description abstract String
getFileString()
abstract String
getOperationsString()
Progress
getProgress()
String
getProgressString()
abstract String
getTypeString()
abstract void
run()
protected void
setProgress(Progress progress)
Set the progress of the job to a different value.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield
-
Field Details
-
progress
The currentProgress
of the job.- See Also:
NotStartedProgress
,WorkingProgress
,FinishedProgress
,ErrorProgress
-
onProgressChange
ARunnable
that will be invoked on the GUIThread
(withSwingUtilities.invokeLater(Runnable)
) every timesetProgress(Progress)
is called.
-
-
Constructor Details
-
Job
public Job()Construct a Job and set its progress toNot started
. -
Job
Construct a Job, set its progress toNot started
and set theRunnable
that will be called on the GUIThread
every time the progress changes.- Parameters:
onProgressChange
- ARunnable
that will be invoked on the GUIThread
(withSwingUtilities.invokeLater(Runnable)
) every timesetProgress(Progress)
is called.
-
-
Method Details
-
getProgress
- Returns:
- The current
Progress
of the job. - See Also:
NotStartedProgress
,WorkingProgress
,FinishedProgress
,ErrorProgress
-
setProgress
Set the progress of the job to a different value. IfonProgressChange
is set, schedule its invocation after the set, allowing for example the updating of aTableModel
after the progress change.- Parameters:
progress
- The valueprogress
should be set to.
-
getTypeString
- Returns:
- The
String
that should be displayed in the Type column of theJobs Table
.
-
getFileString
- Returns:
- The
String
that should be displayed in the File column of theJobs Table
.
-
getOperationsString
- Returns:
- The
String
that should be displayed in the Operations column of theJobs Table
.
-
getProgressString
- Returns:
- The
String
that should be displayed in the Progress column of theJobs Table
.
-
run
public abstract void run()
-