Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.dom.client
Class Node

    java.lang.Object
      com.google.gwt.core.client.JavaScriptObject
          com.google.gwt.dom.client.Node

Direct Known Subclasses:
  Document, Element, Text

    public class Node

extends JavaScriptObject

The Node interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing the Node interface expose methods for dealing with children, not all objects implementing the Node interface may have children.

Field Summary
`static short` | `DOCUMENT_NODE` The node is a `Document`.
`static short` | `ELEMENT_NODE` The node is an `Element`.
`static short` | `TEXT_NODE` The node is a `Text` node.

Constructor Summary
`protected` | `Node()`

Method Summary
`
`<T extends Node> T`
` | `appendChild(T newChild)` Adds the node newChild to the end of the list of children of this node.
`static Node` | `as(JavaScriptObject o)` Assert that the given `JavaScriptObject` is a DOM node and automatically typecast it.
`Node` | `cloneNode(boolean deep)` Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
`NodeList<Node>` | `getChildNodes()` A NodeList that contains all children of this node.
`Node` | `getFirstChild()` The first child of this node.
`Node` | `getLastChild()` The last child of this node.
`Node` | `getNextSibling()` The node immediately following this node.
`java.lang.String` | `getNodeName()` The name of this node, depending on its type; see the table above.
`short` | `getNodeType()` A code representing the type of the underlying object, as defined above.
`java.lang.String` | `getNodeValue()` The value of this node, depending on its type; see the table above.
`Document` | `getOwnerDocument()` The Document object associated with this node.
`Node` | `getParentNode()` The parent of this node.
`Node` | `getPreviousSibling()` The node immediately preceding this node.
`boolean` | `hasChildNodes()` Returns whether this node has any children.
`Node` | `insertBefore(Node newChild, Node refChild)` Inserts the node newChild before the existing child node refChild.
`static boolean` | `is(JavaScriptObject o)` Determines whether the given `JavaScriptObject` is a DOM node.
`Node` | `removeChild(Node oldChild)` Removes the child node indicated by oldChild from the list of children, and returns it.
`Node` | `replaceChild(Node newChild, Node oldChild)` Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
`void` | `setNodeValue(java.lang.String nodeValue)` The value of this node, depending on its type; see the table above.

Methods inherited from class com.google.gwt.core.client.JavaScriptObject
`cast, createArray, createFunction, createObject, equals, hashCode, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### ELEMENT_NODE

    public static final short ELEMENT_NODE

  The node is an `Element`.

  See Also:
    Constant Field Values

### TEXT_NODE

    public static final short TEXT_NODE

  The node is a `Text` node.

  See Also:
    Constant Field Values

### DOCUMENT_NODE

    public static final short DOCUMENT_NODE

  The node is a `Document`.

  See Also:
    Constant Field Values

Constructor Detail

### Node

    protected Node()

Method Detail

### as

    public static Node as(JavaScriptObject o)

  Assert that the given `JavaScriptObject` is a DOM node and automatically typecast it.

### is

    public static boolean is(JavaScriptObject o)

  Determines whether the given `JavaScriptObject` is a DOM node. A `null` object will cause this method to return `false`.

### appendChild

    public final <T extends Node> T appendChild(T newChild)

  Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

  Parameters:
    `newChild` - The node to add
  Returns:
    The node added

### cloneNode

    public final Node cloneNode(boolean deep)

  Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent; (parentNode is null.). Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning an Attribute directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute (specified is true). Cloning any other type of node simply returns a copy of this node.

  Parameters:
    `deep` - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an `Element`)
  Returns:
    The duplicate node

### getChildNodes

    public final NodeList<Node> getChildNodes()

  A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.

### getFirstChild

    public final Node getFirstChild()

  The first child of this node. If there is no such node, this returns null.

### getLastChild

    public final Node getLastChild()

  The last child of this node. If there is no such node, this returns null.

### getNextSibling

    public final Node getNextSibling()

  The node immediately following this node. If there is no such node, this returns null.

### getNodeName

    public final java.lang.String getNodeName()

  The name of this node, depending on its type; see the table above.

### getNodeType

    public final short getNodeType()

  A code representing the type of the underlying object, as defined above.

### getNodeValue

    public final java.lang.String getNodeValue()

  The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect.

### getOwnerDocument

    public final Document getOwnerDocument()

  The Document object associated with this node. This is also the `Document` object used to create new nodes.

### getParentNode

    public final Node getParentNode()

  The parent of this node. All nodes except Document may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.

### getPreviousSibling

    public final Node getPreviousSibling()

  The node immediately preceding this node. If there is no such node, this returns null.

### hasChildNodes

    public final boolean hasChildNodes()

  Returns whether this node has any children.

### insertBefore

    public final Node insertBefore(Node newChild,
                                   Node refChild)

  Inserts the node newChild before the existing child node refChild. If refChild is `null`, insert newChild at the end of the list of children.

  Parameters:
    `newChild` - The node to insert
    `refChild` - The reference node (that is, the node before which the new node must be inserted), or `null`
  Returns:
    The node being inserted

### removeChild

    public final Node removeChild(Node oldChild)

  Removes the child node indicated by oldChild from the list of children, and returns it.

  Parameters:
    `oldChild` - The node being removed
  Returns:
    The node removed

### replaceChild

    public final Node replaceChild(Node newChild,
                                   Node oldChild)

  Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

  Parameters:
    `newChild` - The new node to put in the child list
    `oldChild` - The node being replaced in the list
  Returns:
    The node replaced

### setNodeValue

    public final void setNodeValue(java.lang.String nodeValue)

  The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD