org.apache.batik.gvt
Class AbstractGraphicsNode

java.lang.Object
  |
  +--org.apache.batik.gvt.AbstractGraphicsNode
All Implemented Interfaces:
GraphicsNode
Direct Known Subclasses:
CompositeGraphicsNode, ProxyGraphicsNode, RasterImageNode, ShapeNode, TextNode

public abstract class AbstractGraphicsNode
extends java.lang.Object
implements GraphicsNode

A partial implementation of the GraphicsNode interface.


Field Summary
protected  ClipRable clip
          The clipping filter for this graphics node.
protected  java.awt.Composite composite
          The compositing operation to be used when a graphics node is painted on top of another one.
protected  Filter filter
          The filter of this graphics node.
protected  java.lang.ref.WeakReference graphicsNodeRable
          .The GraphicsNodeRable for this node.
protected  java.awt.RenderingHints hints
          The rendering hints that control the quality to use when rendering this graphics node.
protected  GraphicsNodeHitDetector hitDetector
          The hit detector used to filter mouse events.
protected  java.awt.geom.AffineTransform inverseTransform
          The inverse transform for this node, i.e., from parent node to this node.
protected  boolean isVisible
          This flag bit indicates whether or not this graphics node is visible.
protected  javax.swing.event.EventListenerList listeners
          The listeners list.
protected  Mask mask
          The mask of this graphics node.
protected  CompositeGraphicsNode parent
          The parent of this graphics node.
protected  RootGraphicsNode root
          The root of the GVT tree.
protected  java.awt.geom.AffineTransform transform
          The transform of this graphics node.
 
Fields inherited from interface org.apache.batik.gvt.GraphicsNode
IDENTITY
 
Constructor Summary
protected AbstractGraphicsNode()
          Constructs a new graphics node.
 
Method Summary
protected  boolean acceptEvent(GraphicsNodeEvent evt)
          Returns true is this node accepts the specified event, false otherwise.
 void addGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
          Adds the specified graphics node key listener to receive graphics node key events from this node.
 void addGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
          Adds the specified graphics node mouse listener to receive graphics node mouse events from this node.
 boolean contains(java.awt.geom.Point2D p)
          Returns true if the specified Point2D is inside the boundary of this node, false otherwise.
 void dispatchEvent(GraphicsNodeEvent evt)
          Dispatches the specified event to the interested registered listeners.
 java.awt.geom.Rectangle2D getBounds()
          Returns the bounds of this node in user space.
 ClipRable getClip()
          Returns the clipping filter of this node or null if any.
 java.awt.Composite getComposite()
          Returns the composite of this node or null if any.
 Filter getFilter()
          Returns the filter of this node or null if any.
 java.awt.geom.AffineTransform getGlobalTransform()
          Returns the concatenated transform of this node. i.e., this node's transform preconcatenated with it's parent's transforms.
 GraphicsNodeHitDetector getGraphicsNodeHitDetector()
          Returns the hit detector for this node.
 GraphicsNodeRable getGraphicsNodeRable()
          Returns the GraphicsNodeRable for this node.
 java.awt.geom.AffineTransform getInverseTransform()
          Returns the inverse transform for this node.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Returns an array of listeners that were added to this node and of the specified type.
 Mask getMask()
          Returns the mask of this node or null if any.
 CompositeGraphicsNode getParent()
          Returns the parent of this node or null if any.
 java.awt.RenderingHints getRenderingHints()
          Returns the rendering hints of this node or null if any.
 RootGraphicsNode getRoot()
          Returns the root of the GVT tree or null if the node is not part of a GVT tree.
 java.awt.geom.AffineTransform getTransform()
          Returns the transform of this node or null if any.
 java.awt.geom.Rectangle2D getTransformedBounds(java.awt.geom.AffineTransform txf)
          Returns the bounds of this node after applying the input transform (if any), concatenated with this node's transform (if any).
 java.awt.geom.Rectangle2D getTransformedGeometryBounds(java.awt.geom.AffineTransform txf)
          Returns the bounds of the area covered by this node, without taking any of its rendering attribute into account. i.e., exclusive of any clipping, masking, filtering or stroking, for example.
 java.awt.Shape getTransformedOutline()
          Returns the transformed outline of this node.
 java.awt.geom.Rectangle2D getTransformedPrimitiveBounds(java.awt.geom.AffineTransform txf)
          Returns the bounds of this node's primitivePaint after applying the input transform (if any), concatenated with this node's transform (if any).
 boolean intersects(java.awt.geom.Rectangle2D r)
          Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.
