Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 public void testExpand() {
   TreePath rootPath = collapseRoot();
   myTree.setSelectionPath(rootPath);
   TreeExpandCollapse.expand(myTree);
   checkExpanded(rootPath);
   checkCollapsed(myChildAPath);
 }
Esempio n. 4
0
 public void testTotalExpandWithoutSelection() {
   collapseRoot();
   myTree.clearSelection();
   TreeExpandCollapse.expand(myTree);
   checkCollapsed(new TreePath(myRoot));
   checkCollapsed(myChildAPath);
   checkCollapsed(myChildBPath);
 }
Esempio n. 5
0
 public void testCollapse() {
   myTree.expandPath(myChildAPath);
   myTree.expandPath(myChild2Path);
   checkExpanded(myChild2Path);
   myTree.setSelectionPath(myChild2Path);
   TreeExpandCollapse.collapse(myTree);
   checkCollapsed(myChild2Path);
   checkExpanded(myChildAPath);
 }
Esempio n. 6
0
 public void testTotalExpandWithSelection() {
   myTree.expandPath(new TreePath(myRoot));
   myTree.collapsePath(myChildAPath);
   myTree.collapsePath(myChildBPath);
   myTree.setSelectionPath(myChildAPath);
   TreeExpandCollapse.expandAll(myTree);
   checkExpanded(myChildAPath);
   checkCollapsed(myChildBPath);
 }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 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);
   }
 }
Esempio n. 9
0
 public void testExpandWithoutSelection() {
   myTree.clearSelection();
   TreeExpandCollapse.expand(myTree);
 }
Esempio n. 10
0
 public void testCollapseWithoutSelection() {
   myTree.clearSelection();
   TreeExpandCollapse.collapse(myTree);
 }