|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.groboclown.gui.paintpipe.v1.PainterThread | +--net.groboclown.gui.paintpipe.v1.OutputPainter | +--net.groboclown.gui.paintpipe.v1.PipePainter
PipePainter waits for a set of PaintEvent
s on a
PaintQueue
.
It assembles the events to create a composite image (or multiple
images) to send to another PaintQueue.
This class relies on OutputPainter
to handle the firing
of paint events. See that class to get ideas on event pooling.
The Queue references a frame number in the events to check if the event should be placed in the input queue or not. This prevents out-of-date events from being inserted into our input queue, thus probably throwing off the image creation.
OutputPainter
,
PaintQueue
Inner classes inherited from class net.groboclown.gui.paintpipe.v1.PainterThread |
PainterThread.PaintRunnable |
Field Summary | |
private PaintQueue |
inQ
|
Fields inherited from class net.groboclown.gui.paintpipe.v1.OutputPainter |
outq |
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 | |
PipePainter()
Creates a new PipePainter with a new input and output PaintQueue. |
|
PipePainter(PaintQueue in,
PaintQueue out)
Creates a new PipePainter with the given input and output PaintQueues. |
Method Summary | |
protected abstract boolean |
areMoreEvents()
Checks if any more events need to be pulled from the queue. |
protected void |
flushEvents()
If any events or images are in a good enough position to send, fire them all in this event. |
PaintQueue |
getInputQueue()
|
protected void |
paint()
The paint method is already implemented in this case. |
void |
paintFinished(PaintFinishedEvent pfe)
Update the frame number to accept. |
protected abstract void |
processEvent(PaintEvent pe)
Processes the next PaintEvent from the input queue. |
Methods inherited from class net.groboclown.gui.paintpipe.v1.OutputPainter |
firePaintEvent, getOutputQueue |
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, removeMetricsListener, resume, start, stop, stopInterrupt, stopInterruptJoin, stopJoin, suspend, suspendInterrupt |
Methods inherited from class java.lang.Object |
|
Field Detail |
private PaintQueue inQ
Constructor Detail |
public PipePainter()
public PipePainter(PaintQueue in, PaintQueue out)
in
- the input queue, listened to by this thread.out
- the output queue, in which events are fired to.Method Detail |
public PaintQueue getInputQueue()
public void paintFinished(PaintFinishedEvent pfe) throws InterruptedException
paintFinished
in class PainterThread
protected final void paint() throws InterruptedException
Instead, the
paint method calls areMoreEvents()
to check if
any more events are needed to create the output image.
The processEvent(net.groboclown.gui.paintpipe.v1.PaintEvent)
method is called to process
a new event which was read from the input queue.
If a FlushPaintingEvent
is found in the queue,
flushEvents()
is called to announce this event.
Then the flush event is sent down to the output queue,
and no more events are processed for the frame.
Due to the way the paint queue is implemented, older events from older frames are not recieved in the input.
paint
in class PainterThread
net.groboclown.gui.paintpipe.v1.PainterThread
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.protected abstract void processEvent(PaintEvent pe)
pe
- the event which is to be processed.protected abstract boolean areMoreEvents()
protected void flushEvents()
FlushPaintingEvent
here, since it is done for you in the
paint()
method above. This is called as the last method of the
frame in all circumstances, except for an InterruptedException,
which shouldn't be caught.
This method must not perform any method which can be Interrupted.
The default functionality is to do nothing. This is not made abstract, since most painters won't output half-complete images or data processing anyway.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |