Package com.luciad.view.gxy.asynchronous
Interface ILcdGXYAsynchronousPaintQueue
- All Known Implementing Classes:
TLcdGXYAsynchronousMultiPaintQueue
,TLcdGXYAsynchronousPaintQueue
,TLcdGXYLspAsynchronousPaintQueue
public interface ILcdGXYAsynchronousPaintQueue
This interface defines a queue for layer paint requests, executing them
asynchronously if necessary. A request is honored or queued whenever the
paint(java.awt.Graphics, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerWrapper, int, com.luciad.view.gxy.ILcdGXYView)
method is called.
Unless stated otherwise, all methods should be called in the Event Dispatch Thread (AWT thread, Swing thread).
- Since:
- 7.2
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers anILcdGXYAsynchronousPaintListener
to be informed of asynchronous painting events.getGXYAsynchronousView
(ILcdGXYAsynchronousLayerWrapper aWrapper, int aMode, ILcdGXYView aGXYView) Returns the view on which the asynchronous paint requests are actually executed.void
invokeAndWait
(Runnable aRunnable) Executes the givenRunnable
synchronously, but without interfering with the paint thread.void
invokeLater
(Runnable aRunnable) Executes the givenRunnable
in the paint thread and returns immediately.void
invokeLaterInEDT
(Runnable aRunnable) Executes the givenRunnable
in the event dispatch thread and returns immediately.boolean
isEmpty()
Returns true if the paint queue is not painting and it has no paint requests to finish.void
paint
(Graphics aGraphics, ILcdGXYAsynchronousLayerWrapper aWrapper, int aMode, ILcdGXYView aGXYView) Paints an image of the painted layers using the given graphics.void
Stops informing the givenILcdGXYAsynchronousPaintListener
of asynchronous painting events.void
reset()
Clears all cached images and paint requests.
-
Method Details
-
paint
void paint(Graphics aGraphics, ILcdGXYAsynchronousLayerWrapper aWrapper, int aMode, ILcdGXYView aGXYView) Paints an image of the painted layers using the given graphics. If a valid image is not available for the mode, this operation queues an asynchronous paint request, in order to create one. The parent view will then be asked to repaint itself when the asynchronous painting is completed.Note that the paint queue is free to decide if it will execute the paint synchronously or asynchronously (e.g. when confronted with unsupported views).
- Parameters:
aGraphics
- the graphics to use for paintingaWrapper
- the asynchronous layer wrapper that should be paintedaMode
- the mode indicating what should be painted, seeILcdGXYLayer.paint(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYView)
.aGXYView
- the view for which the layer should be painted.
-
getGXYAsynchronousView
ILcdGXYView getGXYAsynchronousView(ILcdGXYAsynchronousLayerWrapper aWrapper, int aMode, ILcdGXYView aGXYView) Returns the view on which the asynchronous paint requests are actually executed. In the painting thread, the asynchronous view replaces the given view when painting the given asynchronous layer with the given painting mode. Its images are then used as image buffers that can be composited in the actual view.- Parameters:
aWrapper
- the asynchronous layer wrapper that would be paintedaMode
- the mode indicating what should be painted, seeILcdGXYLayer.paint(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYView)
.aGXYView
- the original view for which asynchronous paints are meant to be displayed. Paints for unsupported views are executed synchronously.- Returns:
- the view that is used for asynchronous painting
-
reset
Clears all cached images and paint requests. Waits for asynchronous painting to finish.- Throws:
InterruptedException
- when the thread is interrupted while waiting for the asynchronous paint to complete
-
isEmpty
boolean isEmpty()Returns true if the paint queue is not painting and it has no paint requests to finish. When called on the event dispatch thread, it should guarantee that no painting occurs while the caller holds the thread.- Returns:
- true when no painting will occur while the caller holds the thread
-
invokeLater
Executes the givenRunnable
in the paint thread and returns immediately.- Parameters:
aRunnable
- theRunnable
to execute. Therun
method should take care when waiting for another thread: if that thread in turn waits for asynchronous painting to complete, a deadlock will occur.
-
invokeLaterInEDT
Executes the givenRunnable
in the event dispatch thread and returns immediately.- Parameters:
aRunnable
- theRunnable
to execute.
-
invokeAndWait
Executes the givenRunnable
synchronously, but without interfering with the paint thread. This call blocks until all asynchronous paints and runnables have been processed, and theRunnable
returns. The invocation is executed in the view's paint thread (typically the EDT).- Parameters:
aRunnable
- theRunnable
to execute. Therun
method should take care when waiting for another thread: if that thread in turn waits for asynchronous painting to complete, a deadlock will occur.- Throws:
InterruptedException
- when the thread is interrupted while waiting for the execution to complete
-
addGXYAsynchronousPaintListener
Registers anILcdGXYAsynchronousPaintListener
to be informed of asynchronous painting events. These events will be thrown in the asynchronous painting thread.- Parameters:
aListener
- the listener that should be notified
-
removeGXYAsynchronousPaintListener
Stops informing the givenILcdGXYAsynchronousPaintListener
of asynchronous painting events.- Parameters:
aListener
- the listener that should no longer be notified.
-