org.apache.batik.refimpl.gvt
Class ConcreteCompositeGraphicsNode

java.lang.Object
  |
  +--org.apache.batik.refimpl.gvt.AbstractGraphicsNode
        |
        +--org.apache.batik.refimpl.gvt.ConcreteCompositeGraphicsNode
All Implemented Interfaces:
java.util.Collection, CompositeGraphicsNode, GraphicsNode, java.util.List
Direct Known Subclasses:
ConcreteCanvasGraphicsNode, ConcreteImageNode, ConcreteRootGraphicsNode

public class ConcreteCompositeGraphicsNode
extends AbstractGraphicsNode
implements CompositeGraphicsNode, java.util.List

An implementation of the CompositeGraphicsNode interface.


Field Summary
protected  java.awt.geom.Rectangle2D backgroundEnableRgn
          This flag indicates if this node has BackgroundEnable = 'new'.
protected  GraphicsNode[] children
          The children of this composite graphics node.
protected  int count
          The number of children of this composite graphics node.
protected  int modCount
          The number of times the children list has been structurally modified.
 
Fields inherited from class org.apache.batik.refimpl.gvt.AbstractGraphicsNode
clip, composite, cursor, eventFilter, filter, hints, hitDetector, isVisible, listeners, mask, mememtos, parent, root, transform
 
Fields inherited from interface org.apache.batik.gvt.CompositeGraphicsNode
VIEWPORT
 
Fields inherited from interface org.apache.batik.gvt.GraphicsNode
KEY_AREA_OF_INTEREST
 
Constructor Summary
ConcreteCompositeGraphicsNode()
          Constructs a new empty composite graphics node.
 
Method Summary
 void add(int index, java.lang.Object o)
          Inserts the specified graphics node at the specified position in this children list.
 boolean add(java.lang.Object o)
          Adds the specified graphics node to this composite graphics node.
 boolean addAll(java.util.Collection c)
          Not supported - Throws UnsupportedOperationException exception.
 boolean addAll(int index, java.util.Collection c)
          Not supported - Throws UnsupportedOperationException exception.
 void addCompositeGraphicsNodeListener(CompositeGraphicsNodeListener l)
          Adds the specified composite graphics node listener to receive composite graphics node events from this node.
 void clear()
          Not supported - Throws UnsupportedOperationException exception.
 boolean contains(java.lang.Object node)
          Returns true if this composite graphics node contains the specified graphics node, false otherwise.
 boolean contains(java.awt.geom.Point2D p)
          Tests if the specified Point2D is inside the boundary of this node.
 boolean containsAll(java.util.Collection c)
          Returns true if this composite graphics node contains all the graphics node in the specified collection, false otherwise.
 void ensureCapacity(int minCapacity)
          Increases the capacity of the children list, if necessary, to ensure that it can hold at least the number of graphics nodes specified by the minimum capacity argument.
 java.lang.Object get(int index)
          Returns the graphics node at the specified position in the children list.
 java.awt.geom.Rectangle2D getBackgroundEnable()
          Returns the Rectangle defined as background.
 java.util.List getChildren()
          Returns the list of children 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.
protected  java.awt.geom.Rectangle2D getGlobalBounds()
           
 java.awt.Shape getOutline()
          Returns the outline of this node.
 java.awt.geom.Rectangle2D getPrimitiveBounds()
          Returns the bounds of the area covered by this node's primitive paint.
 boolean hasProgressivePaint()
          Returns true if this node needs a progressive paint, false otherwise.
 int indexOf(java.lang.Object node)
          Returns the index in the children list of the specified graphics node or -1 if the children list does not contain this graphics node.
protected  void invalidateGeometryCache()
          Invalidates the cached geometric bounds.
 boolean isEmpty()
          Returns true if this composite graphics node does not contain graphics node, false otherwise.
 java.util.Iterator iterator()
          Returns an iterator over the children of this graphics node.
 int lastIndexOf(java.lang.Object node)
          Returns the index in this children list of the last occurence of the specified graphics node, or -1 if the list does not contain this graphics node.
 java.util.ListIterator listIterator()
          Returns an iterator over the children of this graphics node.
 java.util.ListIterator listIterator(int index)
          Returns an iterator over the children of this graphics node, starting at the specified position in the children list.
 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 primitivePaint(java.awt.Graphics2D g2d, GraphicsNodeRenderContext rc)
          Paints this node without applying Filter, Mask, Composite and clip.
 void progressivePaint(java.awt.Graphics2D g2d, GraphicsNodeRenderContext rc)
          Paints one step of this node rendering operations.
 java.lang.Object remove(int index)
          Removes the graphics node at the specified position in the children list.
 boolean remove(java.lang.Object o)
          Removes the specified graphics node from the children list.
 boolean removeAll(java.util.Collection c)
          Not supported - Throws UnsupportedOperationException exception.
 void removeCompositeGraphicsNodeListener(CompositeGraphicsNodeListener l)
          Removes the specified composite graphics node listener so that it no longer receives composite graphics node events from this node.
 boolean retainAll(java.util.Collection c)
          Not supported - Throws UnsupportedOperationException exception.
 java.lang.Object set(int index, java.lang.Object o)
          Replaces the graphics node at the specified position in the children list with the specified graphics node.
 void setBackgroundEnable(java.awt.geom.Rectangle2D bgRgn)
          If bgRgn == VIEWPORT then background enable is activated for the entire viewable region.
