org.apache.batik.gvt

Class AbstractGraphicsNode

public abstract class AbstractGraphicsNode extends Object implements GraphicsNode

A partial implementation of the GraphicsNode interface.
Field Summary
protected GraphicsNodeChangeEventchangeCompletedEvent
protected GraphicsNodeChangeEventchangeStartedEvent
protected ClipRableclip
The clipping filter for this graphics node.
protected Compositecomposite
The compositing operation to be used when a graphics node is painted on top of another one.
protected WeakReferenceenableBackgroundGraphicsNodeRable
The GraphicsNodeRable for this node with all filtering applied
protected Filterfilter
The filter of this graphics node.
protected WeakReferencegraphicsNodeRable
The GraphicsNodeRable for this node.
protected RenderingHintshints
The rendering hints that control the quality to use when rendering this graphics node.
protected AffineTransforminverseTransform
The inverse transform for this node, i.e., from parent node to this node.
protected booleanisVisible
This flag bit indicates whether or not this graphics node is visible.
protected EventListenerListlisteners
The listeners list.
protected Maskmask
The mask of this graphics node.
protected CompositeGraphicsNodeparent
The parent of this graphics node.
protected intpointerEventType
Indicates how this graphics node reacts to events.
protected RootGraphicsNoderoot
The root of the GVT tree.
protected AffineTransformtransform
The transform of this graphics node.
protected WeakReferenceweakRef
A Weak Reference to this.
Constructor Summary
protected AbstractGraphicsNode()
Constructs a new graphics node.
Method Summary
booleancontains(Point2D p)
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.
voidfireGraphicsNodeChangeCompleted()
voidfireGraphicsNodeChangeStarted(GraphicsNode changeSrc)
voidfireGraphicsNodeChangeStarted()
voidfireGraphicsNodeChangeStarted(GraphicsNodeChangeEvent changeStartedEvent)
Rectangle2DgetBounds()
Returns the bounds of this node in user space.
ClipRablegetClip()
Returns the clipping filter of this node or null if any.
CompositegetComposite()
Returns the composite of this node or null if any.
FiltergetEnableBackgroundGraphicsNodeRable(boolean createIfNeeded)
Returns the GraphicsNodeRable for this node.
FiltergetFilter()
Returns the filter of this node or null if any.
AffineTransformgetGlobalTransform()
Returns the concatenated transform of this node.
FiltergetGraphicsNodeRable(boolean createIfNeeded)
Returns the GraphicsNodeRable for this node.
AffineTransformgetInverseTransform()
Returns the inverse transform for this node.
MaskgetMask()
Returns the mask of this node or null if any.
CompositeGraphicsNodegetParent()
Returns the parent of this node or null if any.
intgetPointerEventType()
Returns the type that describes how this graphics node reacts to events.
RenderingHintsgetRenderingHints()
Returns the rendering hints of this node or null if any.
RootGraphicsNodegetRoot()
Returns the root of the GVT tree or null if the node is not part of a GVT tree.
AffineTransformgetTransform()
Returns the transform of this node or null if any.
Rectangle2DgetTransformedBounds(AffineTransform txf)
Returns the bounds of this node after applying the input transform (if any), concatenated with this node's transform (if any).
Rectangle2DgetTransformedGeometryBounds(AffineTransform txf)
Returns the bounds of the area covered by this node, without taking any of its rendering attribute into accoun.
Rectangle2DgetTransformedPrimitiveBounds(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).
Rectangle2DgetTransformedSensitiveBounds(AffineTransform txf)
Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering.
WeakReferencegetWeakReference()
Returns a canonical WeakReference to this GraphicsNode.
booleanintersects(Rectangle2D r)
Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.
protected voidinvalidateGeometryCache()
Invalidates the cached geometric bounds.
protected booleanisAntialiasedClip(AffineTransform usr2dev, RenderingHints hints, Shape clip)
Returns true if there is a clip and it should be antialiased
protected booleanisOffscreenBufferNeeded()
Returns true of an offscreen buffer is needed to render this node, false otherwise.
booleanisVisible()
Returns true if this node is visible, false otherwise.
GraphicsNodenodeHitAt(Point2D p)
Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.
protected Rectangle2DnormalizeRectangle(Rectangle2D bounds)
This method makes sure that neither the width nor height of the rectangle is zero.
voidpaint(Graphics2D g2d)
Paints this node.
voidsetClip(ClipRable newClipper)
voidsetComposite(Composite newComposite)
Sets the composite of this node.
voidsetFilter(Filter newFilter)
Sets the filter of this node.
voidsetMask(Mask newMask)
Sets the mask of this node.
protected voidsetParent(CompositeGraphicsNode newParent)
Sets the parent node of this graphics node.
voidsetPointerEventType(int pointerEventType)
Sets the type that describes how this graphics node reacts to events.
voidsetRenderingHint(Key key, Object value)
Maps the specified key to the specified value in the rendering hints of this node.
voidsetRenderingHints(Map hints)
Copies all of the mappings from the specified Map to the rendering hints of this node.
voidsetRenderingHints(RenderingHints newHints)
Sets the rendering hints of this node.
protected voidsetRoot(RootGraphicsNode newRoot)
Sets the root node of this graphics node.
voidsetTransform(AffineTransform newTransform)
Sets the transform of this node.
voidsetVisible(boolean isVisible)
Sets if this node is visible or not depending on the specified value.

Field Detail

changeCompletedEvent

protected GraphicsNodeChangeEvent changeCompletedEvent

changeStartedEvent

protected GraphicsNodeChangeEvent changeStartedEvent

clip

protected ClipRable clip
The clipping filter for this graphics node.

composite

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

enableBackgroundGraphicsNodeRable

