|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.thymeleaf.dom.Node org.thymeleaf.dom.NestableNode
public abstract class NestableNode
Base abstract class for all nodes in a Thymeleaf DOM tree which have children.
Field Summary |
---|
Fields inherited from class org.thymeleaf.dom.Node |
---|
NODE_PROPERTY_XML_ENCODING, NODE_PROPERTY_XML_STANDALONE, NODE_PROPERTY_XML_VERSION |
Method Summary | |
---|---|
void |
addChild(Node newChild)
Adds a new child to the node. |
void |
clearChildren()
Removes all the children nodes. |
void |
extractChild(Node child)
Extracts a child by removing it from the DOM tree and lifting all of its children one level, so that they become children nodes of this node. |
java.util.List<Node> |
getChildren()
Returns the children of this node. |
java.util.List<Element> |
getElementChildren()
Returns the only the Element children
of this node, discarding children of any other types. |
Node |
getFirstChild()
Returns the first child of this node. |
Element |
getFirstElementChild()
Returns the first child of type Element . |
boolean |
hasChildren()
Returns whether this node has any children. |
void |
insertAfter(Node existingChild,
Node newChild)
Adds a new children to the node, positioned just after another child node that is also specified. |
void |
insertBefore(Node existingChild,
Node newChild)
Adds a new children to the node, positioned just before another child node that is also specified. |
void |
insertChild(int index,
Node newChild)
Adds a new child to the node, at a specific position. |
void |
moveAllChildren(NestableNode newParent)
Refactors a DOM tree by moving all the children of this node to another (which will be their new parent node). |
int |
numChildren()
Returns the number of children in this node. |
void |
removeChild(int index)
Removes a node child at a specific position. |
void |
removeChild(Node child)
Removes a specific child node from this node. |
void |
setChildren(java.util.List<Node> newChildren)
Sets the new children of the node to the specified list. |
Node[] |
unsafeGetChildrenNodeArray()
Returns the real, unsafe, inner array of node children. |
void |
visit(DOMVisitor visitor)
Apply a DOM visitor. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public final boolean hasChildren()
Returns whether this node has any children.
public final int numChildren()
Returns the number of children in this node.
public final java.util.List<Node> getChildren()
Returns the children of this node. The returned list is immutable.
public final java.util.List<Element> getElementChildren()
Returns the only the Element
children
of this node, discarding children of any other types.
The returned list is immutable.
public final Node[] unsafeGetChildrenNodeArray()
Returns the real, unsafe, inner array of node children. DO NOT use this method directly. Modifying this array could result in severe DOM corruption.
public final Node getFirstChild()
Returns the first child of this node.
public final Element getFirstElementChild()
Returns the first child of type Element
.
public void addChild(Node newChild)
Adds a new child to the node.
newChild
- the new child to be added.public final void insertChild(int index, Node newChild)
Adds a new child to the node, at a specific position.
All children nodes from that position are moved one position forward in order to make room for the new child.
index
- the position to insert the new child into.newChild
- the new child.public final void insertBefore(Node existingChild, Node newChild)
Adds a new children to the node, positioned just before another child node that is also specified.
This method is effectively equivalent to first searching
the existing child and then executing insertChild(int, Node)
specifying its position.
existingChild
- the child we want to insert the new child just before.newChild
- the new child.public final void insertAfter(Node existingChild, Node newChild)
Adds a new children to the node, positioned just after another child node that is also specified.
This method is effectively equivalent to first searching
the existing child and then executing insertChild(int, Node)
specifying its position + 1.
existingChild
- the child we want to insert the new child just after.newChild
- the new child.public final void setChildren(java.util.List<Node> newChildren)
Sets the new children of the node to the specified list.
newChildren
- the new chidren.public final void clearChildren()
Removes all the children nodes.
public final void removeChild(int index)
Removes a node child at a specific position.
index
- the position to be removed.public final void removeChild(Node child)
Removes a specific child node from this node.
child
- the child to be removed.public final void moveAllChildren(NestableNode newParent)
Refactors a DOM tree by moving all the children of this node to another (which will be their new parent node).
newParent
- the new parent.public final void extractChild(Node child)
Extracts a child by removing it from the DOM tree and lifting all of its children one level, so that they become children nodes of this node.
Node local variables, because of their hierarchical nature, are handled accordingly.
child
- the child to be extracted.public final void visit(DOMVisitor visitor)
Node
Apply a DOM visitor.
visit
in class Node
visitor
- the visitor to be executed for this node.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |