本文介绍了jgraph布局不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用jgraph ver。 5.14.0.0。 ()
当我尝试将布局应用于jgraph时,但出于某种奇怪的原因,它不起作用。
public static void layout JGraph图){
JGraphFacade facade = new JGraphFacade(graph);
JGraphSimpleLayout lay = new JGraphSimpleLayout(JGraphSimpleLayout.TYPE_RANDOM,100,100);
lay.run(facade);
}
我运行此代码来布局图表,但单元格不会移动。 / p>
我还没有找到jgraph库的标签。
解决方案
,你只是缺少几行:
final JGraphSimpleLayout graphLayout =
new JGraphSimpleLayout(JGraphSimpleLayout.TYPE_RANDOM, 100,100);
final JGraphFacade graphFacade = new JGraphFacade(jgraph);
graphLayout.run(graphFacade);
最终映射nestedMap = graphFacade.createNestedMap(true,true);
jgraph.getGraphLayoutCache()。edit(nestedMap);
I use jgraph ver. 5.14.0.0. ( http://www.jgraph.com )
When I try to apply layout to a jgraph, but for some weird reason it does not work.
public static void layout(JGraph graph) {
JGraphFacade facade = new JGraphFacade(graph);
JGraphSimpleLayout lay = new JGraphSimpleLayout(JGraphSimpleLayout.TYPE_RANDOM, 100, 100);
lay.run(facade);
}
I run this code to layout a graph, but cells does not move.
I have not found tag for jgraph library.
解决方案
Based on http://anonsvn.jboss.org/repos/jbossas/projects/mc-tools/grapher/trunk/src/main/java/org/jboss/mctools/grapher/layout/ReflectionGraphLayout.java, you are only missing a couple lines:
final JGraphSimpleLayout graphLayout =
new JGraphSimpleLayout(JGraphSimpleLayout.TYPE_RANDOM, 100, 100);
final JGraphFacade graphFacade = new JGraphFacade(jgraph);
graphLayout.run(graphFacade);
final Map nestedMap = graphFacade.createNestedMap(true, true);
jgraph.getGraphLayoutCache().edit(nestedMap);
这篇关于jgraph布局不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!