public class OMSVGElementInstance
extends com.google.gwt.dom.client.EventTarget
For each use element, the SVG DOM maintains
a shadow tree (the "instance tree") of objects of type OMSVGElementInstance
.
An OMSVGElementInstance
represents a single
node in the instance tree. The root object in the instance tree is pointed
to by the SVGUseElement.getInstanceRoot()
attribute on the SVGUseElement
object
for the corresponding use element.
If the use element references a simple graphics
element such as a rect, then there is only a single
OMSVGElementInstance
object, and the getCorrespondingElement()
attribute on this OMSVGElementInstance
object
is the SVGRectElement
that corresponds
to the referenced rect element.
If the use element references a g which contains two rect elements, then the instance
tree contains three OMSVGElementInstance
objects, a root OMSVGElementInstance
object
whose getCorrespondingElement()
is the SVGGElement
object for the g, and then two child OMSVGElementInstance
objects, each of which has its getCorrespondingElement()
that is an SVGRectElement
object.
If the referenced object is itself a use, or if there are use subelements within the referenced
object, the instance tree will contain recursive expansion of the indirect
references to form a complete tree. For example, if a use element references a g, and the g itself contains a use, and that use references a rect, then the instance tree for
the original (outermost) use will consist of a hierarchy of
OMSVGElementInstance
objects, as follows:
SVGElementInstance #1 (parentNode=null, firstChild=#2, correspondingElement is the 'g') SVGElementInstance #2 (parentNode=#1, firstChild=#3, correspondingElement is the other 'use') SVGElementInstance #3 (parentNode=#2, firstChild=null, correspondingElement is the 'rect')
Modifier | Constructor and Description |
---|---|
protected |
OMSVGElementInstance() |
public final OMSVGElement getCorrespondingElement()
OMSVGElementInstance
is created, with its getCorrespondingElement()
being the OMSVGElementInstance
object for
the rect element.public final OMSVGUseElement getCorrespondingUseElement()
OMSVGElementInstance
object belongs. When use elements are nested (e.g., a
use references another use which references a graphics element
such as a rect), then the getCorrespondingUseElement()
is the outermost use (i.e., the one which indirectly
references the rect, not the one with the direct
reference).public final OMSVGElementInstance getParentNode()
OMSVGElementInstance
within the instance tree. All OMSVGElementInstance
objects have a parent except the OMSVGElementInstance
which corresponds to the element which was directly referenced by the use element, in which case getParentNode()
is null.public final OMSVGElementInstanceList getChildNodes()
OMSVGElementInstanceList
that contains
all children of this OMSVGElementInstance
within the instance tree. If there are no children, this is an OMSVGElementInstanceList
containing no entries (i.e., an empty list).public final OMSVGElementInstance getFirstChild()
OMSVGElementInstance
within the instance tree. If there is no such OMSVGElementInstance
,
this returns null.public final OMSVGElementInstance getLastChild()
OMSVGElementInstance
within the instance tree. If there is no such OMSVGElementInstance
,
this returns null.public final OMSVGElementInstance getPreviousSibling()
OMSVGElementInstance
immediately preceding
this OMSVGElementInstance
. If there is no
such OMSVGElementInstance
, this returns
null.public final OMSVGElementInstance getNextSibling()
OMSVGElementInstance
immediately following
this OMSVGElementInstance
. If there is no
such OMSVGElementInstance
, this returns
null.Copyright © 2018. All Rights Reserved.