protected WeakReference enableBackgroundGraphicsNodeRable
The GraphicsNodeRable for this node with all filtering applied

filter

protected Filter filter
The filter of this graphics node.

graphicsNodeRable

protected WeakReference graphicsNodeRable
The GraphicsNodeRable for this node.

hints

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

inverseTransform

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

isVisible

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

listeners

protected EventListenerList listeners
The listeners list.

mask

protected Mask mask
The mask of this graphics node.

parent

protected CompositeGraphicsNode parent
The parent of this graphics node.

pointerEventType

protected int pointerEventType
Indicates how this graphics node reacts to events.

root

protected RootGraphicsNode root
The root of the GVT tree.

transform

protected AffineTransform transform
The transform of this graphics node.

weakRef

protected WeakReference weakRef
A Weak Reference to this.

Constructor Detail

AbstractGraphicsNode

protected AbstractGraphicsNode()
Constructs a new graphics node.

Method Detail

contains

public boolean contains(Point2D p)
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.

Parameters: p the specified Point2D in the user space

fireGraphicsNodeChangeCompleted

public void fireGraphicsNodeChangeCompleted()

fireGraphicsNodeChangeStarted

public void fireGraphicsNodeChangeStarted(GraphicsNode changeSrc)

fireGraphicsNodeChangeStarted

public void fireGraphicsNodeChangeStarted()

fireGraphicsNodeChangeStarted

public void fireGraphicsNodeChangeStarted(GraphicsNodeChangeEvent changeStartedEvent)

getBounds

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

getClip

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

getComposite

public Composite getComposite()
Returns the composite of this node or null if any.

getEnableBackgroundGraphicsNodeRable

public Filter getEnableBackgroundGraphicsNodeRable(boolean createIfNeeded)
Returns the GraphicsNodeRable for this node. This GraphicsNodeRable is the Renderable (Filter) after all of the filter operations have been applied.

getFilter

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

getGlobalTransform

public AffineTransform getGlobalTransform()
Returns the concatenated transform of this node. That is, this node's transform preconcatenated with it's parent's transforms.

getGraphicsNodeRable

public Filter getGraphicsNodeRable(boolean createIfNeeded)
Returns the GraphicsNodeRable for this node. This GraphicsNodeRable is the Renderable (Filter) before any of the filter operations have been applied.

getInverseTransform

public AffineTransform getInverseTransform()
Returns the inverse transform for this node.

getMask

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

getParent

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

getPointerEventType

public int getPointerEventType()
Returns the type that describes how this graphics node reacts to events.

Returns: VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | PAINTED | FILL | STROKE | ALL | NONE

getRenderingHints

public RenderingHints getRenderingHints()
Returns the rendering hints 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.

getTransform

public AffineTransform getTransform()
Returns the transform of this node or null if any.

getTransformedBounds

public Rectangle2D getTransformedBounds(AffineTransform txf)
Returns the bounds of this node after applying the input transform (if any), concatenated with this node's transform (if any).

Parameters: txf the affine transform with which this node's transform should be concatenated. Should not be null.

getTransformedGeometryBounds

public Rectangle2D getTransformedGeometryBounds(AffineTransform txf)
Returns the bounds of the area covered by this node, without taking any of its rendering attribute into accoun. That is, exclusive of any clipping, masking, filtering or stroking, for example. The returned value is transformed by the concatenation of the input transform and this node's transform.

Parameters: txf the affine transform with which this node's transform should be concatenated. Should not be null.

getTransformedPrimitiveBounds

public Rectangle2D getTransformedPrimitiveBounds(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).

Parameters: txf the affine transform with which this node's transform should be concatenated. Should not be null.

getTransformedSensitiveBounds

public Rectangle2D getTransformedSensitiveBounds(AffineTransform txf)
Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering. The returned value is transformed by the concatenation of the input transform and this node's transform.

Parameters: txf the affine transform with which this node's transform should be concatenated. Should not be null.

getWeakReference

public WeakReference getWeakReference()
Returns a canonical WeakReference to this GraphicsNode. This is suitable for use as a key value in a hash map

intersects

public boolean intersects(Rectangle2D r)
Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.

Parameters: r the specified Rectangle2D in the user node space

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.

isAntialiasedClip

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

isOffscreenBufferNeeded

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

isVisible

public boolean isVisible()
Returns true if this node is visible, false otherwise.

nodeHitAt

public GraphicsNode nodeHitAt(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

normalizeRectangle

protected Rectangle2D normalizeRectangle(Rectangle2D bounds)
This method makes sure that neither the width nor height of the rectangle is zero. But it tries to make them very small relatively speaking.

paint

public void paint(Graphics2D g2d)
Paints this node.

Parameters: g2d the Graphics2D to use

setClip

public void setClip(ClipRable newClipper)

setComposite

public void setComposite(Composite newComposite)
Sets the composite of this node.

Parameters: newComposite the composite of this node

setFilter

public void setFilter(Filter newFilter)
Sets the filter of this node.

Parameters: newFilter the new filter of this node

setMask

public void setMask(Mask newMask)
Sets the mask of this node.

Parameters: newMask the new mask 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

setPointerEventType

public void setPointerEventType(int pointerEventType)
Sets the type that describes how this graphics node reacts to events.

Parameters: pointerEventType VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | PAINTED | FILL | STROKE | ALL | NONE

setRenderingHint

public void setRenderingHint(Key key, 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(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(RenderingHints newHints)
Sets the rendering hints of this node.

Parameters: newHints the new rendering hints of this node

setRoot

protected void setRoot(RootGraphicsNode newRoot)
Sets the root node of this graphics node.

Parameters: newRoot the new root node of this node

setTransform

public void setTransform(AffineTransform newTransform)
Sets the transform of this node.

Parameters: newTransform the new transform 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

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.