Java 类javax.swing.tree.AbstractLayoutCache.NodeDimensions 实例源码

项目:cn1    文件:BasicTreeUITest.java   
public void testCreateNodeDimensions() throws Exception {
    tree.setRowHeight(40);
    ui.setLeftChildIndent(10);
    ui.setRightChildIndent(20);
    ui.depthOffset = 3;
    assertNotNull(ui.createNodeDimensions());
    assertTrue(ui.createNodeDimensions() instanceof BasicTreeUI.NodeDimensionsHandler);
    assertNotSame(ui.createNodeDimensions(), ui.createNodeDimensions());
    tree.setFont(tree.getFont().deriveFont(40f));
    NodeDimensions n = ui.createNodeDimensions();
    Component c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(),
            false, false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset, 0, c
            .getPreferredSize().width, c.getPreferredSize().height), n.getNodeDimensions(
            root, 0, 0, true, new Rectangle()));
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, node1.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset, 0, c
            .getPreferredSize().width, c.getPreferredSize().height), n.getNodeDimensions(
            node1, 0, 0, true, new Rectangle()));
    Rectangle rectangle = new Rectangle(10, 10, 20, 20);
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent
            * 3, rectangle.y, c.getPreferredSize().width, c.getPreferredSize().height), n
            .getNodeDimensions(root, 2, 3, true, rectangle));
}
项目:cn1    文件:BasicTreeUITest.java   
public void testCreateNodeDimensionsRTL() throws Exception {
    tree.setRowHeight(40);
    tree.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    NodeDimensions n = ui.createNodeDimensions();
    Component c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(),
            false, false, false, 0, false);
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 0)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(root, 0, 0, true,
            new Rectangle()));
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 2)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(root, 0, 2, true,
            new Rectangle()));
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, node1.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 0)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(node1, 0, 0, true,
            new Rectangle()));
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 2)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(node1, 0, 2, true,
            new Rectangle()));
}
项目:freeVM    文件:BasicTreeUITest.java   
public void testCreateNodeDimensions() throws Exception {
    tree.setRowHeight(40);
    ui.setLeftChildIndent(10);
    ui.setRightChildIndent(20);
    ui.depthOffset = 3;
    assertNotNull(ui.createNodeDimensions());
    assertTrue(ui.createNodeDimensions() instanceof BasicTreeUI.NodeDimensionsHandler);
    assertNotSame(ui.createNodeDimensions(), ui.createNodeDimensions());
    tree.setFont(tree.getFont().deriveFont(40f));
    NodeDimensions n = ui.createNodeDimensions();
    Component c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(),
            false, false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset, 0, c
            .getPreferredSize().width, c.getPreferredSize().height), n.getNodeDimensions(
            root, 0, 0, true, new Rectangle()));
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, node1.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset, 0, c
            .getPreferredSize().width, c.getPreferredSize().height), n.getNodeDimensions(
            node1, 0, 0, true, new Rectangle()));
    Rectangle rectangle = new Rectangle(10, 10, 20, 20);
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent
            * 3, rectangle.y, c.getPreferredSize().width, c.getPreferredSize().height), n
            .getNodeDimensions(root, 2, 3, true, rectangle));
}
项目:freeVM    文件:BasicTreeUITest.java   
public void testCreateNodeDimensionsRTL() throws Exception {
    tree.setRowHeight(40);
    tree.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    NodeDimensions n = ui.createNodeDimensions();
    Component c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(),
            false, false, false, 0, false);
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 0)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(root, 0, 0, true,
            new Rectangle()));
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 2)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(root, 0, 2, true,
            new Rectangle()));
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, node1.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 0)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(node1, 0, 0, true,
            new Rectangle()));
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 2)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(node1, 0, 2, true,
            new Rectangle()));
}
项目:freeVM    文件:BasicTreeUITest.java   
public void testCreateNodeDimensions() throws Exception {
    tree.setRowHeight(40);
    ui.setLeftChildIndent(10);
    ui.setRightChildIndent(20);
    ui.depthOffset = 3;
    assertNotNull(ui.createNodeDimensions());
    assertTrue(ui.createNodeDimensions() instanceof BasicTreeUI.NodeDimensionsHandler);
    assertNotSame(ui.createNodeDimensions(), ui.createNodeDimensions());
    tree.setFont(tree.getFont().deriveFont(40f));
    NodeDimensions n = ui.createNodeDimensions();
    Component c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(),
            false, false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset, 0, c
            .getPreferredSize().width, c.getPreferredSize().height), n.getNodeDimensions(
            root, 0, 0, true, new Rectangle()));
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, node1.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset, 0, c
            .getPreferredSize().width, c.getPreferredSize().height), n.getNodeDimensions(
            node1, 0, 0, true, new Rectangle()));
    Rectangle rectangle = new Rectangle(10, 10, 20, 20);
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent
            * 3, rectangle.y, c.getPreferredSize().width, c.getPreferredSize().height), n
            .getNodeDimensions(root, 2, 3, true, rectangle));
}
项目:freeVM    文件:BasicTreeUITest.java   
public void testCreateNodeDimensionsRTL() throws Exception {
    tree.setRowHeight(40);
    tree.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    NodeDimensions n = ui.createNodeDimensions();
    Component c = ui.getCellRenderer().getTreeCellRendererComponent(tree, root.toString(),
            false, false, false, 0, false);
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 0)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(root, 0, 0, true,
            new Rectangle()));
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 2)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(root, 0, 2, true,
            new Rectangle()));
    c = ui.getCellRenderer().getTreeCellRendererComponent(tree, node1.toString(), false,
            false, false, 0, false);
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 0)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(node1, 0, 0, true,
            new Rectangle()));
    assertEquals(new Rectangle(tree.getWidth()
            - (ui.totalChildIndent * ui.depthOffset + ui.totalChildIndent * 2)
            - c.getPreferredSize().width, 0, c.getPreferredSize().width, c
            .getPreferredSize().height), n.getNodeDimensions(node1, 0, 2, true,
            new Rectangle()));
}
项目:pumpernickel    文件:DecoratedTreeUI.java   
ExtendedNodeDimensions(NodeDimensions src) {
    this.src = src;
}
项目:pumpernickel    文件:DecoratedTreeUI.java   
@Override
protected NodeDimensions createNodeDimensions() {
    NodeDimensions returnValue = super.createNodeDimensions();
    return new ExtendedNodeDimensions(returnValue);
}