当前位置: 首页>>代码示例>>Java>>正文


Java DefaultTreeForTreeLayout类代码示例

本文整理汇总了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;
}
 
开发者ID:abego,项目名称:treelayout,代码行数:23,代码来源:SampleTreeFactory.java

示例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;
}
 
开发者ID:abego,项目名称:treelayout,代码行数:36,代码来源:SampleTreeFactory.java

示例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));
}
 
开发者ID:abego,项目名称:treelayout,代码行数:13,代码来源:DefaultTreeForTreeLayoutTest.java

示例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));
}
 
开发者ID:abego,项目名称:treelayout,代码行数:12,代码来源:DefaultTreeForTreeLayoutTest.java

示例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());
	}

}
 
开发者ID:abego,项目名称:treelayout,代码行数:14,代码来源:DefaultTreeForTreeLayoutTest.java

示例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);
}
 
开发者ID:abego,项目名称:treelayout,代码行数:7,代码来源:DefaultTreeForTreeLayoutTest.java


注:本文中的org.abego.treelayout.util.DefaultTreeForTreeLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。