protected  void setRoot(RootGraphicsNode newRoot)
           
 int size()
          Returns the number of children of this composite graphics node.
 java.util.List subList(int fromIndex, int toIndex)
          Not supported - Throws UnsupportedOperationException exception.
 java.lang.Object[] toArray()
          Returns an array containing all of the graphics node in the children list of this composite graphics node in the correct order.
 java.lang.Object[] toArray(java.lang.Object[] a)
          Returns an array containing all of the graphics node in the children list of this composite graphics node in the correct order.
 
Methods inherited from class org.apache.batik.refimpl.gvt.AbstractGraphicsNode
acceptEvent, addGraphicsNodeKeyListener, addGraphicsNodeMouseListener, addPropertyChangeListener, addPropertyChangeListener, dispatch, fireGraphicsNodePaintListener, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getClip, getComposite, getCursor, getFilter, getGlobalTransform, getGraphicsNodeEventFilter, getGraphicsNodeHitDetector, getListeners, getMask, getMemento, getParent, getRenderingHints, getRoot, getTransform, intersects, isAntialiasedClip, isOffscreenBufferNeeded, isVisible, paint, processChangeEvent, processKeyEvent, processMouseEvent, putMemento, removeGraphicsNodeKeyListener, removeGraphicsNodeMouseListener, removeMemento, removePropertyChangeListener, setClip, setComposite, setCursor, setFilter, setGraphicsNodeEventFilter, setGraphicsNodeHitDetector, setMask, setRenderingHint, setRenderingHints, setRenderingHints, setTransform, setVisible
 
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
addGraphicsNodeKeyListener, addGraphicsNodeMouseListener, addPropertyChangeListener, addPropertyChangeListener, dispatch, getBounds, getClip, getComposite, getCursor, getFilter, getGlobalTransform, getGraphicsNodeEventFilter, getGraphicsNodeHitDetector, getListeners, getMask, getMemento, getParent, getRenderingHints, getRoot, getTransform, intersects, isVisible, paint, processKeyEvent, processMouseEvent, putMemento, removeGraphicsNodeKeyListener, removeGraphicsNodeMouseListener, removeMemento, removePropertyChangeListener, setClip, setComposite, setCursor, setFilter, setGraphicsNodeEventFilter, setGraphicsNodeHitDetector, setMask, setRenderingHint, setRenderingHints, setRenderingHints, setTransform, setVisible
 
Methods inherited from interface java.util.List
equals, hashCode
 

Field Detail

children

protected GraphicsNode[] children
The children of this composite graphics node.

count

protected int count
The number of children of this composite graphics node.

modCount

protected int modCount
The number of times the children list has been structurally modified.

backgroundEnableRgn

protected java.awt.geom.Rectangle2D backgroundEnableRgn
This flag indicates if this node has BackgroundEnable = 'new'. If so traversal of the gvt tree can halt here.
Constructor Detail

ConcreteCompositeGraphicsNode

public ConcreteCompositeGraphicsNode()
Constructs a new empty composite graphics node.
Method Detail

getChildren

public java.util.List getChildren()
Description copied from interface: CompositeGraphicsNode
Returns the list of children or null if any.
Specified by:
getChildren in interface CompositeGraphicsNode

setBackgroundEnable

public void setBackgroundEnable(java.awt.geom.Rectangle2D bgRgn)
Description copied from interface: CompositeGraphicsNode
If bgRgn == VIEWPORT then background enable is activated for the entire viewable region. If bgRgn is null then background enable is accumulate. If bgRgn is any other Rectangle2D then it defines the bounds in the user coord system for which drawing is enabled.
Specified by:
setBackgroundEnable in interface CompositeGraphicsNode

getBackgroundEnable

public java.awt.geom.Rectangle2D getBackgroundEnable()
Description copied from interface: CompositeGraphicsNode
Returns the Rectangle defined as background. If this is null then you need to check the parents background-enable.
Specified by:
getBackgroundEnable in interface CompositeGraphicsNode

hasProgressivePaint

public boolean hasProgressivePaint()
Description copied from interface: GraphicsNode
Returns true if this node needs a progressive paint, false otherwise.
Specified by:
hasProgressivePaint in interface GraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Returns:
true if this node needs a progressive paint

progressivePaint

public void progressivePaint(java.awt.Graphics2D g2d,
                             GraphicsNodeRenderContext rc)
Description copied from interface: GraphicsNode
Paints one step of this node rendering operations.
Specified by:
progressivePaint in interface GraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Parameters:
g2d - the Graphics2D to use
rc - the GraphicsNodeRenderContext to use

primitivePaint

public void primitivePaint(java.awt.Graphics2D g2d,
                           GraphicsNodeRenderContext rc)
Description copied from interface: GraphicsNode
Paints this node without applying Filter, Mask, Composite and clip.
Specified by:
primitivePaint in interface GraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Parameters:
g2d - the Graphics2D to use
rc - the GraphicsNodeRenderContext to use

addCompositeGraphicsNodeListener

public void addCompositeGraphicsNodeListener(CompositeGraphicsNodeListener l)
Description copied from interface: CompositeGraphicsNode
Adds the specified composite graphics node listener to receive composite graphics node events from this node.
Specified by:
addCompositeGraphicsNodeListener in interface CompositeGraphicsNode
Following copied from interface: org.apache.batik.gvt.CompositeGraphicsNode
Parameters:
l - the composite graphics node listener to add

removeCompositeGraphicsNodeListener

public void removeCompositeGraphicsNodeListener(CompositeGraphicsNodeListener l)
Description copied from interface: CompositeGraphicsNode
Removes the specified composite graphics node listener so that it no longer receives composite graphics node events from this node.
Specified by:
removeCompositeGraphicsNodeListener in interface CompositeGraphicsNode
Following copied from interface: org.apache.batik.gvt.CompositeGraphicsNode
Parameters:
l - the composite graphics node listener to remove

invalidateGeometryCache

protected void invalidateGeometryCache()
Description copied from class: AbstractGraphicsNode
Invalidates the cached geometric bounds. This method is called each time an attribute that affects the bounds of this node changed.
Overrides:
invalidateGeometryCache in class AbstractGraphicsNode

contains

public boolean contains(java.awt.geom.Point2D p)
Description copied from interface: GraphicsNode
Tests if the specified Point2D is inside the boundary of this node.
Specified by:
contains in interface GraphicsNode
Overrides:
contains in class AbstractGraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Parameters:
p - the specified Point2D in the user space
Returns:
true if the coordinates are inside, false otherwise

nodeHitAt

public GraphicsNode nodeHitAt(java.awt.geom.Point2D p)
Description copied from interface: GraphicsNode
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
Overrides:
nodeHitAt in class AbstractGraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Parameters:
p - the specified Point2D in the user space
Returns:
the GraphicsNode containing p on this branch of the GVT tree.

getGlobalBounds

protected java.awt.geom.Rectangle2D getGlobalBounds()
Overrides:
getGlobalBounds in class AbstractGraphicsNode

getPrimitiveBounds

public java.awt.geom.Rectangle2D getPrimitiveBounds()
Description copied from interface: GraphicsNode
Returns the bounds of the area covered by this node's primitive paint.
Specified by:
getPrimitiveBounds in interface GraphicsNode

getGeometryBounds

public java.awt.geom.Rectangle2D getGeometryBounds()
Description copied from interface: GraphicsNode
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:
getGeometryBounds in interface GraphicsNode

getOutline

public java.awt.Shape getOutline()
Description copied from interface: GraphicsNode
Returns the outline of this node.
Specified by:
getOutline in interface GraphicsNode
Following copied from interface: org.apache.batik.gvt.GraphicsNode
Returns:
the outline of this node

setRoot

protected void setRoot(RootGraphicsNode newRoot)
Overrides:
setRoot in class AbstractGraphicsNode

size

public int size()
Returns the number of children of this composite graphics node.
Specified by:
size in interface java.util.List

isEmpty

public boolean isEmpty()
Returns true if this composite graphics node does not contain graphics node, false otherwise.
Specified by:
isEmpty in interface java.util.List

contains

public boolean contains(java.lang.Object node)
Returns true if this composite graphics node contains the specified graphics node, false otherwise.
Specified by:
contains in interface java.util.List
Parameters:
node - the node to check

iterator

public java.util.Iterator iterator()
Returns an iterator over the children of this graphics node.
Specified by:
iterator in interface java.util.List

toArray

