net.groboclown.gui.timeBoundPaint.v1
Class TimeBoundPainter

java.lang.Object
  |
  +--net.groboclown.gui.timeBoundPaint.v1.TimeBoundPainter

public class TimeBoundPainter
extends Object

This class paints an image from a queue of images. Each pass has a maximum number of items in the queue. If the maximum number of items has not been posted to the queue and drawn to the outer image by the time specified, then the image rendering is canceled.

When the painting is completed, an event is fired telling everyone that the next frame is ready to be painted.


Field Summary
private  int height
           
private  Image img
           
private  Graphics imgG
           
private  Vector listeners
           
private  LoopThread lt
           
private  long maxTimePainting
           
private  int numQueueThreads
           
private  PaintFinishedEvent pfe
           
private  SynchQueue q
           
private static Color transparent
           
private  int width
           
private  PaintImageEvent[] zorder
           
 
Constructor Summary
TimeBoundPainter(Image img)
           
TimeBoundPainter(Image img, SynchQueue q)
           
 
Method Summary
 void addPaintFinishedListener(PaintFinishedListener pfl)
           
protected  void clearImage()
           
protected  void fireFinishedPainting()
           
 long getMaxTimePainting()
           
 int getQueueThreadCount()
           
 void pausePainter()
           
 void removePaintFinishedListener(PaintFinishedListener pfl)
           
 void resumePainter()
           
 void setMaxTimePainting(long millis)
          Sets the maximum amount of wait time allowed for letting each thread post its images.
 void setQueueThreadCount(int queueThreadCount)
          Sets the number of threads that post image data on the Queue.
 void startPainter()
          Start the painting thread
 void stopPainter()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

img

private Image img

imgG

private Graphics imgG

q

private SynchQueue q

listeners

private Vector listeners

numQueueThreads

private int numQueueThreads

maxTimePainting

private long maxTimePainting

pfe

private PaintFinishedEvent pfe

zorder

private PaintImageEvent[] zorder

width

private int width

height

private int height

lt

private LoopThread lt

transparent

private static final Color transparent
Constructor Detail

TimeBoundPainter

public TimeBoundPainter(Image img)

TimeBoundPainter

public TimeBoundPainter(Image img,
                        SynchQueue q)
Method Detail

addPaintFinishedListener

public void addPaintFinishedListener(PaintFinishedListener pfl)

removePaintFinishedListener

public void removePaintFinishedListener(PaintFinishedListener pfl)

setQueueThreadCount

public void setQueueThreadCount(int queueThreadCount)
Sets the number of threads that post image data on the Queue.

getQueueThreadCount

public int getQueueThreadCount()

setMaxTimePainting

public void setMaxTimePainting(long millis)
Sets the maximum amount of wait time allowed for letting each thread post its images. Setting this value to 0 or under means that there is no maximum wait time.

getMaxTimePainting

public long getMaxTimePainting()

startPainter

public void startPainter()
Start the painting thread

pausePainter

public void pausePainter()

resumePainter

public void resumePainter()

stopPainter

public void stopPainter()

clearImage

protected void clearImage()

fireFinishedPainting

protected void fireFinishedPainting()


Written under the LGPL