protected  void invalidateGeometryCache()
          Invalidates the cached geometric bounds.
protected  boolean isAntialiasedClip(java.awt.geom.AffineTransform usr2dev, java.awt.RenderingHints hints, java.awt.Shape clip)
          Returns true if there is a clip and it should be antialiased
protected  boolean isOffscreenBufferNeeded()
          Returns true of an offscreen buffer is needed to render this node, false otherwise.
 boolean isVisible()
          Returns true if this node is visible, false otherwise.
 GraphicsNode nodeHitAt(java.awt.geom.Point2D p)
          Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.
 void paint(java.awt.Graphics2D g2d)
          Paints this node.
 void processKeyEvent(GraphicsNodeKeyEvent evt)
          Dispatches a graphics node key event to this node or one of its child.
 void processMouseEvent(GraphicsNodeMouseEvent evt)
          Dispatches a graphics node mouse event to this node or one of its child.
 void removeGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
          Removes the specified graphics node key listener so that it no longer receives graphics node key events from this node.
 void removeGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
          Removes the specified graphics node mouse listener so that it no longer receives graphics node mouse events from this node.
 void setClip(ClipRable newClipper)
          Sets the clipping filter of this node.
 void setComposite(java.awt.Composite newComposite)
          Sets the composite of this node.
 void setFilter(Filter newFilter)
          Sets the filter of this node.
 void setGraphicsNodeHitDetector(GraphicsNodeHitDetector hitDetector)
          Sets the hit detector for this node.
 void setMask(Mask newMask)
          Sets the mask of this node.
protected  void setParent(CompositeGraphicsNode newParent)
          Sets the parent node of this graphics node.
 void setRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object value)
          Maps the specified key to the specified value in the rendering hints of this node.
 void setRenderingHints(java.util.Map hints)
          Copies all of the mappings from the specified Map to the rendering hints of this node.
 void setRenderingHints(java.awt.RenderingHints newHints)
          Sets the rendering hints of this node.
protected  void setRoot(RootGraphicsNode newRoot)
          Sets the root node of this graphics node.
 void setTransform(java.awt.geom.AffineTransform newTransform)
          Sets the transform of this node.
 void setVisible(boolean isVisible)
          Sets if this node is visible or not depending on the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.batik.gvt.GraphicsNode
getGeometryBounds, getOutline, getPrimitiveBounds, primitivePaint
 

Field Detail

listeners

protected javax.swing.event.EventListenerList listeners
The listeners list.

hitDetector

protected GraphicsNodeHitDetector hitDetector
The hit detector used to filter mouse events.

transform

protected java.awt.geom.AffineTransform transform
The transform of this graphics node.

inverseTransform

protected java.awt.geom.AffineTransform inverseTransform
The inverse transform for this node, i.e., from parent node to this node.

composite

protected java.awt.Composite composite
The compositing operation to be used when a graphics node is painted on top of another one.

isVisible

protected boolean isVisible
This flag bit indicates whether or not this graphics node is visible.

clip

protected ClipRable clip
The clipping filter for this graphics node.

hints

protected java.awt.RenderingHints hints
The rendering hints that control the quality to use when rendering this graphics node.

parent

protected CompositeGraphicsNode parent
The parent of this graphics node.

root

protected RootGraphicsNode root
The root of the GVT tree.

mask

protected Mask mask
The mask of this graphics node.

filter

protected Filter filter
The filter of this graphics node.

graphicsNodeRable

protected java.lang.ref.WeakReference graphicsNodeRable
.The GraphicsNodeRable for this node.
Constructor Detail

AbstractGraphicsNode

protected AbstractGraphicsNode()
Constructs a new graphics node.
Method Detail

setTransform

public void setTransform(java.awt.geom.AffineTransform newTransform)
Sets the transform of this node.
Specified by:
setTransform in interface GraphicsNode
Parameters:
newTransform - the new transform of this node

getTransform

public java.awt.geom.AffineTransform getTransform()
Returns the transform of this node or null if any.
Specified by:
getTransform in interface GraphicsNode

getInverseTransform

public java.awt.geom.AffineTransform getInverseTransform()
Returns the inverse transform for this node.
Specified by:
getInverseTransform in interface GraphicsNode

getGlobalTransform

public java.awt.geom.AffineTransform getGlobalTransform()
Returns the concatenated transform of this node. i.e., this node's transform preconcatenated with it's parent's transforms.
Specified by:
getGlobalTransform in interface GraphicsNode

setComposite

public void setComposite(java.awt.Composite newComposite)
Sets the composite of this node.
Specified by:
setComposite in interface GraphicsNode
Parameters:
composite - the composite of this node

