Class NodeImpl

All Implemented Interfaces:
Cloneable, EventTarget, ModelNode, Node, ScriptableDelegate
Direct Known Subclasses:
AttrImpl, CharacterDataImpl, DocumentFragmentImpl, DocumentImpl, DocumentTypeImpl, ElementImpl, EntityReferenceImpl, NotationImpl

public abstract class NodeImpl extends EventTargetImpl implements Node, ModelNode, Cloneable

Abstract NodeImpl class.

  • Field Details

    • document

      protected volatile Document document
    • nodeList

      protected final NodeListImpl nodeList
    • notificationsSuspended

      protected volatile boolean notificationsSuspended
    • parentNode

      protected volatile Node parentNode
    • uiNode

      protected UINode uiNode
  • Constructor Details

    • NodeImpl

      public NodeImpl()

      Constructor for NodeImpl.

  • Method Details

    • appendChild

      public Node appendChild(Node newChild)

      appendChild.

      Specified by:
      appendChild in interface Node
      Parameters:
      newChild - a Node object.
      Returns:
      a Node object.
    • prependChild

      public Node prependChild(Node newChild)

      prependChild.

      Specified by:
      prependChild in interface Node
      Parameters:
      newChild - a Node object.
      Returns:
      a Node object.
    • prepend

      public Node prepend(Node newChild)

      prepend.

      Specified by:
      prepend in interface Node
      Parameters:
      newChild - a Node object.
      Returns:
      a Node object.
    • appendInnerHTMLImpl

      protected void appendInnerHTMLImpl(StringBuilder buffer)

      appendInnerHTMLImpl.

      Parameters:
      buffer - a StringBuilder object.
    • appendInnerTextImpl

      protected void appendInnerTextImpl(StringBuilder buffer)

      appendInnerTextImpl.

      Parameters:
      buffer - a StringBuilder object.
    • cloneNode

      public Node cloneNode()

      cloneNode.

      Specified by:
      cloneNode in interface Node
      Returns:
      a Node object.
    • cloneNode

      public Node cloneNode(boolean deep)
      Returns a copy of node. If deep is true, the copy also includes the node's descendants.
      Specified by:
      cloneNode in interface Node
      Parameters:
      deep - a boolean.
      Returns:
      a Node object.
    • contains

      public boolean contains(Node other)
      Returns true if other is an inclusive descendant of node, and false otherwise.
      Specified by:
      contains in interface Node
      Parameters:
      other - a Node object.
      Returns:
      a boolean.
    • isSupported

      public boolean isSupported(String feature, String version)
      Specified by:
      isSupported in interface Node
    • compareDocumentPosition

      public short compareDocumentPosition(Node other)

      compareDocumentPosition.

      Specified by:
      compareDocumentPosition in interface Node
      Parameters:
      other - a Node object.
      Returns:
      a short.
    • createRenderState

      protected RenderState createRenderState(RenderState prevRenderState)

      createRenderState.

      Parameters:
      prevRenderState - a RenderState object.
      Returns:
      a RenderState object.
    • getAttributes

      public NamedNodeMap getAttributes()
      Description copied from interface: Node

      getAttributes.

      Specified by:
      getAttributes in interface Node
      Returns:
      a NamedNodeMap object.
    • findUINode

      public UINode findUINode()
      Tries to get a UINode associated with the current node. Failing that, it tries ancestors recursively. This method will return the closest block-level renderer node, if any.
      Returns:
      a UINode object.
    • forgetRenderState

      protected void forgetRenderState()

      forgetRenderState.

    • getBaseURI

      public String getBaseURI()
      Returns node's node document's document base URL.
      Specified by:
      getBaseURI in interface Node
      Returns:
      a String object.
    • getChildIndex

      public int getChildIndex(Node child)

      getChildIndex.

      Parameters:
      child - a Node object.
      Returns:
      a Integer object.
    • getChildNodes

      public NodeList getChildNodes()
      Returns the children.
      Specified by:
      getChildNodes in interface Node
      Returns:
      a NodeList object.
    • getChildren

      public HTMLCollection getChildren()

      getChildren.

      Returns:
      a HTMLCollection object.
    • getDescendents

      public NodeList getDescendents(NodeFilter filter, boolean nestIntoMatchingNodes)
      Creates an NodeList of descendent nodes that the given filter condition.
      Parameters:
      filter - a NodeFilter object.
      nestIntoMatchingNodes - a boolean.
      Returns:
      a NodeList object.
    • getDocumentItem

      public Object getDocumentItem(String name)

      getDocumentItem.

      Specified by:
      getDocumentItem in interface ModelNode
      Parameters:
      name - a String object.
      Returns:
      a Object object.
    • getDocumentURL

      public URL getDocumentURL()

      getDocumentURL.

      Returns:
      a URL object.
    • getFirstChild

      public Node getFirstChild()
      Returns the first child.
      Specified by:
      getFirstChild in interface Node
      Returns:
      a Node object.
    • getFirstChildByFilter

      public Node getFirstChildByFilter(NodeFilter filter)

      getFirstChildByFilter.

      Parameters:
      filter - a NodeFilter object.
      Returns:
      a Node object.
    • getFullURL

      public URL getFullURL(String spec) throws Exception

      getFullURL.

      Specified by:
      getFullURL in interface ModelNode
      Parameters:
      spec - a String object.
      Returns:
      a URL object.
      Throws:
      Exception - if any.
    • getHtmlRendererContext

      public HtmlRendererContext getHtmlRendererContext()

      getHtmlRendererContext.

      Returns:
      a HtmlRendererContext object.
    • getHtmlRendererConfig

      public HtmlRendererConfig getHtmlRendererConfig()

      getHtmlRendererContext.

      Returns:
      a HtmlRendererConfig object.
    • getLastChild

      public Node getLastChild()
      Returns the last child.
      Specified by:
      getLastChild in interface Node
      Returns:
      a Node object.
    • getLocalName

      public abstract String getLocalName()

      getLocalName.

      Specified by:
      getLocalName in interface Node
      Returns:
      a String object.
    • getNamespaceURI

      public String getNamespaceURI()

      getNamespaceURI.

      Specified by:
      getNamespaceURI in interface Node
      Returns:
      a String object.
    • getNextSibling

      public Node getNextSibling()
      Returns the next sibling.
      Specified by:
      getNextSibling in interface Node
      Returns:
      a Node object.
    • getNextElementSibling

      public Element getNextElementSibling()

      getNextElementSibling.

      Returns:
      a Element object.
    • getNodeList

      public NodeList getNodeList(NodeFilter filter)

      Getter for the field nodeList.

      Parameters:
      filter - a NodeFilter object.
      Returns:
      a NodeList object.
    • getNodeName

      public abstract String getNodeName()
      Returns a string appropriate for the type of node.
      Specified by:
      getNodeName in interface Node
      Returns:
      a String object.
    • getNodeType

      public abstract int getNodeType()
      Returns the type of node.
      Specified by:
      getNodeType in interface Node
      Returns:
      a Integer object.
    • getNodeValue

      public abstract String getNodeValue() throws DOMException

      getNodeValue.

      Specified by:
      getNodeValue in interface Node
      Returns:
      a String object.
      Throws:
      DOMException
    • getOwnerDocument

      public Document getOwnerDocument()
      Returns the node document. Returns null for documents.
      Specified by:
      getOwnerDocument in interface Node
      Returns:
      a Document object.
    • getParentModelNode

      public final ModelNode getParentModelNode()

      getParentModelNode.

      Specified by:
      getParentModelNode in interface ModelNode
      Returns:
      a ModelNode object.
    • getParentNode

      public Node getParentNode()
      Returns the parent.
      Specified by:
      getParentNode in interface Node
      Returns:
      a Node object.
    • getParentElement

      public HTMLElement getParentElement()
      Returns the parent element.
      Specified by:
      getParentElement in interface Node
      Returns:
      a HTMLElement object.
    • getParentRenderState

      protected final RenderState getParentRenderState(Object parent)

      getParentRenderState.

      Parameters:
      parent - a Object object.
      Returns:
      a RenderState object.
    • getPrefix

      public String getPrefix()
      Returns prefix.
      Specified by:
      getPrefix in interface Node
      Returns:
      a String object.
    • getPreviousSibling

      public Node getPreviousSibling()
      Returns the previous sibling.
      Specified by:
      getPreviousSibling in interface Node
      Returns:
      a Node object.
    • getPreviousElementSibling

      public Element getPreviousElementSibling()

      getPreviousElementSibling.

      Returns:
      a Element object.
    • getRenderState

      public RenderState getRenderState()

      getRenderState.

      Specified by:
      getRenderState in interface ModelNode
      Returns:
      a RenderState object.
    • getTextContent

      public String getTextContent()

      getTextContent.

      Gets the text content of this node and its descendents.
      Specified by:
      getTextContent in interface Node
      Returns:
      a String object.
    • getUINode

      public UINode getUINode()

      getUINode.

      Returns:
      a UINode object.
    • getUserAgentContext

      public UserAgentContext getUserAgentContext()

      getUserAgentContext.

      Returns:
      a UserAgentContext object.
    • getUserData

      public Object getUserData(String key)

      getUserData.

      Specified by:
      getUserData in interface Node
      Parameters:
      key - a String object.
      Returns:
      a Object object.
    • hasChildNodes

      public boolean hasChildNodes()
      Returns whether node has children.
      Specified by:
      hasChildNodes in interface Node
      Returns:
      a boolean.
    • htmlEncodeChildText

      protected String htmlEncodeChildText(String text)

      htmlEncodeChildText.

      Parameters:
      text - a String object.
      Returns:
      a String object.
    • informInvalid

      public void informInvalid()

      informInvalid.

    • informLayoutInvalid

      public void informLayoutInvalid()

      informLayoutInvalid.

    • informLookInvalid

      public void informLookInvalid()

      informLookInvalid.

    • informNodeLoaded

      protected void informNodeLoaded()

      informNodeLoaded.

    • informPositionInvalid

      public void informPositionInvalid()

      informPositionInvalid.

    • informSizeInvalid

      public void informSizeInvalid()

      informSizeInvalid.

    • informStructureInvalid

      public void informStructureInvalid()

      informStructureInvalid.

    • getDocumentNode

      public Document getDocumentNode()

      getDocumentNode.

      Returns:
      the document
    • insertAfter

      public Node insertAfter(Node newChild, Node refChild)

      insertAfter.

      Parameters:
      newChild - a Node object.
      refChild - a Node object.
      Returns:
      a Node object.
    • insertAt

      protected Node insertAt(Node newChild, int idx)

      insertAt.

      Parameters:
      newChild - a Node object.
      idx - a Integer object.
      Returns:
      a Node object.
      Throws:
      DOMException - if any.
    • insertBefore

      public Node insertBefore(Node newChild, Node refChild)

      insertBefore.

      Specified by:
      insertBefore in interface Node
      Parameters:
      newChild - a Node object.
      refChild - a Node object.
      Returns:
      a Node object.
    • isDefaultNamespace

      public boolean isDefaultNamespace(String namespaceURI)

      isDefaultNamespace.

      Specified by:
      isDefaultNamespace in interface Node
      Parameters:
      namespaceURI - a String object.
      Returns:
      a boolean.
    • isEqualNode

      public boolean isEqualNode(Node arg)
      Returns whether node and otherNode have the same properties.
      Specified by:
      isEqualNode in interface Node
      Parameters:
      arg - a Node object.
      Returns:
      a boolean.
    • isEqualOrDescendentOf

      public final boolean isEqualOrDescendentOf(ModelNode otherContext)

      isEqualOrDescendentOf.

      Specified by:
      isEqualOrDescendentOf in interface ModelNode
      Parameters:
      otherContext - a ModelNode object.
      Returns:
      a boolean.
    • isSameNode

      public boolean isSameNode(Node other)

      isSameNode.

      Specified by:
      isSameNode in interface Node
      Parameters:
      other - a Node object.
      Returns:
      a boolean.
    • lookupNamespaceURI

      public String lookupNamespaceURI(String prefix)

      lookupNamespaceURI.

      Specified by:
      lookupNamespaceURI in interface Node
      Parameters:
      prefix - a String object.
      Returns:
      a String object.
    • lookupPrefix

      public String lookupPrefix(String namespaceURI)

      lookupPrefix.

      Specified by:
      lookupPrefix in interface Node
      Parameters:
      namespaceURI - a String object.
      Returns:
      a String object.
    • normalize

      public void normalize()
      Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
      Specified by:
      normalize in interface Node
    • removeChild

      public Node removeChild(Node oldChild)

      removeChild.

      Specified by:
      removeChild in interface Node
      Parameters:
      oldChild - a Node object.
      Returns:
      a Node object.
    • removeChildAt

      public Node removeChildAt(int index)

      removeChildAt.

      Parameters:
      index - a Integer object.
      Returns:
      a Node object.
      Throws:
      DOMException - if any.
    • removeTableChildren

      protected void removeTableChildren(NodeFilter filter)

      removeChildren.

      Parameters:
      filter - a NodeFilter object.
    • removeChildrenImpl

      protected void removeChildrenImpl(NodeFilter filter)

      removeChildrenImpl.

      Parameters:
      filter - a NodeFilter object.
    • replaceAdjacentTextNodes

      public Text replaceAdjacentTextNodes(Text node, String textContent)

      replaceAdjacentTextNodes.

      Parameters:
      node - a Text object.
      textContent - a String object.
      Returns:
      a Text object.
    • replaceChild

      public Node replaceChild(Node newChild, Node oldChild)

      replaceChild.

      Specified by:
      replaceChild in interface Node
      Parameters:
      newChild - a Node object.
      oldChild - a Node object.
      Returns:
      a Node object.
    • setDocumentItem

      public void setDocumentItem(String name, Object value)
      Sets a document item. A radio button, for example, can use this to set button group state.
      Specified by:
      setDocumentItem in interface ModelNode
      Parameters:
      name - a String object.
      value - a Object object.
    • setNodeValue

      public abstract void setNodeValue(String nodeValue) throws DOMException

      setNodeValue.

      Specified by:
      setNodeValue in interface Node
      Parameters:
      nodeValue - a String object.
      Throws:
      DOMException
    • setOwnerDocument

      public void setOwnerDocument(Document value)

      setOwnerDocument.

      Specified by:
      setOwnerDocument in interface Node
      Parameters:
      value - a Document object.
    • setOwnerDocument

      public void setOwnerDocument(Document value, boolean deep)

      setOwnerDocument.

      Parameters:
      value - a Document object.
      deep - a boolean.
    • setParentImpl

      public final void setParentImpl(Node parent)

      setParentImpl.

      Parameters:
      parent - a Node object.
    • setPrefix

      public void setPrefix(String prefix) throws DOMException

      setPrefix.

      Specified by:
      setPrefix in interface Node
      Parameters:
      prefix - a String object.
      Throws:
      DOMException
    • setTextContent

      public void setTextContent(String textContent)

      setTextContent.

      Specified by:
      setTextContent in interface Node
      Parameters:
      textContent - a String object.
    • setUINode

      public void setUINode(UINode uiNode)

      setUINode.

      Parameters:
      uiNode - a UINode object.
    • setUserData

      public Object setUserData(String key, Object data, UserDataHandler handler)

      setUserData.

      Specified by:
      setUserData in interface Node
      Parameters:
      key - a String object.
      data - a Object object.
      handler - a UserDataHandler object.
      Returns:
      a Object object.
    • isIsConnected

      public boolean isIsConnected()
      Returns true if node is connected and false otherwise.
      Specified by:
      isIsConnected in interface Node
      Returns:
      a boolean.
    • getRootNode

      public Node getRootNode()
      Returns node's root.
      Specified by:
      getRootNode in interface Node
      Returns:
      a Node object.
    • getFeature

      public Node getFeature(String feature, String version)
      Specified by:
      getFeature in interface Node
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • visit

      public void visit(NodeVisitor visitor)

      visit.

      Parameters:
      visitor - a NodeVisitor object.
    • visitImpl

      protected void visitImpl(NodeVisitor visitor)

      visitImpl.

      Parameters:
      visitor - a NodeVisitor object.
    • warn

      public void warn(String message)

      warn.

      Parameters:
      message - a String object.
    • warn

      public void warn(String message, Throwable err)

      warn.

      Specified by:
      warn in interface ModelNode
      Parameters:
      message - a String object.
      err - a Throwable object.
    • clone

      public Node clone()
      Overrides:
      clone in class Object
    • getNONE

      public short getNONE()
    • getELEMENT_NODE

      public short getELEMENT_NODE()
    • getATTRIBUTE_NODE

      public short getATTRIBUTE_NODE()
    • getTEXT_NODE

      public short getTEXT_NODE()
    • getCDATA_SECTION_NODE

      public short getCDATA_SECTION_NODE()
    • getENTITY_REFERENCE_NODE

      public short getENTITY_REFERENCE_NODE()
    • getENTITY_NODE

      public short getENTITY_NODE()
    • getPROCESSING_INSTRUCTION_NODE

      public short getPROCESSING_INSTRUCTION_NODE()
    • getCOMMENT_NODE

      public short getCOMMENT_NODE()
    • getDOCUMENT_NODE

      public short getDOCUMENT_NODE()
    • getDOCUMENT_TYPE_NODE

      public short getDOCUMENT_TYPE_NODE()
    • getDOCUMENT_FRAGMENT_NODE

      public short getDOCUMENT_FRAGMENT_NODE()
    • getNOTATION_NODE

      public short getNOTATION_NODE()
    • getDOCUMENT_POSITION_DISCONNECTED

      public short getDOCUMENT_POSITION_DISCONNECTED()
    • getDOCUMENT_POSITION_PRECEDING

      public short getDOCUMENT_POSITION_PRECEDING()
    • getDOCUMENT_POSITION_FOLLOWING

      public short getDOCUMENT_POSITION_FOLLOWING()
    • getDOCUMENT_POSITION_CONTAINS

      public short getDOCUMENT_POSITION_CONTAINS()
    • getDOCUMENT_POSITION_CONTAINED_BY

      public short getDOCUMENT_POSITION_CONTAINED_BY()
    • getDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

      public short getDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC()