org.vectomatic.dom.svg
Class OMSVGElementInstance

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.dom.client.EventTarget
          extended by org.vectomatic.dom.svg.OMSVGElementInstance

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')
 


Constructor Summary
protected OMSVGElementInstance()
           
 
Method Summary
 OMSVGElementInstanceList getChildNodes()
          An OMSVGElementInstanceList that contains all children of this OMSVGElementInstance within the instance tree.
 OMSVGElement getCorrespondingElement()
          The corresponding element to which this object is an instance.
 OMSVGUseElement getCorrespondingUseElement()
          The corresponding use element to which this OMSVGElementInstance object belongs.
 OMSVGElementInstance getFirstChild()
          The first child of this OMSVGElementInstance within the instance tree.
 OMSVGElementInstance getLastChild()
          The last child of this OMSVGElementInstance within the instance tree.
 OMSVGElementInstance getNextSibling()
          The OMSVGElementInstance immediately following this OMSVGElementInstance.
 OMSVGElementInstance getParentNode()
          The parent of this OMSVGElementInstance within the instance tree.
 OMSVGElementInstance getPreviousSibling()
          The OMSVGElementInstance immediately preceding this OMSVGElementInstance.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OMSVGElementInstance

protected OMSVGElementInstance()
Method Detail

getCorrespondingElement

public final OMSVGElement getCorrespondingElement()
The corresponding element to which this object is an instance. For example, if a use element references a rect element, then an OMSVGElementInstance is created, with its getCorrespondingElement() being the OMSVGElementInstance object for the rect element.


getCorrespondingUseElement

public final OMSVGUseElement getCorrespondingUseElement()
The corresponding use element to which this 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).


getParentNode

public final OMSVGElementInstance getParentNode()
The parent of this 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.


getChildNodes

public final OMSVGElementInstanceList getChildNodes()
An 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).


getFirstChild

public final OMSVGElementInstance getFirstChild()
The first child of this OMSVGElementInstance within the instance tree. If there is no such OMSVGElementInstance, this returns null.


getLastChild

public final OMSVGElementInstance getLastChild()
The last child of this OMSVGElementInstance within the instance tree. If there is no such OMSVGElementInstance, this returns null.


getPreviousSibling

public final OMSVGElementInstance getPreviousSibling()
The OMSVGElementInstance immediately preceding this OMSVGElementInstance. If there is no such OMSVGElementInstance, this returns null.


getNextSibling

public final OMSVGElementInstance getNextSibling()
The OMSVGElementInstance immediately following this OMSVGElementInstance. If there is no such OMSVGElementInstance, this returns null.



Copyright © 2012. All Rights Reserved.