Class DeferRable
- java.lang.Object
-
- org.apache.batik.ext.awt.image.renderable.DeferRable
-
- All Implemented Interfaces:
java.awt.image.renderable.RenderableImage,Filter
public class DeferRable extends java.lang.Object implements Filter
This class allows for the return of a proxy object quickly, while a heavy weight object is constrcuted in a background Thread. This proxy object will then block if any methods are called on it that require talking to the source object. This is actually a particular instance of a very general pattern this is probably best represented using the Proxy class in the Reflection APIs.- Version:
- $Id: DeferRable.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Constructor Summary
Constructors Constructor Description DeferRable()Constructor takes nothing
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.RenderedImagecreateDefaultRendering()Forward the call (blocking until source is set if need be).java.awt.image.RenderedImagecreateRendering(java.awt.image.renderable.RenderContext rc)Forward the call (blocking until source is set if need be).java.awt.image.RenderedImagecreateScaledRendering(int w, int h, java.awt.RenderingHints hints)Forward the call (blocking until source is set if need be).java.awt.geom.Rectangle2DgetBounds2D()Implement the baseclass method to call getSource() so it will block until we have a real source.java.awt.ShapegetDependencyRegion(int srcIndex, java.awt.geom.Rectangle2D outputRgn)Forward the call (blocking until source is set if need be).java.awt.ShapegetDirtyRegion(int srcIndex, java.awt.geom.Rectangle2D inputRgn)Forward the call (blocking until source is set if need be).floatgetHeight()floatgetMinX()floatgetMinY()java.lang.ObjectgetProperty(java.lang.String name)Forward the call (blocking until source is set if need be).java.lang.String[]getPropertyNames()Forward the call (blocking until source is set if need be).FiltergetSource()Key method that blocks if the src has not yet been provided.java.util.VectorgetSources()longgetTimeStamp()Returns the current modification timestamp on this Renderable node.floatgetWidth()booleanisDynamic()Forward the call (blocking until source is set if need be).voidsetBounds(java.awt.geom.Rectangle2D bounds)voidsetProperties(java.util.Map props)voidsetSource(Filter src)Key method that sets the src.
-
-
-
Field Detail
-
src
volatile Filter src
-
bounds
java.awt.geom.Rectangle2D bounds
-
props
java.util.Map props
-
-
Method Detail
-
getSource
public Filter getSource()
Key method that blocks if the src has not yet been provided.
-
setSource
public void setSource(Filter src)
Key method that sets the src. The source can only be set once (this makes sense given the intent of the class is to stand in for a real object, so swaping that object isn't a good idea. This will wake all the threads that might be waiting for the source to be set.
-
setBounds
public void setBounds(java.awt.geom.Rectangle2D bounds)
-
setProperties
public void setProperties(java.util.Map props)
-
getTimeStamp
public long getTimeStamp()
Description copied from interface:FilterReturns the current modification timestamp on this Renderable node. This value will change whenever cached output data becomes invalid.- Specified by:
getTimeStampin interfaceFilter- Returns:
- Current modification timestamp value.
-
getSources
public java.util.Vector getSources()
- Specified by:
getSourcesin interfacejava.awt.image.renderable.RenderableImage
-
isDynamic
public boolean isDynamic()
Forward the call (blocking until source is set if need be).- Specified by:
isDynamicin interfacejava.awt.image.renderable.RenderableImage
-
getBounds2D
public java.awt.geom.Rectangle2D getBounds2D()
Implement the baseclass method to call getSource() so it will block until we have a real source.- Specified by:
getBounds2Din interfaceFilter
-
getMinX
public float getMinX()
- Specified by:
getMinXin interfacejava.awt.image.renderable.RenderableImage
-
getMinY
public float getMinY()
- Specified by:
getMinYin interfacejava.awt.image.renderable.RenderableImage
-
getWidth
public float getWidth()
- Specified by:
getWidthin interfacejava.awt.image.renderable.RenderableImage
-
getHeight
public float getHeight()
- Specified by:
getHeightin interfacejava.awt.image.renderable.RenderableImage
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
Forward the call (blocking until source is set if need be).- Specified by:
getPropertyin interfacejava.awt.image.renderable.RenderableImage
-
getPropertyNames
public java.lang.String[] getPropertyNames()
Forward the call (blocking until source is set if need be).- Specified by:
getPropertyNamesin interfacejava.awt.image.renderable.RenderableImage
-
createDefaultRendering
public java.awt.image.RenderedImage createDefaultRendering()
Forward the call (blocking until source is set if need be).- Specified by:
createDefaultRenderingin interfacejava.awt.image.renderable.RenderableImage
-
createScaledRendering
public java.awt.image.RenderedImage createScaledRendering(int w, int h, java.awt.RenderingHints hints)Forward the call (blocking until source is set if need be).- Specified by:
createScaledRenderingin interfacejava.awt.image.renderable.RenderableImage
-
createRendering
public java.awt.image.RenderedImage createRendering(java.awt.image.renderable.RenderContext rc)
Forward the call (blocking until source is set if need be).- Specified by:
createRenderingin interfacejava.awt.image.renderable.RenderableImage
-
getDependencyRegion
public java.awt.Shape getDependencyRegion(int srcIndex, java.awt.geom.Rectangle2D outputRgn)Forward the call (blocking until source is set if need be).- Specified by:
getDependencyRegionin interfaceFilter- Parameters:
srcIndex- The source to do the dependency calculation for.outputRgn- The region of output you are interested in generating dependencies for. The is given in the user coordiate system for this node.- Returns:
- The region of input required. This is in the user coordinate system for the source indicated by srcIndex.
-
getDirtyRegion
public java.awt.Shape getDirtyRegion(int srcIndex, java.awt.geom.Rectangle2D inputRgn)Forward the call (blocking until source is set if need be).- Specified by:
getDirtyRegionin interfaceFilter- Parameters:
srcIndex- The input that inputRgn reflects changes in.inputRgn- the region of input that has changed, used to calculate the returned shape. This is given in the user coordinate system of the source indicated by srcIndex.- Returns:
- The region of output that would be invalid given a change to inputRgn of the source selected by srcIndex. this is in the user coordinate system of this node.
-
-