getComposite

public java.awt.Composite getComposite()
Returns the composite of this node or null if any.
Specified by:
getComposite in interface GraphicsNode

setVisible

public void setVisible(boolean isVisible)
Sets if this node is visible or not depending on the specified value.
Specified by:
setVisible in interface GraphicsNode
Parameters:
isVisible - If true this node is visible

isVisible

public boolean isVisible()
Returns true if this node is visible, false otherwise.
Specified by:
isVisible in interface GraphicsNode

setClip

public void setClip(ClipRable newClipper)
Description copied from interface: GraphicsNode
Sets the clipping filter of this node.
Specified by:
setClip in interface GraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Parameters:
newClipper - the new clipping filter of this node

getClip

public ClipRable getClip()
Returns the clipping filter of this node or null if any.
Specified by:
getClip in interface GraphicsNode

setRenderingHint

public void setRenderingHint(java.awt.RenderingHints.Key key,
                             java.lang.Object value)
Maps the specified key to the specified value in the rendering hints of this node.
Specified by:
setRenderingHint in interface GraphicsNode
Parameters:
key - the key of the hint to be set
value - the value indicating preferences for the specified hint category.

setRenderingHints

public void setRenderingHints(java.util.Map hints)
Copies all of the mappings from the specified Map to the rendering hints of this node.
Specified by:
setRenderingHints in interface GraphicsNode
Parameters:
hints - the rendering hints to be set

setRenderingHints

public void setRenderingHints(java.awt.RenderingHints newHints)
Sets the rendering hints of this node.
Specified by:
setRenderingHints in interface GraphicsNode
Parameters:
newHints - the new rendering hints of this node

getRenderingHints

public java.awt.RenderingHints getRenderingHints()
Returns the rendering hints of this node or null if any.
Specified by:
getRenderingHints in interface GraphicsNode

setMask

public void setMask(Mask newMask)
Sets the mask of this node.
Specified by:
setMask in interface GraphicsNode
Parameters:
newMask - the new mask of this node

getMask

public Mask getMask()
Returns the mask of this node or null if any.
Specified by:
getMask in interface GraphicsNode

setFilter

public void setFilter(Filter newFilter)
Sets the filter of this node.
Specified by:
setFilter in interface GraphicsNode
Parameters:
newFilter - the new filter of this node

getFilter

public Filter getFilter()
Returns the filter of this node or null if any.
Specified by:
getFilter in interface GraphicsNode

getGraphicsNodeRable

public GraphicsNodeRable getGraphicsNodeRable()
Returns the GraphicsNodeRable for this node. The GraphicsNodeRable is the Renderable (Filter) before any of the filter operations have been applied.
Specified by:
getGraphicsNodeRable in interface GraphicsNode

paint

public void paint(java.awt.Graphics2D g2d)
Paints this node.
Specified by:
paint in interface GraphicsNode
Parameters:
g2d - the Graphics2D to use

isOffscreenBufferNeeded

protected boolean isOffscreenBufferNeeded()
Returns true of an offscreen buffer is needed to render this node, false otherwise.

isAntialiasedClip

protected boolean isAntialiasedClip(java.awt.geom.AffineTransform usr2dev,
                                    java.awt.RenderingHints hints,
                                    java.awt.Shape clip)
Returns true if there is a clip and it should be antialiased

dispatchEvent

public void dispatchEvent(GraphicsNodeEvent evt)
Dispatches the specified event to the interested registered listeners.
Specified by:
dispatchEvent in interface GraphicsNode
Parameters:
evt - the event to dispatch

addGraphicsNodeMouseListener

public void addGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Adds the specified graphics node mouse listener to receive graphics node mouse events from this node.
Specified by:
addGraphicsNodeMouseListener in interface GraphicsNode
Parameters:
l - the graphics node mouse listener to add

removeGraphicsNodeMouseListener

public void removeGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Removes the specified graphics node mouse listener so that it no longer receives graphics node mouse events from this node.
Specified by:
removeGraphicsNodeMouseListener in interface GraphicsNode
Parameters:
l - the graphics node mouse listener to remove

addGraphicsNodeKeyListener

public void addGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Adds the specified graphics node key listener to receive graphics node key events from this node.
Specified by:
addGraphicsNodeKeyListener in interface GraphicsNode
Parameters:
l - the graphics node key listener to add

removeGraphicsNodeKeyListener

public void removeGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Removes the specified graphics node key listener so that it no longer receives graphics node key events from this node.
Specified by:
removeGraphicsNodeKeyListener in interface GraphicsNode
Parameters:
l - the graphics node key listener to remove

