|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.SwingWorker<T,KreatorWorker.Status> edu.cs.ai.kreator.control.KreatorWorker<T>
T
- The return value of myDoInBackground()
public abstract class KreatorWorker<T>
A KReatorWorker represents a thread, which can be executed by our WorkerController
.
Information about its status and progress are then displayed in the GUI.
Every worker should implement this class and be passed to WorkerController for execution.
Nested Class Summary | |
---|---|
class |
KreatorWorker.Status
|
Nested classes/interfaces inherited from class javax.swing.SwingWorker |
---|
javax.swing.SwingWorker.StateValue |
Field Summary | |
---|---|
static org.apache.log4j.Logger |
LOG
|
Constructor Summary | |
---|---|
KreatorWorker(KreatorConsole console)
Creates a new worker, which should be executed by WorkerController. |
Method Summary | |
---|---|
protected T |
doInBackground()
This is called upon execution of this worker. |
protected void |
done()
This is called when execution finishes. |
void |
forceKill()
Aborts the thread immediately. |
void |
forceResume()
Resumes the thread immediately. |
void |
forceSuspend()
Suspends the thread immediately. |
KreatorConsole |
getConsole()
Returns the workers connected KreatorConsole or null if the worker is not connected to a console. |
protected KreatorWorker.Status |
getStatus()
Returns the current progress and status message. |
protected abstract T |
myDoInBackground()
This is called upon execution of this worker. |
protected void |
myDone()
This is called when execution finishes. |
protected void |
pleaseAbort()
Tells the thread of this worker to abort. |
protected void |
pleaseWait()
Tells the thread of this worker to wait until #resume() is called. |
protected void |
process(java.util.List<KreatorWorker.Status> progress)
Displays the information in the main user interface. |
void |
publish(java.lang.String msg,
int progress)
May be called by every thread, to publish some progress and status information. |
protected void |
resetShouldAbort()
After having told the worker to abort, one may use this function to revoke this plead. |
protected void |
resume()
Tells the thread to resume. |
boolean |
shouldAbort()
Returns true if the thread of this worker should stop it's execution. |
boolean |
shouldWait()
Returns true if the thread of this worker should pause. |
Methods inherited from class javax.swing.SwingWorker |
---|
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, publish, removePropertyChangeListener, run, setProgress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger LOG
Constructor Detail |
---|
public KreatorWorker(KreatorConsole console)
output
- Method Detail |
---|
protected T doInBackground() throws AbortedExecutionException
myDoInBackground()
, which has to be implemented by every KReatorWorker.
doInBackground
in class javax.swing.SwingWorker<T,KreatorWorker.Status>
AbortedExecutionException
WorkerController.registerWorker(KreatorWorker)
,
WorkerController.getMyWorker()
protected abstract T myDoInBackground() throws AbortedExecutionException
java.lang.Exception
AbortedExecutionException
protected void done()
myDone()
, which may be implemented by any KReatorWorker.
done
in class javax.swing.SwingWorker<T,KreatorWorker.Status>
protected void myDone()
public void publish(java.lang.String msg, int progress)
msg
- a status messageprogress
- the threads progress.
protected void process(java.util.List<KreatorWorker.Status> progress)
process
in class javax.swing.SwingWorker<T,KreatorWorker.Status>
public KreatorConsole getConsole()
KreatorConsole
or null if the worker is not connected to a console.
KreatorConsole
or null if the worker is not connected to a consoleprotected KreatorWorker.Status getStatus()
public boolean shouldWait()
protected void pleaseWait()
protected void resume()
public boolean shouldAbort()
protected void pleaseAbort()
protected void resetShouldAbort()
WorkerController#cancleWorkerAbortion(KreatorWorker)
public void forceKill()
public void forceSuspend()
public void forceResume()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |