java.lang.Object
io.sf.carte.echosvg.gvt.AbstractGraphicsNode
io.sf.carte.echosvg.gvt.CompositeGraphicsNode
- All Implemented Interfaces:
GraphicsNode,Iterable<GraphicsNode>,Collection<GraphicsNode>,List<GraphicsNode>,SequencedCollection<GraphicsNode>
- Direct Known Subclasses:
CanvasGraphicsNode,ImageNode,RootGraphicsNode
A CompositeGraphicsNode is a graphics node that can contain graphics nodes.
Note: this class is a 'little bit aware of' other threads, but not really threadsafe.
Note: this class is a 'little bit aware of' other threads, but not really threadsafe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Rectangle2DThis flag indicates if this node has BackgroundEnable = 'new'.protected GraphicsNode[]The children of this composite graphics node.protected intThe number of children of this composite graphics node.protected intThe number of times the children list has been structurally modified.static final Rectangle2Dstatic final Rectangle2DFields inherited from class io.sf.carte.echosvg.gvt.AbstractGraphicsNode
changeCompletedEvent, changeStartedEvent, clip, composite, enableBackgroundGraphicsNodeRable, filter, graphicsNodeRable, hints, inverseTransform, isVisible, listeners, mask, parent, pointerEventType, root, transform, weakRefFields inherited from interface io.sf.carte.echosvg.gvt.GraphicsNode
ALL, FILL, IDENTITY, NONE, PAINTED, STROKE, VISIBLE, VISIBLE_FILL, VISIBLE_PAINTED, VISIBLE_STROKE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, GraphicsNode node) Inserts the specified graphics node at the specified position in this children list.booleanadd(GraphicsNode node) Adds the specified graphics node to this composite graphics node.booleanaddAll(int index, Collection<? extends GraphicsNode> c) Not supported - ThrowsUnsupportedOperationExceptionexception.booleanaddAll(Collection<? extends GraphicsNode> c) Not supported - ThrowsUnsupportedOperationExceptionexception.voidclear()Not supported - ThrowsUnsupportedOperationExceptionexception.booleanReturns true if the specified Point2D is inside the boundary of this node, false otherwise.booleanReturns true if this composite graphics node contains the specified graphics node, false otherwise.booleancontainsAll(Collection<?> c) Returns true if this composite graphics node contains all the graphics node in the specified collection, false otherwise.voidensureCapacity(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.get(int index) Returns the graphics node at the specified position in the children list.Returns the region defining the background enable property.Returns the list of children.Returns the bounds of the area covered by this node, without taking any of its rendering attributes into account.Returns the outline of this node.Returns the bounds of the area covered by this node's primitive paint.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.static Rectangle2DTransforms a Rectangle 2D by an affine transform.Returns the bounds of the area covered by this node, without taking any of its rendering attribute into accoun.Returns the bounds of this node's primitivePaint after applying the input transform (if any), concatenated with this node's transform (if any).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.intReturns the index in the children list of the specified graphics node or -1 if the children list does not contain this graphics node.protected voidInvalidates the cached geometric bounds.booleanisEmpty()Returns true if this composite graphics node does not contain graphics node, false otherwise.iterator()Returns an iterator over the children of this graphics node.intlastIndexOf(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.Returns an iterator over the children of this graphics node.listIterator(int index) Returns an iterator over the children of this graphics node, starting at the specified position in the children list.Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.voidprimitivePaint(Graphics2D g2d) Paints this node without applying Filter, Mask, Composite, and clip.remove(int index) Removes the graphics node at the specified position in the children list.booleanRemoves the first instance of the specified graphics node from the children list.booleanremoveAll(Collection<?> c) Not supported - ThrowsUnsupportedOperationExceptionexception.booleanretainAll(Collection<?> c) Not supported - ThrowsUnsupportedOperationExceptionexception.set(int index, GraphicsNode o) Replaces the graphics node at the specified position in the children list with the specified graphics node.voidsetBackgroundEnable(Rectangle2D bgRgn) Sets the enable background property to the specified rectangle.protected voidsetRoot(RootGraphicsNode newRoot) Sets the root node of this grahics node and modify all its children.voidsetVisible(boolean isVisible) Sets if this node is visible or not depending on the specified value.intsize()Returns the number of children of this composite graphics node.subList(int fromIndex, int toIndex) Not supported - ThrowsUnsupportedOperationExceptionexception.toArray()Returns an array containing all of the graphics node in the children list of this composite graphics node in the correct order.<T> T[]toArray(T[] 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 io.sf.carte.echosvg.gvt.AbstractGraphicsNode
fireGraphicsNodeChangeCompleted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, getBounds, getClip, getComposite, getEnableBackgroundGraphicsNodeRable, getFilter, getGlobalTransform, getGraphicsNodeRable, getInverseTransform, getMask, getParent, getPointerEventType, getRenderingHints, getRoot, getTransform, getTransformedBounds, getWeakReference, intersects, isAntialiasedClip, isOffscreenBufferNeeded, isVisible, normalizeRectangle, paint, setClip, setComposite, setFilter, setMask, setParent, setPointerEventType, setRenderingHint, setRenderingHints, setRenderingHints, setTransformMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Field Details
-
VIEWPORT
-
NULL_RECT
-
children
The children of this composite graphics node. -
count
protected volatile int countThe number of children of this composite graphics node. -
modCount
protected volatile int modCountThe number of times the children list has been structurally modified. -
backgroundEnableRgn
This flag indicates if this node has BackgroundEnable = 'new'. If so traversal of the gvt tree can halt here.
-
-
Constructor Details
-
CompositeGraphicsNode
public CompositeGraphicsNode()Constructs a new emptyCompositeGraphicsNode.
-
-
Method Details
-
getChildren
Returns the list of children. -
setBackgroundEnable
Sets the enable background property to the specified rectangle.- Parameters:
bgRgn- the region that defines the background enable property
-
getBackgroundEnable
Returns the region defining the background enable property. -
setVisible
public void setVisible(boolean isVisible) Sets if this node is visible or not depending on the specified value. Don't fire a graphicsNodeChange event because this doesn't really effect us (it effects our children through CSS inheritence).- Specified by:
setVisiblein interfaceGraphicsNode- Overrides:
setVisiblein classAbstractGraphicsNode- Parameters:
isVisible- If true this node is visible
-
primitivePaint
Paints this node without applying Filter, Mask, Composite, and clip.- Specified by:
primitivePaintin interfaceGraphicsNode- Parameters:
g2d- the Graphics2D to use
-
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.- Overrides:
invalidateGeometryCachein classAbstractGraphicsNode
-
getPrimitiveBounds
Returns the bounds of the area covered by this node's primitive paint.- Specified by:
getPrimitiveBoundsin interfaceGraphicsNode
-
getTransformedBBox
Transforms a Rectangle 2D by an affine transform. It assumes the transform is only scale/translate so there is no loss of precision over transforming the source geometry. -
getTransformedPrimitiveBounds
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:
getTransformedPrimitiveBoundsin interfaceGraphicsNode- Overrides:
getTransformedPrimitiveBoundsin classAbstractGraphicsNode- Parameters:
txf- the affine transform with which this node's transform should be concatenated. Should not be null.
-
getGeometryBounds
Returns the bounds of the area covered by this node, without taking any of its rendering attributes into account. That is, exclusive of any clipping, masking, filtering or stroking, for example.- Specified by:
getGeometryBoundsin interfaceGraphicsNode
-
getTransformedGeometryBounds
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.- Specified by:
getTransformedGeometryBoundsin interfaceGraphicsNode- Overrides:
getTransformedGeometryBoundsin classAbstractGraphicsNode- Parameters:
txf- the affine transform with which this node's transform should be concatenated. Should not be null.
-
getSensitiveBounds
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.- Specified by:
getSensitiveBoundsin interfaceGraphicsNode
-
getTransformedSensitiveBounds
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.- Specified by:
getTransformedSensitiveBoundsin interfaceGraphicsNode- Overrides:
getTransformedSensitiveBoundsin classAbstractGraphicsNode- Parameters:
txf- the affine transform with which this node's transform should be concatenated. Should not be null.
-
contains
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.- Specified by:
containsin interfaceGraphicsNode- Overrides:
containsin classAbstractGraphicsNode- Parameters:
p- the specified Point2D in the user space
-
nodeHitAt
Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.- Specified by:
nodeHitAtin interfaceGraphicsNode- Overrides:
nodeHitAtin classAbstractGraphicsNode- Parameters:
p- the specified Point2D in the user space
-
getOutline
Returns the outline of this node.- Specified by:
getOutlinein interfaceGraphicsNode
-
setRoot
Sets the root node of this grahics node and modify all its children.- Overrides:
setRootin classAbstractGraphicsNode- Parameters:
newRoot- the new root node of this node
-
size
public int size()Returns the number of children of this composite graphics node.- Specified by:
sizein interfaceCollection<GraphicsNode>- Specified by:
sizein interfaceList<GraphicsNode>
-
isEmpty
public boolean isEmpty()Returns true if this composite graphics node does not contain graphics node, false otherwise.- Specified by:
isEmptyin interfaceCollection<GraphicsNode>- Specified by:
isEmptyin interfaceList<GraphicsNode>
-
contains
Returns true if this composite graphics node contains the specified graphics node, false otherwise.- Specified by:
containsin interfaceCollection<GraphicsNode>- Specified by:
containsin interfaceList<GraphicsNode>- Parameters:
node- the node to check
-
iterator
Returns an iterator over the children of this graphics node.- Specified by:
iteratorin interfaceCollection<GraphicsNode>- Specified by:
iteratorin interfaceIterable<GraphicsNode>- Specified by:
iteratorin interfaceList<GraphicsNode>
-
toArray
Returns an array containing all of the graphics node in the children list of this composite graphics node in the correct order.- Specified by:
toArrayin interfaceCollection<GraphicsNode>- Specified by:
toArrayin interfaceList<GraphicsNode>
-
toArray
public <T> T[] toArray(T[] a) 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:
toArrayin interfaceCollection<GraphicsNode>- Specified by:
toArrayin interfaceList<GraphicsNode>- Parameters:
a- the array to fit if possible
-
get
Returns the graphics node at the specified position in the children list.- Specified by:
getin interfaceList<GraphicsNode>- Parameters:
index- the index of the graphics node to return- Throws:
IndexOutOfBoundsException- if the index is out of range
-
set
Replaces the graphics node at the specified position in the children list with the specified graphics node.- Specified by:
setin interfaceList<GraphicsNode>- Parameters:
index- the index of the graphics node to replaceo- the graphics node to be stored at the specified position- Returns:
- the graphics node previously at the specified position
- Throws:
IndexOutOfBoundsException- if the index is out of rangeIllegalArgumentException- if the node is not an instance of GraphicsNode
-
add
Adds the specified graphics node to this composite graphics node.- Specified by:
addin interfaceCollection<GraphicsNode>- Specified by:
addin interfaceList<GraphicsNode>- Parameters:
node- the graphics node to add- Returns:
- true (as per the general contract of Collection.add)
- Throws:
IllegalArgumentException- if the node is not an instance of GraphicsNode
-
add
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:
addin interfaceList<GraphicsNode>- Parameters:
index- the position at which the specified graphics node is to be inserted.node- the graphics node to be inserted.- Throws:
IndexOutOfBoundsException- if the index is out of rangeIllegalArgumentException- if the node is not an instance of GraphicsNode
-
addAll
Not supported - ThrowsUnsupportedOperationExceptionexception.- Specified by:
addAllin interfaceCollection<GraphicsNode>- Specified by:
addAllin interfaceList<GraphicsNode>
-
addAll
Not supported - ThrowsUnsupportedOperationExceptionexception.- Specified by:
addAllin interfaceList<GraphicsNode>
-
remove
Removes the first instance of the specified graphics node from the children list.- Specified by:
removein interfaceCollection<GraphicsNode>- Specified by:
removein interfaceList<GraphicsNode>- Parameters:
o- the node the remove- Returns:
- true if the children list contains the specified graphics node
- Throws:
IllegalArgumentException- if the node is not an instance of GraphicsNodeIndexOutOfBoundsException- when o is not in children list
-
remove
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:
removein interfaceList<GraphicsNode>- Parameters:
index- the position of the graphics node to remove- Returns:
- the graphics node that was removed
- Throws:
IndexOutOfBoundsException- if index out of range
-
removeAll
Not supported - ThrowsUnsupportedOperationExceptionexception.- Specified by:
removeAllin interfaceCollection<GraphicsNode>- Specified by:
removeAllin interfaceList<GraphicsNode>
-
retainAll
Not supported - ThrowsUnsupportedOperationExceptionexception.- Specified by:
retainAllin interfaceCollection<GraphicsNode>- Specified by:
retainAllin interfaceList<GraphicsNode>
-
clear
public void clear()Not supported - ThrowsUnsupportedOperationExceptionexception.- Specified by:
clearin interfaceCollection<GraphicsNode>- Specified by:
clearin interfaceList<GraphicsNode>
-
containsAll
Returns true if this composite graphics node contains all the graphics node in the specified collection, false otherwise.- Specified by:
containsAllin interfaceCollection<GraphicsNode>- Specified by:
containsAllin interfaceList<GraphicsNode>- Parameters:
c- the collection to be checked for containment
-
indexOf
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:
indexOfin interfaceList<GraphicsNode>- Parameters:
node- the graphics node to search for
-
lastIndexOf
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:
lastIndexOfin interfaceList<GraphicsNode>- Parameters:
node- the graphics node to search for
-
listIterator
Returns an iterator over the children of this graphics node.- Specified by:
listIteratorin interfaceList<GraphicsNode>
-
listIterator
Returns an iterator over the children of this graphics node, starting at the specified position in the children list.- Specified by:
listIteratorin interfaceList<GraphicsNode>- Parameters:
index- the index of the first graphics node to return from the children list
-
subList
Not supported - ThrowsUnsupportedOperationExceptionexception.- Specified by:
subListin interfaceList<GraphicsNode>
-
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.
-