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));
}
java类javax.swing.tree.AbstractLayoutCache.NodeDimensions的实例源码
BasicTreeUITest.java 文件源码
项目:cn1
阅读 20
收藏 0
点赞 0
评论 0
BasicTreeUITest.java 文件源码
项目:cn1
阅读 26
收藏 0
点赞 0
评论 0
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()));
}
BasicTreeUITest.java 文件源码
项目:freeVM
阅读 25
收藏 0
点赞 0
评论 0
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));
}
BasicTreeUITest.java 文件源码
项目:freeVM
阅读 22
收藏 0
点赞 0
评论 0
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()));
}
BasicTreeUITest.java 文件源码
项目:freeVM
阅读 21
收藏 0
点赞 0
评论 0
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));
}
BasicTreeUITest.java 文件源码
项目:freeVM
阅读 26
收藏 0
点赞 0
评论 0
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()));
}
DecoratedTreeUI.java 文件源码
项目:pumpernickel
阅读 19
收藏 0
点赞 0
评论 0
ExtendedNodeDimensions(NodeDimensions src) {
this.src = src;
}
DecoratedTreeUI.java 文件源码
项目:pumpernickel
阅读 20
收藏 0
点赞 0
评论 0
@Override
protected NodeDimensions createNodeDimensions() {
NodeDimensions returnValue = super.createNodeDimensions();
return new ExtendedNodeDimensions(returnValue);
}