• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SpringLayoutAlgorithm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set

import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; //导入依赖的package包/类
public void set(CTRunEnvironment env) {
	clear();

	if (env != null) {
		GraphNode envnode = new GraphNode(graph, SWT.NONE, "Env " + env);

		Set<CTRuntimeObject> rs = env.getRunObjects();
		for (CTRuntimeObject runo : rs) {
			if (runo instanceof CTFactoryState) {
				CTFactoryState state = (CTFactoryState) runo;
				addFactoryState(1, envnode, state);
			}
		}

		SpringLayoutAlgorithm springLayoutAlgorithm = new MapLayout();
		// springLayoutAlgorithm.setSpringGravitation(10);

		graph.setLayoutAlgorithm(springLayoutAlgorithm, true);
	}
}
 
开发者ID:CollabThings,项目名称:collabthings.swt,代码行数:21,代码来源:MapView.java


示例2: createPartControl

import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; //导入依赖的package包/类
@Override
public void createPartControl(Composite parent) {
    gv = new GraphViewer(parent, SWT.NONE);
    gv.setNodeStyle(ZestStyles.NODES_NO_ANIMATION);
    gv.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
    gv.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);

    labelProvider = new DepcyGraphLabelProvider(gv.getControl());
    gv.setLabelProvider(labelProvider);
    gv.setContentProvider(new DepcyGraphViewContentProvider());

    // listen to node/connection selection events
    gv.getGraphControl().addSelectionListener(new SelectionAdapter() {
    });

    // register listener to pages post selection
    getSite().getPage().addPostSelectionListener(this);

    gv.getGraphControl().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            ISelection selection = gv.getSelection();
            if (currentProject != null && !selection.isEmpty()
                    && selection instanceof IStructuredSelection) {
                Object obj = ((IStructuredSelection) selection).getFirstElement();
                if (obj instanceof PgStatement) {
                    PgStatement st = (PgStatement) obj;
                    try {
                        getSite().getPage().openEditor(new FileEditorInput(currentProject.getFile(
                                Path.fromOSString(ModelExporter.getRelativeFilePath(st, true)))),
                                EDITOR.SQL);
                    } catch (PartInitException ex) {
                        ExceptionNotifier.notifyDefault(ex.getLocalizedMessage(), ex);
                    }
                }
            }
        }
    });
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:41,代码来源:DepcyGraphView.java


示例3: show

import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; //导入依赖的package包/类
/**
 * Show a refinement in the graph view.
 *
 * If a sub refinement is selected, the complete parent refinement will be displayed but only
 * the sub refinement is focused.
 *
 * @param refinement
 *            The refinement to present
 */
public void show(Refinement refinement) {
    clear();
    focusedRefinement = refinement;
    if (refinement.eContainer() instanceof Refinement) {
        createGraphNodes((Refinement) refinement.eContainer());
    } else {
        createGraphNodes(refinement);
    }
    this.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.ENFORCE_BOUNDS
            | LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
    this.layout();
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:22,代码来源:RefinementGraph.java


示例4: construct

import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; //导入依赖的package包/类
@Override
public Control construct(Composite parent) {
	Composite content = new Composite(parent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(content);
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(content);

	Graph graph = new Graph(content, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(graph);
	// now a few nodes
	GraphNode node1 = new GraphNode(graph, SWT.NONE, "Jim");
	GraphNode node2 = new GraphNode(graph, SWT.NONE, "Jack");
	GraphNode node3 = new GraphNode(graph, SWT.NONE, "Joe");
	GraphNode node4 = new GraphNode(graph, SWT.NONE, "Bill");
	// Lets have a directed connection
	new GraphConnection(graph, ZestStyles.CONNECTIONS_DIRECTED, node1,
			node2);
	// Lets have a dotted graph connection
	new GraphConnection(graph, ZestStyles.CONNECTIONS_DOT, node2, node3);
	// Standard connection
	new GraphConnection(graph, SWT.NONE, node3, node1);
	// Change line color and line width
	GraphConnection graphConnection = new GraphConnection(graph, SWT.NONE,
			node1, node4);
	graphConnection.changeLineColor(parent.getDisplay().getSystemColor(SWT.COLOR_GREEN));
	// Also set a text
	graphConnection.setText("This is a text");
	graphConnection.setHighlightColor(parent.getDisplay().getSystemColor(SWT.COLOR_RED));
	graphConnection.setLineWidth(3);

	graph.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
	// Selection listener on graphConnect or GraphNode is not supported
	// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=236528
	graph.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			System.out.println(e);
		}

	});

	return content;
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:44,代码来源:ZestMockup.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IImageHelper类代码示例发布时间:2022-05-22
下一篇:
Java Link类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap