本文整理汇总了Java中org.abego.treelayout.util.DefaultTreeForTreeLayout类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTreeForTreeLayout类的具体用法?Java DefaultTreeForTreeLayout怎么用?Java DefaultTreeForTreeLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTreeForTreeLayout类属于org.abego.treelayout.util包,在下文中一共展示了DefaultTreeForTreeLayout类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSampleTree
import org.abego.treelayout.util.DefaultTreeForTreeLayout; //导入依赖的package包/类
/**
* @return a "Sample" tree with {@link TextInBox} items as nodes.
*/
public static TreeForTreeLayout<TextInBox> createSampleTree() {
TextInBox root = new TextInBox("root", 40, 20);
TextInBox n1 = new TextInBox("n1", 30, 20);
TextInBox n1_1 = new TextInBox("n1.1\n(first node)", 80, 36);
TextInBox n1_2 = new TextInBox("n1.2", 40, 20);
TextInBox n1_3 = new TextInBox("n1.3\n(last node)", 80, 36);
TextInBox n2 = new TextInBox("n2", 30, 20);
TextInBox n2_1 = new TextInBox("n2", 30, 20);
DefaultTreeForTreeLayout<TextInBox> tree = new DefaultTreeForTreeLayout<TextInBox>(
root);
tree.addChild(root, n1);
tree.addChild(n1, n1_1);
tree.addChild(n1, n1_2);
tree.addChild(n1, n1_3);
tree.addChild(root, n2);
tree.addChild(n2, n2_1);
return tree;
}
示例2: createSampleTree2
import org.abego.treelayout.util.DefaultTreeForTreeLayout; //导入依赖的package包/类
/**
* @return a "Sample" tree with {@link TextInBox} items as nodes.
*/
public static TreeForTreeLayout<TextInBox> createSampleTree2() {
TextInBox root = new TextInBox("prog", 40, 20);
TextInBox n1 = new TextInBox("classDef", 65, 20);
TextInBox n1_1 = new TextInBox("class", 50, 20);
TextInBox n1_2 = new TextInBox("T", 20, 20);
TextInBox n1_3 = new TextInBox("{", 20, 20);
TextInBox n1_4 = new TextInBox("member", 60, 20);
TextInBox n1_5 = new TextInBox("member", 60, 20);
TextInBox n1_5_1 = new TextInBox("<ERROR:int>", 90, 20);
TextInBox n1_6 = new TextInBox("member", 60, 20);
TextInBox n1_6_1 = new TextInBox("int", 30, 20);
TextInBox n1_6_2 = new TextInBox("i", 20, 20);
TextInBox n1_6_3 = new TextInBox(";", 20, 20);
TextInBox n1_7 = new TextInBox("}", 20, 20);
DefaultTreeForTreeLayout<TextInBox> tree = new DefaultTreeForTreeLayout<TextInBox>(
root);
tree.addChild(root, n1);
tree.addChild(n1, n1_1);
tree.addChild(n1, n1_2);
tree.addChild(n1, n1_3);
tree.addChild(n1, n1_4);
tree.addChild(n1, n1_5);
tree.addChild(n1_5, n1_5_1);
tree.addChild(n1, n1_6);
tree.addChild(n1_6,n1_6_1);
tree.addChild(n1_6,n1_6_2);
tree.addChild(n1_6,n1_6_3);
tree.addChild(n1, n1_7);
return tree;
}
示例3: testAddChild
import org.abego.treelayout.util.DefaultTreeForTreeLayout; //导入依赖的package包/类
@Test
public void testAddChild() throws Exception {
DefaultTreeForTreeLayout<String> tree = new DefaultTreeForTreeLayout<String>(
"ROOT");
tree.addChild("ROOT", "N1");
tree.addChild("ROOT", "N2");
tree.addChild("N1", "N1.1");
assertEquals("N1", tree.getChildrenList("ROOT").get(0));
assertEquals("N1.1", tree.getChildrenList("N1").get(0));
assertEquals("N2", tree.getChildrenList("ROOT").get(1));
}
示例4: testAddChildren
import org.abego.treelayout.util.DefaultTreeForTreeLayout; //导入依赖的package包/类
@Test
public void testAddChildren() throws Exception {
DefaultTreeForTreeLayout<String> tree = new DefaultTreeForTreeLayout<String>(
"ROOT");
tree.addChildren("ROOT", "N1", "N2");
tree.addChildren("N1", "N1.1");
assertEquals("N1", tree.getChildrenList("ROOT").get(0));
assertEquals("N1.1", tree.getChildrenList("N1").get(0));
assertEquals("N2", tree.getChildrenList("ROOT").get(1));
}
示例5: testAddChild_parentNotInTree
import org.abego.treelayout.util.DefaultTreeForTreeLayout; //导入依赖的package包/类
@Test
public void testAddChild_parentNotInTree() throws Exception {
DefaultTreeForTreeLayout<String> tree = new DefaultTreeForTreeLayout<String>(
"ROOT");
try {
tree.addChild("N1", "N1.1");
fail("exception expected");
} catch (Exception ex) {
assertEquals("parentNode is not in the tree", ex.getMessage());
}
}
示例6: setUp
import org.abego.treelayout.util.DefaultTreeForTreeLayout; //导入依赖的package包/类
@Before
public void setUp() {
tree = new DefaultTreeForTreeLayout<String>(root);
tree.addChild(root, n1);
tree.addChild(root, n2);
}