Package org.exoplatform.portal.tree.list
Class ListTree<T extends ListTree<T>>
java.lang.Object
org.exoplatform.portal.tree.list.ListTree<T>
- Type Parameters:
T- the self bounding tree type
- Direct Known Subclasses:
NodeContext
A tree structure where the children in which the children are organized as a linked list. The children of a tree is a linked
list and can be iterated with an iterator or thanks to the getFirst(), getLast(), getNext() and
getPrevious() methods.
- Version:
- $Revision$
- Author:
- Julien Viet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterInsert(T tree) Callback to signal insertion occured.protected voidafterRemove(T tree) Callback to signal insertion occured.protected voidbeforeInsert(T tree) Callback to signal insertion occured.protected voidbeforeRemove(T tree) Callback to signal insertion occured.final Tget(int index) Returns a tree specified by its index.final intgetDepth()Returns the depth.final TgetFirst()Returns the first tree.final TgetLast()Returns the last tree.final TgetNext()Returns the tree.final TReturns the parent.final TReturns the previous.final intgetSize()Returns the size.final voidinsertAfter(T tree) Insert the specified tree after this treefinal voidInsert the specified tree.final voidinsertBefore(T tree) Insert the specified tree before this treevoidinsertFirst(T tree) Insert the specified context at the first position among the children of this context.final voidinsertLast(T tree) Insert the specified context at the last position among the children of this context.final ListIterator<T> final voidremove()Removes this tree from its parent
-
Constructor Details
-
ListTree
public ListTree()
-
-
Method Details
-
getDepth
public final int getDepth()Returns the depth.- Returns:
- the depth
-
getNext
Returns the tree.- Returns:
- the tree
-
getPrevious
Returns the previous.- Returns:
- the previous
-
getParent
Returns the parent.- Returns:
- the parent
-
getSize
public final int getSize()Returns the size.- Returns:
- the size
-
getFirst
Returns the first tree.- Returns:
- the first tree
-
getLast
Returns the last tree.- Returns:
- the last tree
-
get
Returns a tree specified by its index.- Parameters:
index- the index- Returns:
- the corresponding tree
- Throws:
IndexOutOfBoundsException- if the index is incorrect
-
insertAt
public final void insertAt(Integer index, T tree) throws NullPointerException, IllegalArgumentException, IndexOutOfBoundsException Insert the specified tree.- Parameters:
index- the indextree- the tree- Throws:
NullPointerException- if the context is nullIllegalArgumentException- if an existing child with the same name already existIndexOutOfBoundsException- if the index is negative or is greater than the children size
-
insertLast
Insert the specified context at the last position among the children of this context.- Parameters:
tree- the content to insert- Throws:
NullPointerException- if the tree argument is null
-
insertFirst
Insert the specified context at the first position among the children of this context.- Parameters:
tree- the content to insert- Throws:
NullPointerException- if the tree argument is null
-
insertAfter
Insert the specified tree after this tree- Parameters:
tree- the tree to insert after- Throws:
NullPointerException- if the specified tree argument is nullIllegalStateException- if this tree does not have a parent
-
insertBefore
Insert the specified tree before this tree- Parameters:
tree- the tree to insert before- Throws:
NullPointerException- if the specified tree argument is nullIllegalStateException- if this tree does not have a parent
-
remove
Removes this tree from its parent- Throws:
IllegalStateException- if this tree does not have a parent
-
listIterator
-
beforeInsert
Callback to signal insertion occured.- Parameters:
tree- the child inserted
-
afterInsert
Callback to signal insertion occured.- Parameters:
tree- the child inserted
-
beforeRemove
Callback to signal insertion occured.- Parameters:
tree- the child inserted
-
afterRemove
Callback to signal insertion occured.- Parameters:
tree- the child inserted
-