Package javax.swing.tree

Examples of javax.swing.tree.VariableHeightLayoutCache$NodeRecord


   *
   * @param h the test harness to use
   */
  private void testNullRect(TestHarness h)
  {
    VariableHeightLayoutCache c = new VariableHeightLayoutCache();
    DefaultMutableTreeNode n = new DefaultMutableTreeNode();
    TreePath p = new TreePath(n);
    DefaultTreeModel m = new DefaultTreeModel(n);
    c.setModel(m);
    Rectangle r = new Rectangle();
    // Check if the supplied rectangle is reused.
    Rectangle s = c.getBounds(p, r);
    h.check(r == s);
    // Check if a new rectangle is created when supplying null.
    s = c.getBounds(p, null);
    h.check(s != null);
    h.check(s != r);
  }
View Full Code Here


        assertEquals(p, ui.getPathForRow(new JTree(), 2));
        tree.expandPath(p);
        assertEquals(new TreePath(new Object[] { root, node2, node22 }), ui.getPathForRow(tree,
                4));
        assertEquals(new TreePath(new Object[] { root, node3 }), ui.getPathForRow(tree, 5));
        ui.treeState = new VariableHeightLayoutCache() {
            @Override
            public TreePath getPathForRow(final int row) {
                return new TreePath(new Object[] { node3 });
            }
        };
View Full Code Here

        assertEquals(4, ui.treeState.getRowCount());
        assertEquals(4, ui.getRowCount(new JTree()));
        TreePath p = new TreePath(new Object[] { root, node2 });
        tree.expandPath(p);
        assertEquals(6, ui.getRowCount(tree));
        ui.treeState = new VariableHeightLayoutCache() {
            @Override
            public int getRowCount() {
                return -200;
            }
        };
View Full Code Here

        assertTrue(tree.isRootVisible());
        TreePath p = new TreePath(new Object[] { root, node2 });
        assertEquals(2, ui.getRowForPath(tree, p));
        assertEquals(2, ui.getRowForPath(new JTree(), p));
        tree.expandPath(new TreePath(new Object[] { root, node1 }));
        ui.treeState = new VariableHeightLayoutCache() {
            @Override
            public int getRowForPath(final TreePath p) {
                return -200;
            }
        };
View Full Code Here

    public void testUpdateExpandedDescendants() {
        TreePath pathToExpand = new TreePath(tree.getModel().getRoot())
                .pathByAddingChild(node1);
        tree.expandPath(pathToExpand);
        assertTrue(ui.treeState.isExpanded(pathToExpand));
        ui.treeState = new VariableHeightLayoutCache();
        ui.treeState.setModel(tree.getModel());
        assertFalse(ui.treeState.isExpanded(pathToExpand));
        ui.updateExpandedDescendants(new TreePath(tree.getModel().getRoot()));
        assertTrue(ui.treeState.isExpanded(pathToExpand));
    }
View Full Code Here

    public void testConfigureLayoutCache() {
        TreePath expandedPath = new TreePath(tree.getModel().getRoot())
                .pathByAddingChild(node1);
        tree.expandPath(expandedPath);
        ui.treeState = new VariableHeightLayoutCache();
        ui.configureLayoutCache();
        assertSame(tree.getModel(), ui.treeState.getModel());
        assertSame(tree.getSelectionModel(), ui.treeState.getSelectionModel());
        assertSame(ui.nodeDimensions, ui.treeState.getNodeDimensions());
        assertEquals(tree.getRowHeight(), ui.treeState.getRowHeight());
View Full Code Here

        return new TreeExpansionHandler();
    }

    protected AbstractLayoutCache createLayoutCache() {
        return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                           : (AbstractLayoutCache)new VariableHeightLayoutCache();
    }
View Full Code Here

        // This is a workaround to an apparent bug in BasicTreeUI; see also
        // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6505523
        directory.setUI(new BasicTreeUI() {
            @Override
            protected AbstractLayoutCache createLayoutCache() {
                return new VariableHeightLayoutCache() {
                    @Override
                    public Rectangle getBounds(TreePath arg0, Rectangle arg1) {
                        Rectangle b = super.getBounds(arg0, arg1);
                        if (b == null && arg0 != null) return new Rectangle(0,0,0,0);
                        return b;
View Full Code Here

        return new TreeExpansionHandler();
    }

    protected AbstractLayoutCache createLayoutCache() {
        return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                           : (AbstractLayoutCache)new VariableHeightLayoutCache();
    }
View Full Code Here

        assertEquals(p, ui.getPathForRow(new JTree(), 2));
        tree.expandPath(p);
        assertEquals(new TreePath(new Object[] { root, node2, node22 }), ui.getPathForRow(tree,
                4));
        assertEquals(new TreePath(new Object[] { root, node3 }), ui.getPathForRow(tree, 5));
        ui.treeState = new VariableHeightLayoutCache() {
            @Override
            public TreePath getPathForRow(final int row) {
                return new TreePath(new Object[] { node3 });
            }
        };
View Full Code Here

TOP

Related Classes of javax.swing.tree.VariableHeightLayoutCache$NodeRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.