public void testInfiniteExpand() { InfiniteTreeModel model = new InfiniteTreeModel(); myTree = new JTree(model); TreePath rootPath = new TreePath(model.getRoot()); myTree.setSelectionPath(rootPath); myTree.collapsePath(rootPath); TreeExpandCollapse.expandAll(myTree); checkExpanded(rootPath); TreeExpandCollapse.expandAll(myTree); }
public void testSubsequentExpand() { InfiniteTreeModel model = new InfiniteTreeModel(); myTree = new JTree(model); TreeExpandCollapse.expandAll(myTree); TreePath path = new TreePath(model.getRoot()); while (myTree.isExpanded(path)) path = path.pathByAddingChild(model.getChild(path.getLastPathComponent(), 0)); checkCollapsed(path); TreeExpandCollapse.expandAll(myTree); checkExpanded(path); }
public void testExpand() { TreePath rootPath = collapseRoot(); myTree.setSelectionPath(rootPath); TreeExpandCollapse.expand(myTree); checkExpanded(rootPath); checkCollapsed(myChildAPath); }
public void testTotalExpandWithoutSelection() { collapseRoot(); myTree.clearSelection(); TreeExpandCollapse.expand(myTree); checkCollapsed(new TreePath(myRoot)); checkCollapsed(myChildAPath); checkCollapsed(myChildBPath); }
public void testCollapse() { myTree.expandPath(myChildAPath); myTree.expandPath(myChild2Path); checkExpanded(myChild2Path); myTree.setSelectionPath(myChild2Path); TreeExpandCollapse.collapse(myTree); checkCollapsed(myChild2Path); checkExpanded(myChildAPath); }
public void testTotalExpandWithSelection() { myTree.expandPath(new TreePath(myRoot)); myTree.collapsePath(myChildAPath); myTree.collapsePath(myChildBPath); myTree.setSelectionPath(myChildAPath); TreeExpandCollapse.expandAll(myTree); checkExpanded(myChildAPath); checkCollapsed(myChildBPath); }
public void testExpandAllWithManyLeafs() { collapseRoot(); addChildren(500, myChild2); addChildren(500, myChildA); addChildren(500, myChildB); myTree.setSelectionPath(new TreePath(myRoot)); TreeExpandCollapse.expandAll(myTree); checkExpanded(new TreePath(myRoot)); checkExpanded(myChildAPath); checkExpanded(myChildBPath); checkExpanded(myChild2Path); }
public void testExpandManyNotLeafs() { collapseRoot(); TreePath[] treePaths = new TreePath[20]; for (int i = 0; i < treePaths.length; i++) { DefaultMutableTreeNode child = new DefaultMutableTreeNode(); myTreeModel.insertNodeInto(child, myChild2, 0); addChildren(20, child); treePaths[i] = myChild2Path.pathByAddingChild(child); } TreeExpandCollapse.expandAll(myTree); for (int i = 0; i < treePaths.length; i++) { TreePath treePath = treePaths[i]; checkExpanded(treePath); } }
public void testExpandWithoutSelection() { myTree.clearSelection(); TreeExpandCollapse.expand(myTree); }
public void testCollapseWithoutSelection() { myTree.clearSelection(); TreeExpandCollapse.collapse(myTree); }