List of utility methods to do JTree Path
Object[] | getObjectPathForNode(final TreeNode node) get Object Path For Node final LinkedList<TreeNode> list = new LinkedList<TreeNode>(); TreeNode runner = node; while (runner != null) { list.add(0, runner); runner = runner.getParent(); return list.toArray(new TreeNode[list.size()]); |
TreePath | getPath(TreeNode node) get Path List list = new ArrayList(); while (node != null) { list.add(node); node = node.getParent(); Collections.reverse(list); return new TreePath(list.toArray()); |
TreePath | getPath(TreeNode treeNode) get Path List<Object> nodes = new ArrayList<Object>(); if (treeNode != null) { nodes.add(treeNode); treeNode = treeNode.getParent(); while (treeNode != null) { nodes.add(0, treeNode); treeNode = treeNode.getParent(); return nodes.isEmpty() ? null : new TreePath(nodes.toArray()); |
TreePath | getPath(TreeNode treeNode) Given a TreeNode get the corresponding TreePath
List<Object> nodes = new ArrayList<Object>(); if (treeNode != null) { nodes.add(treeNode); treeNode = treeNode.getParent(); while (treeNode != null) { nodes.add(0, treeNode); treeNode = treeNode.getParent(); return nodes.isEmpty() ? null : new TreePath(nodes.toArray()); |
TreePath | getPath(TreeNode treeNode) get Path List<Object> nodes = new ArrayList<Object>(); if (treeNode != null) { nodes.add(treeNode); treeNode = treeNode.getParent(); while (treeNode != null) { nodes.add(0, treeNode); treeNode = treeNode.getParent(); return nodes.isEmpty() ? null : new TreePath(nodes.toArray()); |
TreePath | getPath(TreeNode treeNode) get Path List<TreeNode> nodes = new ArrayList<TreeNode>(); while (treeNode != null) { nodes.add(0, treeNode); treeNode = treeNode.getParent(); return nodes.isEmpty() ? null : new TreePath(nodes.toArray()); |
String | getPathStr(TreeNode[] projectNodes) creates String path from treeNodes String str = new String(); for (int counter = 0; counter < projectNodes.length; counter++) { if (counter == projectNodes.length - 1) { str = str + projectNodes[counter]; continue; str = str + projectNodes[counter] + SEPERATOR; return str; |
TreeNode | getTree(List constract tree from list of paths. return getTree(paths, null);
|
TreePath | getTreePath(TreeNode treeNode) get Tree Path List<Object> nodes = new ArrayList<Object>(); if (treeNode != null) { nodes.add(treeNode); treeNode = treeNode.getParent(); while (treeNode != null) { nodes.add(0, treeNode); treeNode = treeNode.getParent(); return nodes.isEmpty() ? null : new TreePath(nodes.toArray()); |
TreePath | getTreePath(TreeNode treeNode) gets path from the current node to high up in the Tree in TreePath format List<Object> nodes = new ArrayList<Object>(); if (treeNode != null) { nodes.add(treeNode); treeNode = treeNode.getParent(); while (treeNode != null) { nodes.add(0, treeNode); treeNode = treeNode.getParent(); return nodes.isEmpty() ? null : new TreePath(nodes.toArray()); |