com.icesoft.faces.context

## Class DOMContext

- java.lang.Object
- - com.icesoft.faces.context.DOMContext

- All Implemented Interfaces:
    java.io.Serializable

      public class DOMContext
      extends java.lang.Object
      implements java.io.Serializable

  DOMContext provides a component specific interface to the DOM renderer

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DOMContext(org.icefaces.impl.context.DOMResponseWriter writer, org.w3c.dom.Document document, org.w3c.dom.Node parentElement)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DOMContext` | `attachDOMContext(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)` This method returns the DOMContext associated with the specified component.
    `org.w3c.dom.Element` | `createElement(java.lang.String name)` Creates an element of the type specified.
    `org.w3c.dom.Element` | `createRootElement(java.lang.String name)` Creates an element of the type specified.
    `org.w3c.dom.Text` | `createTextNode(java.lang.String cData)` Creates a `Text` node given the specified string.
    `org.w3c.dom.Text` | `createTextNodeUnescaped(java.lang.String cData)` Creates a `Text` node given the specified string.
    `static void` | `enableOnElementUpdateNotify(org.w3c.dom.Element element, java.lang.String id)`
    `static java.util.List` | `findChildrenWithNodeName(org.w3c.dom.Element root, java.lang.String nodeName)`
    `org.w3c.dom.Node` | `getCursorParent()` Get the position in the document where the next DOM node will be rendererd.
    `org.w3c.dom.Document` | `getDocument()` Retrieve the org.w3c.dom.Document instance associated with this DOMContext
    `static DOMContext` | `getDOMContext(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)` Get the DOMContext associated with the component.
    `static java.util.Map` | `getDOMContexts(javax.faces.context.FacesContext facesContext)`
    `org.w3c.dom.Node` | `getRootNode()` Get the rootNode member variable.
    `boolean` | `isInitialized()` Determine whether this instance is initialized.
    `static DOMContext` | `reattachDOMContext(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)`
    `static void` | `removeChildren(org.w3c.dom.Node parent)` Remove all children from Node parent
    `static void` | `removeChildrenByTagName(org.w3c.dom.Element rootElement, java.lang.String name)` Removes from the root element all children with node name equal to the nodeName parameter
    `void` | `setCursorParent(org.w3c.dom.Node cursorParent)` Set the position at which the next rendered node will be appended
    `void` | `setRootNode(org.w3c.dom.Node rootNode)` Set the rootNode member variable to the parameter Node.
    `void` | `stepInto(javax.faces.component.UIComponent component)` Maintain the cursor and cursor such that the next rendered component will be rendered as a child of the parameter component.
    `void` | `stepOver()` Maintain the cursor and cursor position; step to the position where the next sibling should be rendered.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DOMContext

          protected DOMContext(org.icefaces.impl.context.DOMResponseWriter writer,
                               org.w3c.dom.Document document,
                               org.w3c.dom.Node parentElement)

  - ### Method Detail

    - #### isInitialized

          public boolean isInitialized()

      Determine whether this instance is initialized. An initialized instance is guaranteed to have a root node.

      Returns:
        boolean reflecting whether this instance is initialized.

    - #### attachDOMContext

          public static DOMContext attachDOMContext(javax.faces.context.FacesContext facesContext,
                                                    javax.faces.component.UIComponent component)

      This method returns the DOMContext associated with the specified component.

      Parameters:
        `facesContext` - an instance of `FacesContext` associated with the lifecycle
        `component` - component associated with this `DOMContext`
      Returns:
        the attached `DOMContext`

    - #### reattachDOMContext

          public static DOMContext reattachDOMContext(javax.faces.context.FacesContext facesContext,
                                                      javax.faces.component.UIComponent component)

    - #### getDOMContexts

          public static java.util.Map getDOMContexts(javax.faces.context.FacesContext facesContext)

    - #### getDOMContext

          public static DOMContext getDOMContext(javax.faces.context.FacesContext facesContext,
                                                 javax.faces.component.UIComponent component)

      Get the DOMContext associated with the component. Do not attach the DOMContext instance to its parent element.

      Parameters:
        `facesContext` -
        `component` - the `UIComponent` instance whose DOMContext we are retrieving
      Returns:
        `DOMContext`

    - #### createElement

          public org.w3c.dom.Element createElement(java.lang.String name)

      Creates an element of the type specified. Note that the instance returned implements the `Element` interface, so attributes can be specified directly on the returned object.
      In addition, if there are known attributes with default values, `Attr` nodes representing them are automatically created and attached to the element.

      Parameters:
        `name` - the specified Element type to create
      Returns:
        the created element

    - #### createTextNode

          public org.w3c.dom.Text createTextNode(java.lang.String cData)

      Creates a `Text` node given the specified string. The output is escaped.
      Parameters:
        `cData` - The data for the node.
      Returns:
        The new `Text` object.

    - #### createTextNodeUnescaped

          public org.w3c.dom.Text createTextNodeUnescaped(java.lang.String cData)

      Creates a `Text` node given the specified string. The output is not escaped, so the calling code must be carefully audited to ensure that application data is not passed in directly.
      Parameters:
        `cData` - The data for the node.
      Returns:
        The new `Text` object.

    - #### setRootNode

          public void setRootNode(org.w3c.dom.Node rootNode)

      Set the rootNode member variable to the parameter Node.
      Parameters:
        `rootNode` -

    - #### createRootElement

          public org.w3c.dom.Element createRootElement(java.lang.String name)

      Creates an element of the type specified. Note that the instance returned implements the `Element` interface, so attributes can be specified directly on the returned object.
      In addition, if there are known attributes with default values, `Attr` nodes representing them are automatically created and attached to the element. Set the rootNode member variable of this instance to the newly-created Element.
      Parameters:
        `name` -
      Returns:
        Element

    - #### getRootNode

          public org.w3c.dom.Node getRootNode()

      Get the rootNode member variable.

      Returns:
        rootNode the root node of this `DOMContext` instance

    - #### setCursorParent

          public void setCursorParent(org.w3c.dom.Node cursorParent)

      Set the position at which the next rendered node will be appended
      Parameters:
        `cursorParent` -

    - #### getCursorParent

          public org.w3c.dom.Node getCursorParent()

      Get the position in the document where the next DOM node will be rendererd.

    - #### stepOver

          public void stepOver()

      Maintain the cursor and cursor position; step to the position where the next sibling should be rendered.

    - #### stepInto

          public void stepInto(javax.faces.component.UIComponent component)

      Maintain the cursor and cursor such that the next rendered component will be rendered as a child of the parameter component.
      Parameters:
        `component` -

    - #### getDocument

          public org.w3c.dom.Document getDocument()

      Retrieve the org.w3c.dom.Document instance associated with this DOMContext
      Returns:
        Document

    - #### removeChildren

          public static void removeChildren(org.w3c.dom.Node parent)

      Remove all children from Node parent
      Parameters:
        `parent` - - the root node to remove

    - #### removeChildrenByTagName

          public static void removeChildrenByTagName(org.w3c.dom.Element rootElement,
                                                     java.lang.String name)

      Removes from the root element all children with node name equal to the nodeName parameter
      Parameters:
        `rootElement` -
        `name` -

    - #### findChildrenWithNodeName

          public static java.util.List findChildrenWithNodeName(org.w3c.dom.Element root,
                                                                java.lang.String nodeName)

    - #### enableOnElementUpdateNotify

          public static void enableOnElementUpdateNotify(org.w3c.dom.Element element,
                                                         java.lang.String id)

Copyright 2025 ICEsoft Technologies Canada, Corp. All Rights Reserved.