根据节点选择折叠 jung 节点
当用户单击顶点时,我试图折叠顶点的所有子节点。但问题是,每次我尝试这样做时,都会出现以下错误:
Tree must not contain edu.ics.jung.graph.DelegateForest@17510d96
代码如下:
public void graphClicked(MyNode v, MouseEvent me)
{
Collection<MyNode> childrens = graph.getChildren(v);
Collection picked = new Hashset(childrens);
if(picked.size>1)
{
Graph ingraph = this.radialLayout.getGraph();
Graph clusterGraph = collapser.getClusterGraph(graph,childrens);
Graph g = collapser.collapse(ingraph,clustergraph); //The error report points on this line
.
.
.
}
}
我正在使用 Forest
和 RadialLayout
。 谁能帮助我吗?我该如何解决这个问题?
I am trying to collapse all the children of a vertex when a user clicks on it. But the problem is that, every time I tried to do so, I got the following error:
Tree must not contain edu.ics.jung.graph.DelegateForest@17510d96
The code is given below:
public void graphClicked(MyNode v, MouseEvent me)
{
Collection<MyNode> childrens = graph.getChildren(v);
Collection picked = new Hashset(childrens);
if(picked.size>1)
{
Graph ingraph = this.radialLayout.getGraph();
Graph clusterGraph = collapser.getClusterGraph(graph,childrens);
Graph g = collapser.collapse(ingraph,clustergraph); //The error report points on this line
.
.
.
}
}
I am using a Forest
with RadialLayout
.
Can anyone help me? How can I solve the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在此处查看树节点折叠和顶点折叠演示:
http://jung.sourceforge.net/applet /index.html
其中每个的源代码都包含在分发文件中。
Check out the tree node collapse and vertex collapse demos here:
http://jung.sourceforge.net/applet/index.html
The source for each of these is included in the distribution files.