setGraphicsNodeHitDetector

public void setGraphicsNodeHitDetector(GraphicsNodeHitDetector hitDetector)
Sets the hit detector for this node.
Specified by:
setGraphicsNodeHitDetector in interface GraphicsNode
Parameters:
hitDetector - the new hit detector

getGraphicsNodeHitDetector

public GraphicsNodeHitDetector getGraphicsNodeHitDetector()
Returns the hit detector for this node.
Specified by:
getGraphicsNodeHitDetector in interface GraphicsNode

processMouseEvent

public void processMouseEvent(GraphicsNodeMouseEvent evt)
Dispatches a graphics node mouse event to this node or one of its child.
Specified by:
processMouseEvent in interface GraphicsNode
Parameters:
evt - the evt to dispatch

processKeyEvent

public void processKeyEvent(GraphicsNodeKeyEvent evt)
Dispatches a graphics node key event to this node or one of its child.
Specified by:
processKeyEvent in interface GraphicsNode
Parameters:
evt - the evt to dispatch

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of listeners that were added to this node and of the specified type.
Specified by:
getListeners in interface GraphicsNode
Parameters:
listenerType - the type of the listeners to return

acceptEvent

protected boolean acceptEvent(GraphicsNodeEvent evt)
Returns true is this node accepts the specified event, false otherwise.
Parameters:
evt - the event to check
Returns:
always true at this time

getParent

public CompositeGraphicsNode getParent()
Returns the parent of this node or null if any.
Specified by:
getParent in interface GraphicsNode

getRoot

public RootGraphicsNode getRoot()
Returns the root of the GVT tree or null if the node is not part of a GVT tree.
Specified by:
getRoot in interface GraphicsNode

setRoot

protected void setRoot(RootGraphicsNode newRoot)
Sets the root node of this graphics node.
Parameters:
newRoot - the new root node of this node

setParent

protected void setParent(CompositeGraphicsNode newParent)
Sets the parent node of this graphics node.
Parameters:
newParent - the new parent node of this node

invalidateGeometryCache

protected void invalidateGeometryCache()
Invalidates the cached geometric bounds. This method is called each time an attribute that affects the bounds of this node changed.

getBounds

public java.awt.geom.Rectangle2D getBounds()
Returns the bounds of this node in user space. This includes primitive paint, filtering, clipping and masking.
Specified by:
getBounds in interface GraphicsNode

getTransformedBounds

public java.awt.geom.Rectangle2D getTransformedBounds(java.awt.geom.AffineTransform txf)
Returns the bounds of this node after applying the input transform (if any), concatenated with this node's transform (if any).
Specified by:
getTransformedBounds in interface GraphicsNode
Parameters:
txf - the affine transform with which this node's transform should be concatenated. Should not be null.

getTransformedPrimitiveBounds

public java.awt.geom.Rectangle2D getTransformedPrimitiveBounds(java.awt.geom.AffineTransform txf)
Returns the bounds of this node's primitivePaint after applying the input transform (if any), concatenated with this node's transform (if any).
Specified by:
getTransformedPrimitiveBounds in interface GraphicsNode
Parameters:
txf - the affine transform with which this node's transform should be concatenated. Should not be null.

getTransformedGeometryBounds

public java.awt.geom.Rectangle2D getTransformedGeometryBounds(java.awt.geom.AffineTransform txf)
Returns the bounds of the area covered by this node, without taking any of its rendering attribute into account. i.e., exclusive of any clipping, masking, filtering or stroking, for example.
Specified by:
getTransformedGeometryBounds in interface GraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Parameters:
txf - the affine transform with which this node's transform should be concatenated. Should not be null.

contains

public boolean contains(java.awt.geom.Point2D p)
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.
Specified by:
contains in interface GraphicsNode
Parameters:
p - the specified Point2D in the user space

intersects

public boolean intersects(java.awt.geom.Rectangle2D r)
Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.
Specified by:
intersects in interface GraphicsNode
Parameters:
r - the specified Rectangle2D in the user node space

getTransformedOutline

public java.awt.Shape getTransformedOutline()
Returns the transformed outline of this node.
Specified by:
getTransformedOutline in interface GraphicsNode

nodeHitAt

public GraphicsNode nodeHitAt(java.awt.geom.Point2D p)
Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.
Specified by:
nodeHitAt in interface GraphicsNode
Parameters:
p - the specified Point2D in the user space


Copyright © 2001 Apache Software Foundation. All Rights Reserved.