Class AbstractTreeRowModel<T>

java.lang.Object
org.eclipse.nebula.widgets.nattable.tree.AbstractTreeRowModel<T>
All Implemented Interfaces:
ITreeRowModel<T>
Direct Known Subclasses:
GlazedListTreeRowModel, TreeRowModel

public abstract class AbstractTreeRowModel<T> extends Object implements ITreeRowModel<T>
  • Constructor Details

    • AbstractTreeRowModel

      public AbstractTreeRowModel(ITreeData<T> treeData)
  • Method Details

    • registerRowGroupModelListener

      public void registerRowGroupModelListener(ITreeRowModelListener listener)
    • notifyListeners

      public void notifyListeners()
    • depth

      public int depth(int index)
      Specified by:
      depth in interface ITreeRowModel<T>
      Parameters:
      index - The index of the tree element to check.
      Returns:
      The number of ancestors of the node at the specified index. Root nodes have depth 0, other nodes depth is one greater than the depth of their parent node.
    • isLeaf

      public boolean isLeaf(int index)
      Specified by:
      isLeaf in interface ITreeRowModel<T>
      Parameters:
      index - The index of the tree element to check.
      Returns:
      true if the tree element at the given index has no children and therefore is a leaf, false if the tree element has children and therefore is a node.
    • hasChildren

      public boolean hasChildren(int index)
      Specified by:
      hasChildren in interface ITreeRowModel<T>
      Parameters:
      index - The index of the tree element to check.
      Returns:
      true if the tree element at the given index has children, false if not.
    • isCollapsed

      public boolean isCollapsed(T object)
      Specified by:
      isCollapsed in interface ITreeRowModel<T>
      Parameters:
      object - The element that should be checked.
      Returns:
      true if the children of the given element are visible, false if not.
    • isCollapsible

      public boolean isCollapsible(int index)
      Checks if the tree node at the given index is collapsible or not.
      Specified by:
      isCollapsible in interface ITreeRowModel<T>
      Parameters:
      index - The index of the tree node to check.
      Returns:
      true if the tree node at the given index has children, false if not.
    • collapse

      public List<Integer> collapse(T object)
      Description copied from interface: ITreeRowModel
      Collapse the tree node that represent the given object.
      Specified by:
      collapse in interface ITreeRowModel<T>
      Parameters:
      object - The object that represents the tree node to collapse.
      Returns:
      The indexes of all children of the collapsed tree node that become invisible by performing the collapse operation.
    • expand

      public List<Integer> expand(T object)
      Description copied from interface: ITreeRowModel
      Expands the tree node that represents the given object.
      Specified by:
      expand in interface ITreeRowModel<T>
      Parameters:
      object - The object that represents the tree node to expand.
      Returns:
      The indexes of all children of the expanded tree node that become visible by performing the expand operation.
    • expandToLevel

      public List<Integer> expandToLevel(T object, int level)
      Description copied from interface: ITreeRowModel
      Expands the tree node that represents the given object to a certain level.
      Specified by:
      expandToLevel in interface ITreeRowModel<T>
      Parameters:
      object - The object that represents the tree node to expand.
      level - The level to which the tree node should be expanded.
      Returns:
      The indexes of all children that are showed after the expand operation is performed.
    • getChildIndexes

      public List<Integer> getChildIndexes(int parentIndex)
      Description copied from interface: ITreeRowModel
      This method returns all visible child indexes below the node at the given index. It search all the way down the tree structure to find every child, even the sub children, sub sub children and so on.

      If you only need to get the direct child indexes of the node at the given index you need to use ITreeRowModel.getDirectChildIndexes(int) instead.

      Specified by:
      getChildIndexes in interface ITreeRowModel<T>
      Parameters:
      parentIndex - The index for which the child indexes are requested.
      Returns:
      The list of all child indexes for the node at the given index.
    • getDirectChildIndexes

      public List<Integer> getDirectChildIndexes(int parentIndex)
      Description copied from interface: ITreeRowModel
      This method returns only the direct visible child indexes of the node at the given index. It does not search all the way down for further sub children.

      If you need to get all child indexes of the node at the given index you need to use ITreeRowModel.getChildIndexes(int) instead.

      Specified by:
      getDirectChildIndexes in interface ITreeRowModel<T>
      Parameters:
      parentIndex - The index for which the direct child indexes are requested.
      Returns:
      The list of the direct child indexes for the node at the given index.
    • getChildren

      public List<T> getChildren(int parentIndex)
      Description copied from interface: ITreeRowModel
      This method returns all children below the node at the given index. It search all the way down the tree structure to find every child, even the sub children, sub sub children and so on.

      If you only need to get the direct children of the node at the given index you need to use ITreeRowModel.getDirectChildren(int) instead.

      Specified by:
      getChildren in interface ITreeRowModel<T>
      Parameters:
      parentIndex - The index for which the children are requested.
      Returns:
      The list of all children for the node at the given index.
    • getChildren

      protected List<T> getChildren(T parent)
    • getDirectChildren

      public List<T> getDirectChildren(int parentIndex)
      Description copied from interface: ITreeRowModel
      This method returns only the direct children of the node at the given index. It does not search all the way down for further sub children.

      If you need to get all children of the node at the given index you need to use ITreeRowModel.getChildren(int) instead.

      Specified by:
      getDirectChildren in interface ITreeRowModel<T>
      Parameters:
      parentIndex - The index for which the direct children are requested.
      Returns:
      The list of the direct children for the node at the given index.
    • getDirectChildren

      protected List<T> getDirectChildren(T parent)
    • getTreeData

      public ITreeData<T> getTreeData()
      Returns the ITreeData that is backed by this tree row model.
      Returns:
      The ITreeData that is backed by this tree row model.
      Since:
      1.6