net.groboclown.gui.paintpipe.v1
Class TimerThread

java.lang.Object
  |
  +--net.groboclown.gui.paintpipe.v1.PainterThread
        |
        +--net.groboclown.gui.paintpipe.v1.TimerThread

public class TimerThread
extends PainterThread

Sends FlushPaintingEvents to all registered PaintQueues. Even though it doesn't actually paint anything, it still follows the same pattern for catching PaintFinishedEvents.

This is very similar to the OutputPainter. However, this can output to multiple queues, as well as a single queue.

Version:
1.0
Author:
Matt Albrecht

Inner classes inherited from class net.groboclown.gui.paintpipe.v1.PainterThread
PainterThread.PaintRunnable
 
Field Summary
private  FlushPaintingEvent fpe
           
private  long millis
           
private  Vector queues
           
 
Fields inherited from class net.groboclown.gui.paintpipe.v1.PainterThread
frameNumber, group, isPainting, METRICS, metricsListeners, name, numberPaintAttempts, numberWaitForEvent, painter, priority, RUN_NEVER_STARTED, RUN_PAUSED, RUN_REQUESTED_PAUSE, RUN_REQUESTED_STOP, RUN_RUNNING, RUN_STOPPED, runState, sentPaintFinishedEvent, startTimeMillis, syncThis, totalPaintTimeMillis, totalWaitForEventTimeMillis
 
Constructor Summary
TimerThread(long sleepTime)
          Create the thread with no output queues, and sets the maximum frame drawing time (in milliseconds).
 
Method Summary
 void addQueueListener(PaintQueue pq)
          Registeres a queue for recieving flush events.
 long getSleepTime()
          Retrieves the maximum amount of time a frame can be drawn before a flush message is sent out, in milliseconds.
protected  void paint()
          The paint method is the heart of the system.
 void removeQueueListener(PaintQueue pq)
          Unregisteres a queue for recieving flush events.
 void setSleepTime(long time)
          Sets the maximum time a frame can be drawn before a flush message is sent out, in milliseconds.
 
Methods inherited from class net.groboclown.gui.paintpipe.v1.PainterThread
addMetricsListener, canPause, canStop, cleanup, fireMetricsPaint, fireMetricsWait, getFrameNumber, getNumberPaintCalls, getNumberWaitForEventTimes, getStartTimeMillis, getTotalPaintTimeMillis, getTotalWaitForEventTimeMillis, initialize, isAlive, isInterrupted, isRunning, isStopImpending, isStopping, isSuspended, isWaitingForEvent, join, killPainting, paintFinished, removeMetricsListener, resume, start, stop, stopInterrupt, stopInterruptJoin, stopJoin, suspend, suspendInterrupt
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

fpe

private FlushPaintingEvent fpe

queues

private Vector queues

millis

private long millis
Constructor Detail

TimerThread

public TimerThread(long sleepTime)
Create the thread with no output queues, and sets the maximum frame drawing time (in milliseconds).
Method Detail

addQueueListener

public void addQueueListener(PaintQueue pq)
Registeres a queue for recieving flush events.

removeQueueListener

public void removeQueueListener(PaintQueue pq)
Unregisteres a queue for recieving flush events.

setSleepTime

public void setSleepTime(long time)
Sets the maximum time a frame can be drawn before a flush message is sent out, in milliseconds.

getSleepTime

public long getSleepTime()
Retrieves the maximum amount of time a frame can be drawn before a flush message is sent out, in milliseconds.

paint

protected void paint()
              throws InterruptedException
The paint method is the heart of the system. The interruption and PaintFinishedEvent waiting patterns are all contained in the PainterThread class.
Overrides:
paint in class PainterThread
Following copied from class: net.groboclown.gui.paintpipe.v1.PainterThread
Throws:
InterruptedException - must be allowed to propigate without being caught. It is thrown when the thread has been interrupted during some kind of Thread.sleep(long) or Object.wait() call.


Written under the LGPL