Class ListTree<T extends ListTree<T>>

java.lang.Object
org.exoplatform.portal.tree.list.ListTree<T>
Direct Known Subclasses:
NodeContext

public class ListTree<T extends ListTree<T>> extends Object

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.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    afterInsert(T tree)
    Callback to signal insertion occured.
    protected void
    afterRemove(T tree)
    Callback to signal insertion occured.
    protected void
    Callback to signal insertion occured.
    protected void
    Callback to signal insertion occured.
    final T
    get(int index)
    Returns a tree specified by its index.
    final int
    Returns the depth.
    final T
    Returns the first tree.
    final T
    Returns the last tree.
    final T
    Returns the tree.
    final T
    Returns the parent.
    final T
    Returns the previous.
    final int
    Returns the size.
    final void
    insertAfter(T tree)
    Insert the specified tree after this tree
    final void
    insertAt(Integer index, T tree)
    Insert the specified tree.
    final void
    Insert the specified tree before this tree
    void
    insertFirst(T tree)
    Insert the specified context at the first position among the children of this context.
    final void
    insertLast(T tree)
    Insert the specified context at the last position among the children of this context.
     
    final void
    Removes this tree from its parent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ListTree

      public ListTree()
  • Method Details

    • getDepth

      public final int getDepth()
      Returns the depth.
      Returns:
      the depth
    • getNext

      public final T getNext()
      Returns the tree.
      Returns:
      the tree
    • getPrevious

      public final T getPrevious()
      Returns the previous.
      Returns:
      the previous
    • getParent

      public final T getParent()
      Returns the parent.
      Returns:
      the parent
    • getSize

      public final int getSize()
      Returns the size.
      Returns:
      the size
    • getFirst

      public final T getFirst()
      Returns the first tree.
      Returns:
      the first tree
    • getLast

      public final T getLast()
      Returns the last tree.
      Returns:
      the last tree
    • get

      public final T get(int index) throws IndexOutOfBoundsException
      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 index
      tree - the tree
      Throws:
      NullPointerException - if the context is null
      IllegalArgumentException - if an existing child with the same name already exist
      IndexOutOfBoundsException - if the index is negative or is greater than the children size
    • insertLast

      public final void insertLast(T tree)
      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

      public void insertFirst(T tree) throws NullPointerException
      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

      public final void insertAfter(T tree)
      Insert the specified tree after this tree
      Parameters:
      tree - the tree to insert after
      Throws:
      NullPointerException - if the specified tree argument is null
      IllegalStateException - if this tree does not have a parent
    • insertBefore

      public final void insertBefore(T tree) throws NullPointerException, IllegalStateException
      Insert the specified tree before this tree
      Parameters:
      tree - the tree to insert before
      Throws:
      NullPointerException - if the specified tree argument is null
      IllegalStateException - if this tree does not have a parent
    • remove

      public final void remove() throws IllegalStateException
      Removes this tree from its parent
      Throws:
      IllegalStateException - if this tree does not have a parent
    • listIterator

      public final ListIterator<T> listIterator()
    • beforeInsert

      protected void beforeInsert(T tree)
      Callback to signal insertion occured.
      Parameters:
      tree - the child inserted
    • afterInsert

      protected void afterInsert(T tree)
      Callback to signal insertion occured.
      Parameters:
      tree - the child inserted
    • beforeRemove

      protected void beforeRemove(T tree)
      Callback to signal insertion occured.
      Parameters:
      tree - the child inserted
    • afterRemove

      protected void afterRemove(T tree)
      Callback to signal insertion occured.
      Parameters:
      tree - the child inserted