public abstract class AbstractMicroNode extends Object implements IMicroNode
| Constructor and Description |
|---|
AbstractMicroNode() |
| Modifier and Type | Method and Description |
|---|---|
IMicroCDATA |
appendCDATA(char[] aChars,
int nOfs,
int nLen)
Append a CDATA node to this node.
|
IMicroCDATA |
appendCDATA(CharSequence sText)
Append a CDATA node to this node.
|
IMicroCDATA |
appendCDATAWithConversion(Object aValue)
Append a CDATA node to this node.
|
<NODETYPE extends IMicroNode> |
appendChild(NODETYPE aChildNode)
Append any child to the node.
|
IMicroComment |
appendComment(char[] aChars,
int nOfs,
int nLen)
Append a comment node to this node.
|
IMicroComment |
appendComment(CharSequence sText)
Append a comment node to this node.
|
IMicroComment |
appendCommentWithConversion(Object aValue)
Append a comment node to this node.
|
IMicroContainer |
appendContainer()
Append a new container to this node
|
IMicroElement |
appendElement(String sTagName)
Append an element without namespace to this node.
|
IMicroElement |
appendElement(String sNamespaceURI,
String sTagName)
Append an element with namespace to this node.
|
IMicroEntityReference |
appendEntityReference(String sName)
Append an entity reference to this node.
|
IMicroText |
appendIgnorableWhitespaceText(char[] aChars,
int nOfs,
int nLen)
Append a text node which is ignorable whitespace content to this node.
|
IMicroText |
appendIgnorableWhitespaceText(CharSequence sText)
Append a text node which is ignorable whitespace content to this node.
|
IMicroProcessingInstruction |
appendProcessingInstruction(String sTarget,
String sData)
Append a processing instruction to this node.
|
IMicroText |
appendText(char[] aChars,
int nOfs,
int nLen)
Append a text node to this node.
|
IMicroText |
appendText(CharSequence sText)
Append a text node to this node.
|
IMicroText |
appendTextWithConversion(Object aValue)
Append a text node to this node.
|
IMicroNode |
detachFromParent()
Detach this node from the parent node so it can be inserted into another
node without problems.
|
ICommonsList<IMicroNode> |
getAllChildren()
Get a list of all direct child nodes.
|
ICommonsList<IMicroNode> |
getAllChildrenRecursive()
Recursively get all children.
|
ICommonsMap<EMicroEvent,ICommonsSet<IMicroEventTarget>> |
getAllEventTargets() |
ICommonsSet<IMicroEventTarget> |
getAllEventTargets(EMicroEvent eEvent)
Get all event targets for a certain event.
|
IMicroNode |
getChildAtIndex(int nIndex)
Get the child node at the specified index
|
int |
getChildCount() |
IMicroNode |
getFirstChild()
Get the first child node or
null if no child is present |
IMicroNode |
getLastChild()
Get the last child node or
null if no child is present |
IMicroNode |
getNextSibling() |
IMicroNode |
getParent()
Get the parent object of this object.
|
IMicroElement |
getParentElementWithName(String sTagName) |
IMicroElement |
getParentElementWithName(String sNamespaceURI,
String sTagName) |
IMicroNode |
getPreviousSibling() |
boolean |
hasChildren() |
boolean |
hasParent() |
<NODETYPE extends IMicroNode> |
insertAfter(NODETYPE aChildNode,
IMicroNode aPredecessor)
Insert an existing node after a certain child node of this.
|
<NODETYPE extends IMicroNode> |
insertAtIndex(int nIndex,
NODETYPE aChildNode)
Insert an existing node as a child at the specified index.
|
<NODETYPE extends IMicroNode> |
insertBefore(NODETYPE aChildNode,
IMicroNode aSuccessor)
Insert an existing node before a certain child node of this.
|
boolean |
isCDATA() |
boolean |
isComment() |
boolean |
isContainer() |
boolean |
isDocument() |
boolean |
isDocumentType() |
boolean |
isElement() |
boolean |
isEntityReference() |
boolean |
isProcessingInstruction() |
boolean |
isText() |
protected void |
onAppendChild(AbstractMicroNode aChildNode)
Callback that is invoked once a child is to be appended.
|
protected void |
onEvent(EMicroEvent eEventType,
IMicroNode aSourceNode,
IMicroNode aTargetNode) |
protected void |
onInsertAfter(AbstractMicroNode aChildNode,
IMicroNode aPredecessor)
Callback that is invoked once a child is to be inserted after another
child.
|
protected void |
onInsertAtIndex(int nIndex,
AbstractMicroNode aChildNode)
Callback that is invoked once a child is to be inserted at the specified
index.
|
protected void |
onInsertBefore(AbstractMicroNode aChildNode,
IMicroNode aSuccessor)
Callback that is invoked once a child is to be inserted before another
child.
|
protected EChange |
onRemoveAllChildren()
Remove all children from this node.
|
protected EChange |
onRemoveChild(IMicroNode aChild)
Callback when a child is removed.
|
protected EChange |
onRemoveChildAtIndex(int nIndex)
Remove the child not at the specified index.
|
EChange |
registerEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Register a specific MicroDOM event listener.
|
EChange |
removeAllChildren()
Remove all children from this node.
|
EChange |
removeChild(IMicroNode aChild)
Remove the passed child.
|
EChange |
removeChildAtIndex(int nIndex)
Remove the child not at the specified index.
|
EChange |
replaceChild(IMicroNode aOldChild,
IMicroNode aNewChild)
Replace the passed old child with the new child.
|
String |
toString() |
EChange |
unregisterEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Unregister a specific MicroDOM event listener.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitappendCDATA, appendComment, appendIgnorableWhitespaceText, appendText, getNodeName, getNodeValue, getType, isEqualContentgetClonehasNoChildren@OverrideOnDemand protected void onAppendChild(@Nonnull AbstractMicroNode aChildNode)
aChildNode - The appended child node.@OverrideOnDemand protected void onInsertBefore(@Nonnull AbstractMicroNode aChildNode, @Nonnull IMicroNode aSuccessor)
aChildNode - The new child node to be inserted.aSuccessor - The node before which the new node will be inserted.@OverrideOnDemand protected void onInsertAfter(@Nonnull AbstractMicroNode aChildNode, @Nonnull IMicroNode aPredecessor)
aChildNode - The new child node to be inserted.aPredecessor - The node after which the new node will be inserted.@OverrideOnDemand protected void onInsertAtIndex(@Nonnegative int nIndex, @Nonnull AbstractMicroNode aChildNode)
nIndex - The index where the node should be inserted.aChildNode - The new child node to be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE appendChild(@Nullable NODETYPE aChildNode)
IMicroNodeappendChild in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The child node to append. May be null.null if the parameter was
null.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertBefore(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aSuccessor)
IMicroNodeinsertBefore in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aSuccessor - The node before which the new node will be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertAfter(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aPredecessor)
IMicroNodeinsertAfter in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aPredecessor - The node after which the new node will be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertAtIndex(@Nonnegative int nIndex, @Nullable NODETYPE aChildNode)
IMicroNodeinsertAtIndex in interface IMicroNodeNODETYPE - Parameter type == return typenIndex - The index to insert. Must be ≥ 0.aChildNode - The new child node to be inserted.@Nonnull public final IMicroText appendText(@Nullable CharSequence sText)
IMicroNodeappendText in interface IMicroNodesText - text to be added@Nonnull public final IMicroText appendText(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendText in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroText appendTextWithConversion(@Nullable Object aValue)
IMicroNodeString, the TypeConverter is
invoked to convert it to a String object.appendTextWithConversion in interface IMicroNodeaValue - text to be added@Nonnull public final IMicroText appendIgnorableWhitespaceText(@Nullable CharSequence sText)
IMicroNodeappendIgnorableWhitespaceText in interface IMicroNodesText - The whitespace content to be added.@Nonnull public final IMicroText appendIgnorableWhitespaceText(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendIgnorableWhitespaceText in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroCDATA appendCDATA(@Nullable CharSequence sText)
IMicroNodeappendCDATA in interface IMicroNodesText - CDATA text@Nonnull public final IMicroCDATA appendCDATA(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendCDATA in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroCDATA appendCDATAWithConversion(@Nullable Object aValue)
IMicroNodeString, the TypeConverter is
invoked to convert it to a String object.appendCDATAWithConversion in interface IMicroNodeaValue - CDATA to be added@Nonnull public final IMicroComment appendComment(@Nullable CharSequence sText)
IMicroNodeappendComment in interface IMicroNodesText - comment text@Nonnull public final IMicroComment appendComment(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendComment in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroComment appendCommentWithConversion(@Nullable Object aValue)
IMicroNodeString, the TypeConverter is
invoked to convert it to a String object.appendCommentWithConversion in interface IMicroNodeaValue - Comment to be added@Nonnull public final IMicroEntityReference appendEntityReference(@Nonnull @Nonempty String sName)
IMicroNodeappendEntityReference in interface IMicroNodesName - The name of the entity reference.@Nonnull public final IMicroElement appendElement(@Nonnull @Nonempty String sTagName)
IMicroNodeappendElement in interface IMicroNodesTagName - Element name to be created. May neither be null nor
empty.@Nonnull public final IMicroElement appendElement(@Nullable String sNamespaceURI, @Nonnull @Nonempty String sTagName)
IMicroNodeappendElement in interface IMicroNodesNamespaceURI - Namespace URI to use. May be null.sTagName - Element name to be created. May neither be null nor
empty.@Nonnull public final IMicroProcessingInstruction appendProcessingInstruction(@Nonnull @Nonempty String sTarget, @Nullable String sData)
IMicroNodeappendProcessingInstruction in interface IMicroNodesTarget - The PI targetsData - The PI data@Nonnull public final IMicroContainer appendContainer()
IMicroNodeappendContainer in interface IMicroNode@OverrideOnDemand @Nonnull protected EChange onRemoveChild(IMicroNode aChild)
aChild - The child that is removed.EChange.CHANGED if something changed@Nonnull public final EChange removeChild(@Nonnull IMicroNode aChild)
IMicroNoderemoveChild in interface IMicroNodeaChild - The child to be removed. May not be null.EChange.CHANGED if the child was successfully removed,
EChange.UNCHANGED otherwise.@OverrideOnDemand @Nonnull protected EChange onRemoveChildAtIndex(int nIndex)
nIndex - The 0-based index of the item to be removed.EChange.CHANGED if the node was successfully removed,
EChange.UNCHANGED otherwise.@Nonnull public final EChange removeChildAtIndex(@Nonnegative int nIndex)
IMicroNoderemoveChildAtIndex in interface IMicroNodenIndex - The 0-based index of the item to be removed.EChange.CHANGED if the node was successfully removed,
EChange.UNCHANGED otherwise.@OverrideOnDemand @Nonnull protected EChange onRemoveAllChildren()
EChange.CHANGED if at least one child was present, and was
successfully removed, EChange.UNCHANGED otherwise.@Nonnull public final EChange removeAllChildren()
IMicroNoderemoveAllChildren in interface IMicroNodeEChange.CHANGED if at least one child was present, and was
successfully removed, EChange.UNCHANGED otherwise.@Nonnull public final EChange replaceChild(@Nonnull IMicroNode aOldChild, @Nonnull IMicroNode aNewChild)
IMicroNodereplaceChild in interface IMicroNodeaOldChild - The child to be removed. May not be null.aNewChild - The child to be inserted instead. May not be null.EChange.CHANGED if the child was successfully replaced,
EChange.UNCHANGED if old child and new child are identical.@OverrideOnDemand public boolean hasChildren()
hasChildren in interface IHasChildren<IMicroNode>hasChildren in interface IMicroNodetrue if at least one child is present,
false otherwise@OverrideOnDemand @Nullable public ICommonsList<IMicroNode> getAllChildren()
IMicroNodegetAllChildren in interface IHasChildren<IMicroNode>getAllChildren in interface IHasChildrenSorted<IMicroNode>getAllChildren in interface IMicroNodenull if the node has no children.@OverrideOnDemand @Nullable public IMicroNode getChildAtIndex(@Nonnegative int nIndex)
IHasChildrenSortedgetChildAtIndex in interface IHasChildrenSorted<IMicroNode>nIndex - The index to be queried. May not be < 0 or ≥ the number of
childrennull if the index
is invalid.@OverrideOnDemand @Nonnegative public int getChildCount()
getChildCount in interface IHasChildren<IMicroNode>@OverrideOnDemand @Nullable public IMicroNode getFirstChild()
IHasChildrenSortednull if no child is presentgetFirstChild in interface IHasChildrenSorted<IMicroNode>getFirstChild in interface IMicroNodenull if this
node has no children.@OverrideOnDemand @Nullable public IMicroNode getLastChild()
IHasChildrenSortednull if no child is presentgetLastChild in interface IHasChildrenSorted<IMicroNode>getLastChild in interface IMicroNodenull if this node
has no children.@OverrideOnDemand @Nullable public ICommonsList<IMicroNode> getAllChildrenRecursive()
IMicroNodegetAllChildrenRecursive in interface IMicroNodenull if this node has no children.@Nullable public final IMicroNode getPreviousSibling()
getPreviousSibling in interface IMicroNodenull if this node has no preceding siblings.@Nullable public final IMicroNode getNextSibling()
getNextSibling in interface IMicroNodenull
if this node has no succeeding siblings.public final boolean hasParent()
hasParent in interface IMicroNodetrue if this node has a parent node assigned,
false otherwise.@Nullable public final IMicroNode getParent()
IHasParentgetParent in interface IHasParent<IMicroNode>getParent in interface IMicroNodenull.@Nonnull public final IMicroNode detachFromParent()
IMicroNodeIllegalStateException if adding this node again to another parent
since each node can only have one parent.detachFromParent in interface IMicroNode@Nullable public final IMicroElement getParentElementWithName(@Nullable String sTagName)
getParentElementWithName in interface IMicroNode@Nullable public final IMicroElement getParentElementWithName(@Nullable String sNamespaceURI, @Nullable String sTagName)
getParentElementWithName in interface IMicroNodepublic final boolean isDocument()
isDocument in interface IMicroNodetrue if this node can safely be casted to
IMicroDocument.public final boolean isDocumentType()
isDocumentType in interface IMicroNodetrue if this node can safely be casted to
IMicroDocumentType.public final boolean isText()
isText in interface IMicroNodetrue if this node can safely be casted to
IMicroText.public final boolean isCDATA()
isCDATA in interface IMicroNodetrue if this node can safely be casted to
IMicroCDATA.public final boolean isComment()
isComment in interface IMicroNodetrue if this node can safely be casted to
IMicroComment.public final boolean isEntityReference()
isEntityReference in interface IMicroNodetrue if this node can safely be casted to
IMicroEntityReference.public final boolean isElement()
isElement in interface IMicroNodetrue if this node can safely be casted to
IMicroElement.public final boolean isProcessingInstruction()
isProcessingInstruction in interface IMicroNodetrue if this node can safely be casted to
IMicroProcessingInstruction.public final boolean isContainer()
isContainer in interface IMicroNodetrue if this node can safely be casted to
IMicroContainer.protected final void onEvent(@Nonnull EMicroEvent eEventType, @Nonnull IMicroNode aSourceNode, @Nonnull IMicroNode aTargetNode)
@Nonnull public EChange registerEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
IMicroNoderegisterEventTarget in interface IMicroNodeeEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was registered,
EChange.UNCHANGED otherwise.@Nonnull public EChange unregisterEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
IMicroNodeunregisterEventTarget in interface IMicroNodeeEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was unregistered,
EChange.UNCHANGED otherwise.@Nonnull @ReturnsMutableCopy public ICommonsMap<EMicroEvent,ICommonsSet<IMicroEventTarget>> getAllEventTargets()
getAllEventTargets in interface IMicroNodenull.@Nonnull @ReturnsMutableCopy public ICommonsSet<IMicroEventTarget> getAllEventTargets(@Nullable EMicroEvent eEvent)
IMicroNodegetAllEventTargets in interface IMicroNodeeEvent - The event to be queried. May be null.null.Copyright © 2014–2016 Philip Helger. All rights reserved.