org.apache.batik.gvt
Interface GraphicsNode

All Known Subinterfaces:
CanvasGraphicsNode, CompositeGraphicsNode, ImageNode, LeafGraphicsNode, ProxyGraphicsNode, RasterImageNode, RootGraphicsNode, ShapeNode, TextNode
All Known Implementing Classes:
AbstractGraphicsNode

public interface GraphicsNode

The base class for all graphics nodes. A GraphicsNode encapsulates graphical attributes and can perform atomic operations of a complex rendering.


Field Summary
static java.awt.RenderingHints.Key KEY_AREA_OF_INTEREST
          Key for the AOI hint.
 
Method Summary
 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.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds the specified property change listener to receive property change events from this node.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener l)
          Adds the specified property change listener to receive property change events for the specified property name of this node.
 boolean contains(java.awt.geom.Point2D p)
          Tests if the specified Point2D is inside the boundary of this node.
 void dispatch(GraphicsNodeEvent evt)
          Dispatches a graphics node event to this node or one of its child.
 java.awt.geom.Rectangle2D getBounds()
          Returns the bounds of this node in user space.
 Clip getClip()
          Returns the clipping filter of this node or null if any.
 java.awt.Composite getComposite()
          Returns the composite of this node.
 java.awt.Cursor getCursor()
          Returns the cursor of this node.
 Filter getFilter()
          Returns the filter of this node or null if any.
 java.awt.geom.Rectangle2D getGeometryBounds()
          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.geom.AffineTransform getGlobalTransform()
          Returns the concatenated transform, i.e., this node's transform preconcatenated with it's parent's transforms.
 GraphicsNodeEventFilter getGraphicsNodeEventFilter()
          Returns the graphics node event filter of this node.
 GraphicsNodeHitDetector getGraphicsNodeHitDetector()
          Returns the hit detector 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.
 java.lang.Object getMemento(java.lang.Object key)
          Returns the value of the memento with the specified key or null if any.
 java.awt.Shape getOutline()
          Returns the outline of this node.
 CompositeGraphicsNode getParent()
          Returns the parent of this node or null if any.
 java.awt.geom.Rectangle2D getPrimitiveBounds()
          Returns the bounds of the area covered by this node's primitive paint.
 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.
 boolean hasProgressivePaint()
          Returns true if this node needs a progressive paint, false otherwise.
 boolean intersects(java.awt.geom.Rectangle2D r)
          Tests if the interior of this node intersects the interior of a specified Rectangle2D.
 boolean isVisible()
          Determines whether or not this node is visible when its parent is visible.
 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, GraphicsNodeRenderContext rc)
          Paints this node.
 void primitivePaint(java.awt.Graphics2D g2d, GraphicsNodeRenderContext rc)
          Paints this node without applying Filter, Mask, Composite and clip.
 void processKeyEvent(GraphicsNodeKeyEvent evt)
          Dispatches a graphics node event to this node or one of its child.
 void processMouseEvent(GraphicsNodeMouseEvent evt)
          Dispatches a graphics node event to this node or one of its child.
 void progressivePaint(java.awt.Graphics2D g2d, GraphicsNodeRenderContext rc)
          Paints one step of this node rendering operations.
 void putMemento(java.lang.Object key, java.lang.Object mememto)
          Associates the specified memento with the specified key in this node.
 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 removeMemento(java.lang.Object key)
          Removes the memento object with the specified key.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes the specified property change listener so that it no longer receives property change events from this node.
 void setClip(Clip newClipper)
          Sets the clipping filter for this node.
 void setComposite(java.awt.Composite newComposite)
          Sets the composite of this node.
 void setCursor(java.awt.Cursor newCursor)
          Sets the cursor of this node.
 void setFilter(Filter newFilter)
          Sets the filter of this node.
 void setGraphicsNodeEventFilter(GraphicsNodeEventFilter evtFilter)
          Sets the graphics node event 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.
 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.
 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.
 

Field Detail

KEY_AREA_OF_INTEREST

public static final java.awt.RenderingHints.Key KEY_AREA_OF_INTEREST
Key for the AOI hint. This hint is used to propagate the AOI to Paint and PaintContext instances.
Method Detail

setCursor

public void setCursor(java.awt.Cursor newCursor)
Sets the cursor of this node.
Parameters:
newCursor - the new cursor of this node

getCursor

public java.awt.Cursor getCursor()
Returns the cursor of this node.
Returns:
the cursor of this node

setTransform

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

getTransform

public java.awt.geom.AffineTransform getTransform()
Returns the transform of this node.
Returns:
the transform of this node

getGlobalTransform

public java.awt.geom.AffineTransform getGlobalTransform()
Returns the concatenated transform, i.e., this node's transform preconcatenated with it's parent's transforms.

setComposite

public void setComposite(java.awt.Composite newComposite)
Sets the composite of this node.
Parameters:
composite - the composite of this node

getComposite

public java.awt.Composite getComposite()
Returns the composite of this node.
Returns:
the composite of this node

setVisible

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

isVisible

public boolean isVisible()
Determines whether or not this node is visible when its parent is visible. Nodes are initially visible.
Returns:
true if this node is visible, false otherwise

setClip

public void setClip(Clip newClipper)
Sets the clipping filter for this node.
Parameters:
newClipper - the new clipping filter of this node

getClip

public Clip getClip()
Returns the clipping filter of this node or null if any.
Returns:
the clipping filter of this node or null if any

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.
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.
Parameters:
hints - the rendering hints to be set

setRenderingHints

public void setRenderingHints(java.awt.RenderingHints newHints)
Sets the rendering hints of this node.
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.
Returns:
the rendering hints of this node or null if any

setMask

public void setMask(Mask newMask)
Sets the mask of this node.
Parameters:
newMask - the new mask of this node

getMask

public Mask getMask()
Returns the mask of this node or null if any.
Returns:
the mask of this node or null if any

setFilter

public void setFilter(Filter newFilter)
Sets the filter of this node.
Parameters:
newFilter - the new filter of this node

getFilter

public Filter getFilter()
Returns the filter of this node or null if any.
Returns:
the filter of this node or null if any

hasProgressivePaint

public boolean hasProgressivePaint()
Returns true if this node needs a progressive paint, false otherwise.
Returns:
true if this node needs a progressive paint

progressivePaint

public void progressivePaint(java.awt.Graphics2D g2d,
                             GraphicsNodeRenderContext rc)
Paints one step of this node rendering operations.
Parameters:
g2d - the Graphics2D to use
rc - the GraphicsNodeRenderContext to use

paint

public void paint(java.awt.Graphics2D g2d,
                  GraphicsNodeRenderContext rc)
           throws java.lang.InterruptedException
Paints this node.
Parameters:
g2d - the Graphics2D to use
rc - the GraphicsNodeRenderContext to use
Throws:
thrown - if the current thread was interrupted during paint

primitivePaint

public void primitivePaint(java.awt.Graphics2D g2d,
                           GraphicsNodeRenderContext rc)
Paints this node without applying Filter, Mask, Composite and clip.
Parameters:
g2d - the Graphics2D to use
rc - the GraphicsNodeRenderContext to use

addGraphicsNodeMouseListener

public void addGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Adds the specified graphics node mouse listener to receive graphics node mouse events from this node.
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.
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.
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.
Parameters:
l - the graphics node key listener to remove

setGraphicsNodeEventFilter

public void setGraphicsNodeEventFilter(GraphicsNodeEventFilter evtFilter)
Sets the graphics node event filter of this node.
Parameters:
evtFilter - the new graphics node event filter

getGraphicsNodeEventFilter

public GraphicsNodeEventFilter getGraphicsNodeEventFilter()
Returns the graphics node event filter of this node.
Returns:
the graphics node event filter of this node

setGraphicsNodeHitDetector

public void setGraphicsNodeHitDetector(GraphicsNodeHitDetector hitDetector)
Sets the hit detector for this node.
Parameters:
hitDetector - the new hit detector

getGraphicsNodeHitDetector

public GraphicsNodeHitDetector getGraphicsNodeHitDetector()
Returns the hit detector for this node.
Returns:
the hit detector for this node

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds the specified property change listener to receive property change events from this node.
Parameters:
l - the property change listener to add

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener l)
Adds the specified property change listener to receive property change events for the specified property name of this node.
Parameters:
propertyName - the name of the property
l - the property change listener to add for the specified property

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes the specified property change listener so that it no longer receives property change events from this node.
Parameters:
l - the property change listener to remove

processMouseEvent

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

processKeyEvent

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

dispatch

public void dispatch(GraphicsNodeEvent evt)
Dispatches a graphics node event to this node or one of its child.
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.
Parameters:
listenerType - the type of the listeners to return

getParent

public CompositeGraphicsNode getParent()
Returns the parent of this node or null if any.
Returns:
the parent of this node or null if any.

getRoot

public RootGraphicsNode getRoot()
Returns the root of the GVT tree or null if the node is not part of a GVT tree.

putMemento

public void putMemento(java.lang.Object key,
                       java.lang.Object mememto)
Associates the specified memento with the specified key in this node.
Parameters:
key - the key with which the specified memento is to be associated
memento - the memento to be associated with the specified key

getMemento

public java.lang.Object getMemento(java.lang.Object key)
Returns the value of the memento with the specified key or null if any.
Parameters:
the - key whose associated value is to be returned

removeMemento

public void removeMemento(java.lang.Object key)
Removes the memento object with the specified key.
Parameters:
key - the key whose mapping is to be removed from the map

getBounds

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

getPrimitiveBounds

public java.awt.geom.Rectangle2D getPrimitiveBounds()
Returns the bounds of the area covered by this node's primitive paint.

getGeometryBounds

public java.awt.geom.Rectangle2D getGeometryBounds()
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.

contains

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

intersects

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

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.
Parameters:
p - the specified Point2D in the user space
Returns:
the GraphicsNode containing p on this branch of the GVT tree.

getOutline

public java.awt.Shape getOutline()
Returns the outline of this node.
Returns:
the outline of this node


Copyright © 2000 Apache Software Foundation. All Rights Reserved.