workerThreads
Class ChartCreationThread

java.lang.Object
  extended by javax.swing.SwingWorker
      extended by workerThreads.ChartCreationThread
All Implemented Interfaces:
java.lang.Runnable, java.util.concurrent.Future, java.util.concurrent.RunnableFuture

public class ChartCreationThread
extends javax.swing.SwingWorker

A thread that runs in the background to create a new chart. This takes away this potentially long-running task from the EDT.
At the same time a ProgressMonitor is used to show progress, if required.


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.SwingWorker
javax.swing.SwingWorker.StateValue
 
Field Summary
private  Main mainWindow
          The main window.
(package private) static boolean printLog
          Flag to enable debug message printing for this class.
private  javax.swing.ProgressMonitor progressMonitor
          The progress monitor.
 
Constructor Summary
ChartCreationThread(Main mainWindow, javax.swing.ProgressMonitor progressMonitor)
          Instantiates a new chart creation thread.
 
Method Summary
 java.lang.Object doInBackground()
           
protected  void done()
           
private  void log(java.lang.String message)
          Prints debug information to stdout when printLog is set to true.
 
Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printLog

static final boolean printLog
Flag to enable debug message printing for this class.

See Also:
Constant Field Values

mainWindow

private Main mainWindow
The main window.


progressMonitor

private javax.swing.ProgressMonitor progressMonitor
The progress monitor.

Constructor Detail

ChartCreationThread

public ChartCreationThread(Main mainWindow,
                           javax.swing.ProgressMonitor progressMonitor)
Instantiates a new chart creation thread.

Parameters:
mainWindow - The main window
progressMonitor - The progress monitor
Method Detail

doInBackground

public java.lang.Object doInBackground()
Specified by:
doInBackground in class javax.swing.SwingWorker

done

protected void done()
Overrides:
done in class javax.swing.SwingWorker

log

private void log(java.lang.String message)
Prints debug information to stdout when printLog is set to true.

Parameters:
message - the message