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 Summary
Constructors Constructor Description AbstractTreeRowModel(ITreeData<T> treeData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Integer>collapse(T object)Collapse the tree node that represent the given object.intdepth(int index)List<Integer>expand(T object)Expands the tree node that represents the given object.List<Integer>expandToLevel(T object, int level)Expands the tree node that represents the given object to a certain level.List<Integer>getChildIndexes(int parentIndex)This method returns all visible child indexes below the node at the given index.List<T>getChildren(int parentIndex)This method returns all children below the node at the given index.protected List<T>getChildren(T parent)List<Integer>getDirectChildIndexes(int parentIndex)This method returns only the direct visible child indexes of the node at the given index.List<T>getDirectChildren(int parentIndex)This method returns only the direct children of the node at the given index.protected List<T>getDirectChildren(T parent)ITreeData<T>getTreeData()Returns theITreeDatathat is backed by this tree row model.booleanhasChildren(int index)booleanisCollapsed(T object)booleanisCollapsible(int index)Checks if the tree node at the given index is collapsible or not.booleanisLeaf(int index)voidnotifyListeners()voidregisterRowGroupModelListener(ITreeRowModelListener listener)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.tree.ITreeRowModel
collapse, collapseAll, expand, expandAll, expandToLevel, expandToLevel, isCollapsed
-
-
-
-
Method Detail
-
registerRowGroupModelListener
public void registerRowGroupModelListener(ITreeRowModelListener listener)
-
notifyListeners
public void notifyListeners()
-
depth
public int depth(int index)
- Specified by:
depthin interfaceITreeRowModel<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:
isLeafin interfaceITreeRowModel<T>- Parameters:
index- The index of the tree element to check.- Returns:
trueif the tree element at the given index has no children and therefore is a leaf,falseif the tree element has children and therefore is a node.
-
hasChildren
public boolean hasChildren(int index)
- Specified by:
hasChildrenin interfaceITreeRowModel<T>- Parameters:
index- The index of the tree element to check.- Returns:
trueif the tree element at the given index has children,falseif not.
-
isCollapsed
public boolean isCollapsed(T object)
- Specified by:
isCollapsedin interfaceITreeRowModel<T>- Parameters:
object- The element that should be checked.- Returns:
trueif the children of the given element are visible,falseif not.
-
isCollapsible
public boolean isCollapsible(int index)
Checks if the tree node at the given index is collapsible or not.- Specified by:
isCollapsiblein interfaceITreeRowModel<T>- Parameters:
index- The index of the tree node to check.- Returns:
trueif the tree node at the given index has children,falseif not.
-
collapse
public List<Integer> collapse(T object)
Description copied from interface:ITreeRowModelCollapse the tree node that represent the given object.- Specified by:
collapsein interfaceITreeRowModel<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:ITreeRowModelExpands the tree node that represents the given object.- Specified by:
expandin interfaceITreeRowModel<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:ITreeRowModelExpands the tree node that represents the given object to a certain level.- Specified by:
expandToLevelin interfaceITreeRowModel<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:ITreeRowModelThis 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:
getChildIndexesin interfaceITreeRowModel<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:ITreeRowModelThis 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:
getDirectChildIndexesin interfaceITreeRowModel<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:ITreeRowModelThis 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:
getChildrenin interfaceITreeRowModel<T>- Parameters:
parentIndex- The index for which the children are requested.- Returns:
- The list of all children for the node at the given index.
-
getDirectChildren
public List<T> getDirectChildren(int parentIndex)
Description copied from interface:ITreeRowModelThis 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:
getDirectChildrenin interfaceITreeRowModel<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.
-
-