Package com.amrdeveloper.treeview
Class TreeNodeManager
java.lang.Object
com.amrdeveloper.treeview.TreeNodeManager
Manager class for TreeNodes to easily apply operations on them
and to make it easy for testing and extending
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd new node to the current tree nodesvoidClear the current nodesvoidCollapsing all nodes in the tree with their childrenintcollapseNode(TreeNode node) Collapsing node and all of his childrenintcollapseNodeBranch(TreeNode node) voidExpanding all nodes in the tree with their childrenintexpandNode(TreeNode node) Expanding node and all of his childrenintexpandNodeBranch(TreeNode node) Expanding node full branchesvoidexpandNodesAtLevel(int level) Expanding all tree nodes branches to until specific levelvoidexpandNodeToLevel(TreeNode node, int level) Expanding one node branch to until specific levelget(int index) Get TreeNode from the current nodes by indexGet the Current visible Tree nodesbooleanremoveNode(TreeNode node) Delete one node from the visible nodesvoidsetTreeNodes(List<TreeNode> treeNodes) Set the current visible tree nodesintsize()Get the current number of visible nodesvoidupdateNodes(List<TreeNode> newNodes) Clear the current nodes and insert new nodes
-
Constructor Details
-
TreeNodeManager
public TreeNodeManager()Simple constructor
-
-
Method Details
-
setTreeNodes
Set the current visible tree nodes- Parameters:
treeNodes- New tree nodes
-
getTreeNodes
Get the Current visible Tree nodes- Returns:
- The visible Tree nodes main
-
get
Get TreeNode from the current nodes by index- Parameters:
index- of node to get it- Returns:
- TreeNode from by index from current tree nodes if exists
-
addNode
Add new node to the current tree nodes- Parameters:
node- to add it to the current tree nodes- Returns:
- true of this node is added
-
updateNodes
Clear the current nodes and insert new nodes- Parameters:
newNodes- to update the current nodes with them
-
removeNode
Delete one node from the visible nodes- Parameters:
node- to delete it from the current nodes- Returns:
- true of this node is deleted
-
clearNodes
public void clearNodes()Clear the current nodes -
size
public int size()Get the current number of visible nodes- Returns:
- the size of visible nodes
-
collapseNode
Collapsing node and all of his children- Parameters:
node- The node to collapse it- Returns:
- the index of this node if it exists in the list
-
expandNode
Expanding node and all of his children- Parameters:
node- The node to expand it- Returns:
- the index of this node if it exists in the list
-
collapseNodeBranch
- Parameters:
node- The node to collapse the branch of it- Returns:
- the index of this node if it exists in the list
-
expandNodeBranch
Expanding node full branches- Parameters:
node- The node to expand the branch of it- Returns:
- the index of this node if it exists in the list
-
expandNodeToLevel
Expanding one node branch to until specific level- Parameters:
node- to expand branch of it until levellevel- to expand node branches to it
-
expandNodesAtLevel
public void expandNodesAtLevel(int level) Expanding all tree nodes branches to until specific level- Parameters:
level- to expand all nodes branches to it
-
collapseAll
public void collapseAll()Collapsing all nodes in the tree with their children -
expandAll
public void expandAll()Expanding all nodes in the tree with their children
-