Skip to content

TreeNode Manager

Almost all of the TreeNode manipulation features are implemented on TreeNodeManager, this help us to test, extend and change the implementation for some features if it needed.

By Default TreeViewAdapter depend on the Default TreeNodeManager class but if you want a custom implementation, you can easily create a new manager class that extend TreeNodeManager and pass it on TreeViewAdapter constructor

TreeViewAdapter adapter = new TreeViewAdapter(factory, customTreeNodeManager);

The TreeNodeManager class has many method to help easily provide features.

Set the current visible tree nodes

public void setTreeNodes(List<TreeNode> treeNodes)

Get the Current visible Tree nodes

public List<TreeNode> getTreeNodes()

Get TreeNode by index

public TreeNode get(int index)

Add new TreeNode

public boolean addNode(TreeNode node)

Clear the current TreeNodes and add new TreeNodes

public void updateNodes(List<TreeNode> newNodes)

Remove TreeNode

public boolean removeNode(TreeNode node)

Clear all TreeNodes

public void clearNodes()

Get the current TreeNodes size

public int size()

Collapsing TreeNode

public int collapseNode(TreeNode node)

Expanding TreeNode

public int expandNode(TreeNode node)

Collapsing TreeNode full branch

public int collapseNodeBranch(TreeNode node)

Expanding TreeNode full branch

public int expandNodeBranch(TreeNode node)

Expanding TreeNode branch until specific level

public void expandNodeToLevel(TreeNode node, int level)

Expanding all tree nodes branches to until specific level

public void expandNodesAtLevel(int level)

Collapsing all nodes in the tree with their children

public void collapseAll()

Expanding all nodes in the tree with their children

public void expandAll()

If you want more information about them, please check the javadoc.