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


Java TreeForTreeLayout类代码示例

本文整理汇总了Java中org.abego.treelayout.TreeForTreeLayout的典型用法代码示例。如果您正苦于以下问题:Java TreeForTreeLayout类的具体用法?Java TreeForTreeLayout怎么用?Java TreeForTreeLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreeForTreeLayout类属于org.abego.treelayout包,在下文中一共展示了TreeForTreeLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DwFeatureTreeLayouter

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
public DwFeatureTreeLayouter(DwFeatureModelWrapped featureModel) {
	DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();
	HyFeature initialVersion = featureModel.getModel().getRootFeature().get(0).getFeature();
	
	
	TreeForTreeLayout<DwFeatureWrapped> tree = new DwFeatureTreeForTreeLayout(featureModel.findWrappedFeature(initialVersion), featureModel.getSelectedDate());
	DwFeatureNodeExtentProvider extentProvider = new DwFeatureNodeExtentProvider(featureModel);

	DefaultConfiguration<DwFeatureWrapped> configuration = new DefaultConfiguration<DwFeatureWrapped>(theme.getFeatureExtentY()*1.5, theme.getFeatureExtentX()) {
		@Override
		public Location getRootLocation() {
			return Location.Top;
		}
		
		@Override
		public AlignmentInLevel getAlignmentInLevel(){
			return AlignmentInLevel.TowardsRoot;
		}
	};
	
	treeLayout = new TreeLayout<DwFeatureWrapped>(tree, extentProvider, configuration);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:23,代码来源:DwFeatureTreeLayouter.java

示例2: DwVersionTreeLayouter

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
public DwVersionTreeLayouter(HyFeature feature, Date date) {
	this.feature = feature;
	this.date = date;
	
	DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();
	HyVersion initialVersion = DwVersionUtil.getRootVersion(feature, date);
	
	TreeForTreeLayout<HyVersion> tree = new DwVersionTreeForTreeLayout(initialVersion, date);
	DwVersionNodeExtentProvider extentProvider = new DwVersionNodeExtentProvider();

	DefaultConfiguration<HyVersion> configuration = new DefaultConfiguration<HyVersion>(theme.getVersionExtentX(), theme.getVersionExtentY()) {
		@Override
		public Location getRootLocation() {
			return Location.Left;
		}
	};
	
	treeLayout = new TreeLayout<HyVersion>(tree, extentProvider, configuration);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:20,代码来源:DwVersionTreeLayouter.java

示例3: main

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
/**
 * Returns an SVG text displaying a tree with nodes placed according to a
 * layout created by {@link TreeLayout}.
 * 
 * @param args [unused]
 */
public static void main(String[] args) {
	// get the sample tree
	TreeForTreeLayout<TextInBox> tree = SampleTreeFactory
			.createSampleTree();

	// setup the tree layout configuration
	double gapBetweenLevels = 50;
	double gapBetweenNodes = 10;
	DefaultConfiguration<TextInBox> configuration = new DefaultConfiguration<TextInBox>(
			gapBetweenLevels, gapBetweenNodes);

	// create the NodeExtentProvider for TextInBox nodes
	TextInBoxNodeExtentProvider nodeExtentProvider = new TextInBoxNodeExtentProvider();

	// create the layout
	TreeLayout<TextInBox> treeLayout = new TreeLayout<TextInBox>(tree,
			nodeExtentProvider, configuration);

	// Generate the SVG and write it to System.out
	SVGForTextInBoxTree generator = new SVGForTextInBoxTree(treeLayout);
	System.out.println(generator.getSVG());
}
 
开发者ID:abego,项目名称:treelayout,代码行数:29,代码来源:SVGDemo.java

示例4: main

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
/**
 * Shows a dialog with a tree in a layout created by {@link TreeLayout},
 * using the Swing component {@link TextInBoxTreePane}.
 * 
 * @param args args[0]: treeName (default="")
 */
public static void main(String[] args) {
	// get the sample tree
	String treeName = (args.length > 0) ? args[0] : "";
	TreeForTreeLayout<TextInBox> tree = getSampleTree(treeName);
			
	// setup the tree layout configuration
	double gapBetweenLevels = 50;
	double gapBetweenNodes = 10;
	DefaultConfiguration<TextInBox> configuration = new DefaultConfiguration<TextInBox>(
			gapBetweenLevels, gapBetweenNodes);

	// create the NodeExtentProvider for TextInBox nodes
	TextInBoxNodeExtentProvider nodeExtentProvider = new TextInBoxNodeExtentProvider();

	// create the layout
	TreeLayout<TextInBox> treeLayout = new TreeLayout<TextInBox>(tree,
			nodeExtentProvider, configuration);

	// Create a panel that draws the nodes and edges and show the panel
	TextInBoxTreePane panel = new TextInBoxTreePane(treeLayout);
	showInDialog(panel);
}
 
开发者ID:abego,项目名称:treelayout,代码行数:29,代码来源:SwingDemo.java

示例5: createSampleTree

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的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

示例6: getSampleTree

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
private static TreeForTreeLayout<TextInBox> getSampleTree(String treeName) {
	TreeForTreeLayout<TextInBox> tree;
	if (treeName.equals("2")) {
		tree = SampleTreeFactory.createSampleTree2();
	} else if (treeName.equals("")) {
		tree = SampleTreeFactory.createSampleTree();
	} else {
		throw new RuntimeException(String.format("Invalid tree name: '%s'",
				treeName));
	}
	return tree;
}
 
开发者ID:abego,项目名称:treelayout,代码行数:13,代码来源:SwingDemo.java

示例7: createSampleTree2

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的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

示例8: writeSVG

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
public void writeSVG(String path, Document_Lara currDocument, int length) {
	
	if(printFlag){
		System.out.println("writeSVG");
	}

	// get the sample tree
	String treeName = "";
	TreeForTreeLayout<TextInBox> tree = toConstituant(currDocument, length);

	// setup the tree layout configuration
	double gapBetweenLevels = 50;
	double gapBetweenNodes = 10;
	DefaultConfiguration<TextInBox> configuration = new DefaultConfiguration<TextInBox>(
			gapBetweenLevels, gapBetweenNodes);

	// create the NodeExtentProvider for TextInBox nodes
	TextInBoxNodeExtentProvider nodeExtentProvider = new TextInBoxNodeExtentProvider();

	// create the layout
	TreeLayout<TextInBox> treeLayout = new TreeLayout<TextInBox>(tree,
			nodeExtentProvider, configuration);

	// Create a panel that draws the nodes and edges and show the panel
	// TextInBoxTreePane panel = new TextInBoxTreePane(treeLayout);
	// showInDialog(panel);

	SVGForTextInBoxTree generator = new SVGForTextInBoxTree(treeLayout);

	IO_Service io_service = new IO_Service();
	io_service.writeFile(
			path + currDocument.getTitle().replaceAll("\\s", "") + ".svg",
			"UTF-8", generator.getSVG());

}
 
开发者ID:fauconnier,项目名称:LaToe,代码行数:36,代码来源:Writer_Service.java

示例9: TreeLayout

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
/**
 * Creates a TreeLayout for a given tree.
 * <p>
 * In addition to the tree the {@link NodeExtentProvider} and the
 * {@link Configuration} must be given.
 * 
 * @param useIdentity
 *            [default: false] when true, identity ("==") is used instead of
 *            equality ("equals(...)") when checking nodes. Within a tree
 *            each node must only be once (using this check).
 */
public TreeLayout(TreeForTreeLayout<TreeNode> tree,
		NodeExtentProvider<TreeNode> nodeExtentProvider,
		Configuration<TreeNode> configuration, boolean useIdentity) {
	this.tree = tree;
	this.nodeExtentProvider = nodeExtentProvider;
	this.configuration = configuration;
	this.useIdentity = useIdentity;

	if (this.useIdentity) {
		this.mod = new IdentityHashMap<TreeNode, Double>();
		this.thread = new IdentityHashMap<TreeNode, TreeNode>();
		this.prelim = new IdentityHashMap<TreeNode, Double>();
		this.change = new IdentityHashMap<TreeNode, Double>();
		this.shift = new IdentityHashMap<TreeNode, Double>();
		this.ancestor = new IdentityHashMap<TreeNode, TreeNode>();
		this.number = new IdentityHashMap<TreeNode, Integer>();
		this.positions = new IdentityHashMap<TreeNode, Point2D>();
	} else {
		this.mod = new HashMap<TreeNode, Double>();
		this.thread = new HashMap<TreeNode, TreeNode>();
		this.prelim = new HashMap<TreeNode, Double>();
		this.change = new HashMap<TreeNode, Double>();
		this.shift = new HashMap<TreeNode, Double>();
		this.ancestor = new HashMap<TreeNode, TreeNode>();
		this.number = new HashMap<TreeNode, Integer>();
		this.positions = new HashMap<TreeNode, Point2D>();
	}
	
	// No need to explicitly set mod, thread and ancestor as their getters
	// are taking care of the initial values. This avoids a full tree walk
	// through and saves some memory as no entries are added for
	// "initial values".

	TreeNode r = tree.getRoot();
	firstWalk(r, null);
	calcSizeOfLevels(r, 0);
	secondWalk(r, -getPrelim(r), 0, 0);
}
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:50,代码来源:TreeLayout.java

示例10: getTree

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
private TreeForTreeLayout<ASTVNode> getTree() {
	return treeLayout.getTree();
}
 
开发者ID:jpavlich,项目名称:antlr4-tutorial,代码行数:4,代码来源:ASTPane.java

示例11: getTreeLayoutAdaptor

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
/** Get an adaptor for root that indicates how to walk ANTLR trees.
 *  Override to change the adapter from the default of {@link TreeLayoutAdaptor}  */
public TreeForTreeLayout<Tree> getTreeLayoutAdaptor(Tree root) {
	return new TreeLayoutAdaptor(root);
}
 
开发者ID:antlr,项目名称:codebuff,代码行数:6,代码来源:TreePostScriptGenerator.java

示例12: getTree

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
protected TreeForTreeLayout<Tree> getTree() {
	return treeLayout.getTree();
}
 
开发者ID:antlr,项目名称:codebuff,代码行数:4,代码来源:TreePostScriptGenerator.java

示例13: getTree

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
private TreeForTreeLayout<TextInBox> getTree() {
	return treeLayout.getTree();
}
 
开发者ID:abego,项目名称:treelayout,代码行数:4,代码来源:SVGForTextInBoxTree.java

示例14: getTree

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
/**
 * Returns the Tree the layout is created for.
 */
public TreeForTreeLayout<TreeNode> getTree() {
	return tree;
}
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:7,代码来源:TreeLayout.java

示例15: getTree

import org.abego.treelayout.TreeForTreeLayout; //导入依赖的package包/类
private TreeForTreeLayout<Box> getTree() {
	return treeLayout.getTree();
}
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:4,代码来源:TreePanel.java


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