Class TreeRowModel<T>

  • Type Parameters:
    T - The type of the elements in the tree
    All Implemented Interfaces:
    ITreeRowModel<T>

    public class TreeRowModel<T>
    extends AbstractTreeRowModel<T>
    Implementation of ITreeRowModel that is used to perform expand/collapse operations using the approach of hiding and showing rows.
    • Field Detail

      • parentIndexes

        protected final Set<Integer> parentIndexes
    • Constructor Detail

      • TreeRowModel

        public TreeRowModel​(ITreeData<T> treeData)
    • Method Detail

      • isCollapsed

        public boolean isCollapsed​(int index)
        Parameters:
        index - The index of the tree element to check.
        Returns:
        true if the children of the tree node at the given index are visible, false if not.
      • collapse

        public List<Integer> collapse​(int index)
        Description copied from interface: ITreeRowModel
        Collapses the tree node at the given index.
        Parameters:
        index - The index of the node in the collection that should be collapsed.
        Returns:
        The indexes of all children of the collapsed tree node that become invisible by performing the collapse operation.
      • internalCollapse

        protected Collection<Integer> internalCollapse​(int index)
        Performs the collapse operation without notifying the listeners while processing.
        Parameters:
        index - The index of the node in the collection that should be collapsed.
        Returns:
        The indexes of all children of the collapsed tree node that become invisible by performing the collapse operation.
      • collapseAll

        public List<Integer> collapseAll()
        Description copied from interface: ITreeRowModel
        Collapses all tree nodes.
        Returns:
        The indexes of all children that are hidden after the collapse operation is performed.
      • expand

        public List<Integer> expand​(int index)
        Description copied from interface: ITreeRowModel
        Expands the tree node at the given index.
        Parameters:
        index - The index of the node in the collection that should be expanded.
        Returns:
        The indexes of all children of the expanded tree node that become visible by performing the expand operation.
      • internalExpand

        protected Collection<Integer> internalExpand​(int index)
        Performs the expand operations iteratively without notifying the listeners while processing.
        Parameters:
        index - The index of the node in the collection that should be expanded.
        Returns:
        The indexes of all children of the expanded tree node that become visible by performing the expand operation.
      • expandAll

        public List<Integer> expandAll()
        Description copied from interface: ITreeRowModel
        Expands all tree nodes.
        Returns:
        The indexes of all children that are showed after the expand operation is performed.
      • expandToLevel

        public List<Integer> expandToLevel​(int level)
        Description copied from interface: ITreeRowModel
        Expands all tree nodes to a certain level.
        Parameters:
        level - The level to which the tree nodes should be expanded.
        Returns:
        The indexes of all children that are showed after the expand operation is performed.
      • expandToLevel

        public List<Integer> expandToLevel​(int parentIndex,
                                           int level)
        Description copied from interface: ITreeRowModel
        Expands the tree node at the given index to a certain level.
        Parameters:
        parentIndex - The index of the node in the collection that should be expanded.
        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.
      • internalExpandToLevel

        protected Collection<Integer> internalExpandToLevel​(int index,
                                                            int level)
        Performs the expand operations iteratively without notifying the listeners while processing.
        Parameters:
        index - The index of the node in the collection that should be expanded.
        level - The level to which the tree nodes should be expanded.
        Returns:
        The indexes of all children of the expanded tree node that become visible by performing the expand operation.