public java.lang.Object[] toArray()
Returns an array containing all of the graphics node in the children list of this composite graphics node in the correct order. If the children list fits in the specified array, it is returned therein. Otherwise, a new array is allocated.
Specified by:
toArray in interface java.util.List

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Returns an array containing all of the graphics node in the children list of this composite graphics node in the correct order.
Specified by:
toArray in interface java.util.List
Parameters:
a - the array to fit if possible

get

public java.lang.Object get(int index)
Returns the graphics node at the specified position in the children list.
Specified by:
get in interface java.util.List
Parameters:
index - the index of the graphics node to return
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

set

public java.lang.Object set(int index,
                            java.lang.Object o)
Replaces the graphics node at the specified position in the children list with the specified graphics node.
Specified by:
set in interface java.util.List
Parameters:
index - the index of the graphics node to replace
o - the graphics node to be stored at the specified position
Returns:
the graphics node previously at the specified position
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range
java.lang.IllegalArgumentException - if the node is not an instance of GraphicsNode

add

public boolean add(java.lang.Object o)
Adds the specified graphics node to this composite graphics node.
Specified by:
add in interface java.util.List
Parameters:
o - the graphics node to add
Returns:
true (as per the general contract of Collection.add)
Throws:
java.lang.IllegalArgumentException - if the node is not an instance of GraphicsNode

add

public void add(int index,
                java.lang.Object o)
Inserts the specified graphics node at the specified position in this children list. Shifts the graphics node currently at that position (if any) and any subsequent graphics nodes to the right (adds one to their indices).
Specified by:
add in interface java.util.List
Parameters:
index - the position at which the specified graphics node is to be inserted.
o - the graphics node to be inserted.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range
java.lang.IllegalArgumentException - if the node is not an instance of GraphicsNode

addAll

public boolean addAll(java.util.Collection c)
Not supported - Throws UnsupportedOperationException exception.
Specified by:
addAll in interface java.util.List

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Not supported - Throws UnsupportedOperationException exception.
Specified by:
addAll in interface java.util.List

remove

public boolean remove(java.lang.Object o)
Removes the specified graphics node from the children list.
Specified by:
remove in interface java.util.List
Parameters:
o - the node the remove
Returns:
true if the children list contains the specified graphics node
Throws:
java.lang.IllegalArgumentException - if the node is not an instance of GraphicsNode

remove

public java.lang.Object remove(int index)
Removes the graphics node at the specified position in the children list. Shifts any subsequent graphics nodes to the left (subtracts one from their indices).
Specified by:
remove in interface java.util.List
Parameters:
index - the position of the graphics node to remove
Returns:
the graphics node that was removed
Throws:
java.lang.IndexOutOfBoundsException - if index out of range

removeAll

public boolean removeAll(java.util.Collection c)
Not supported - Throws UnsupportedOperationException exception.
Specified by:
removeAll in interface java.util.List

retainAll

public boolean retainAll(java.util.Collection c)
Not supported - Throws UnsupportedOperationException exception.
Specified by:
retainAll in interface java.util.List

clear

public void clear()
Not supported - Throws UnsupportedOperationException exception.
Specified by:
clear in interface java.util.List

containsAll

public boolean containsAll(java.util.Collection c)
Returns true if this composite graphics node contains all the graphics node in the specified collection, false otherwise.
Specified by:
containsAll in interface java.util.List
Parameters:
c - the collection to be checked for containment

indexOf

public int indexOf(java.lang.Object node)
Returns the index in the children list of the specified graphics node or -1 if the children list does not contain this graphics node.
Specified by:
indexOf in interface java.util.List
Parameters:
node - the graphics node to search for

lastIndexOf

public int lastIndexOf(java.lang.Object node)
Returns the index in this children list of the last occurence of the specified graphics node, or -1 if the list does not contain this graphics node.
Specified by:
lastIndexOf in interface java.util.List
Parameters:
node - the graphics node to search for

listIterator

public java.util.ListIterator listIterator()
Returns an iterator over the children of this graphics node.
Specified by:
listIterator in interface java.util.List

listIterator

public java.util.ListIterator listIterator(int index)
Returns an iterator over the children of this graphics node, starting at the specified position in the children list.
Specified by:
listIterator in interface java.util.List
Parameters:
index - the index of the first graphics node to return from the children list

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Not supported - Throws UnsupportedOperationException exception.
Specified by:
subList in interface java.util.List

ensureCapacity

public void ensureCapacity(int minCapacity)
Increases the capacity of the children list, if necessary, to ensure that it can hold at least the number of graphics nodes specified by the minimum capacity argument.
Parameters:
minCapacity - the desired minimum capacity.


Copyright © 2000 Apache Software Foundation. All Rights Reserved.