Class NodeContext<N>
java.lang.Object
org.exoplatform.portal.tree.list.ListTree<NodeContext<N>>
org.exoplatform.portal.mop.navigation.NodeContext<N>
The context of a node.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(NodeFilter filter) Apply the filter logic on this node only.Add a child node at the specified index with the specified name.voidadd(Integer index, NodeContext<N> context) Move a context as a child context of this context at the specified index.protected voidafterInsert(NodeContext<N> context) Callback to signal insertion occured.protected voidafterRemove(NodeContext<N> context) Callback to signal insertion occured.protected voidbeforeInsert(NodeContext<N> context) Callback to signal insertion occured.protected voidbeforeRemove(NodeContext<N> context) Callback to signal insertion occured.voidfilter(NodeFilter filter) Applies a filter recursively, the filter will update the hiddent status of the fragment.Returns an unmodifiable list of uncommitted changes applied to this node context.intgetDepth(NodeContext<N> ancestor) Returns the relative depth of this node with respect to the ancestor argument.getDescendant(String handle) getDescendantNode(String handle) getId()Returns the context id or null if the context is not associated with a persistent navigation node.intgetIndex()Returns the context index among its parent.getName()getNode()Returns the associated node with this contextgetNode(int index) intReturns the node count defined by: when the node has a children relationship, the number of non hidden nodes when the node has not a children relationship, the total number of nodesgetNodes()intReturns the total number of nodes.getState()booleanReturns true if the tree containing this node has pending transient changes.insertAfter(NodeData data) insertLast(NodeData data) booleanbooleanisHidden()Returns true if the context is currently hidden.iterator()booleanRemoves this current context when it is not hidden.booleanremoveNode(String name) Remove a specified context when it is not hidden.voidsetHidden(boolean hidden) Updates the hiddent value.voidRename this context.voidUpdate the context statetoString()toString(int depth, StringBuilder sb) Methods inherited from class org.exoplatform.portal.tree.list.ListTree
get, getDepth, getFirst, getLast, getNext, getParent, getPrevious, getSize, insertAfter, insertAt, insertBefore, insertFirst, insertLast, listIterator, remove
-
Method Details
-
hasChanges
public boolean hasChanges()Returns true if the tree containing this node has pending transient changes.- Returns:
- true if there are uncommited changes
-
getChanges
Returns an unmodifiable list of uncommitted changes applied to this node context.- Returns:
- the list of uncommitted changes
-
getNode
Returns the associated node with this context- Returns:
- the node
-
getId
Returns the context id or null if the context is not associated with a persistent navigation node.- Returns:
- the id
-
getIndex
public int getIndex()Returns the context index among its parent.- Returns:
- the index value
-
isExpanded
public boolean isExpanded() -
isHidden
public boolean isHidden()Returns true if the context is currently hidden.- Returns:
- the hidden value
-
setHidden
public void setHidden(boolean hidden) Updates the hiddent value.- Parameters:
hidden- the hidden value
-
getState
-
getName
-
setName
public void setName(String name) throws NullPointerException, IllegalStateException, IllegalArgumentException Rename this context.- Parameters:
name- the new name- Throws:
NullPointerException- if the name is nullIllegalStateException- if the parent is nullIllegalArgumentException- if the parent already have a child with the specified name
-
getDescendant
- Throws:
NullPointerException
-
get
-
add
public NodeContext<N> add(Integer index, String name) throws NullPointerException, IndexOutOfBoundsException, IllegalStateException Add a child node at the specified index with the specified name. If the index argument is null then the node is added at the last position among the children otherwise the node is added at the specified index.- Parameters:
index- the indexname- the node name- Returns:
- the created node
- Throws:
NullPointerException- if the model or the name is nullIndexOutOfBoundsException- if the index is negative or greater than the children sizeIllegalStateException- if the children relationship does not exist
-
getNodeSize
public int getNodeSize()Returns the total number of nodes.- Returns:
- the total number of nodes
-
getNodeCount
public int getNodeCount()Returns the node count defined by:- when the node has a children relationship, the number of non hidden nodes
- when the node has not a children relationship, the total number of nodes
- Returns:
- the node count
-
getParentNode
-
getNode
- Throws:
NullPointerException
-
getNode
-
getDescendantNode
- Throws:
NullPointerException
-
iterator
-
getNodes
-
removeNode
public boolean removeNode(String name) throws NullPointerException, IllegalArgumentException, IllegalStateException Remove a specified context when it is not hidden.- Parameters:
name- the name of the context to remove- Returns:
- true if the context was removed
- Throws:
NullPointerException- if the name argument is nullIllegalArgumentException- if the named context does not existIllegalStateException- if the children relationship does not exist
-
removeNode
Removes this current context when it is not hidden.- Returns:
- if the context was removed
- Throws:
IllegalStateException- if the children relationship does not exist
-
toString
-
toString
-