简体   繁体   English

禁用JGraphX上实际顶点的连接

[英]disable connection of actual vertex on JGraphX

I need to disable connection of actual vertex if edges of vertex >= 2 如果顶点的边缘> = 2,我需要禁用实际顶点的连接

if(graph.getModel().getEdgeCount(cell)>=2){ graphComp.setConnectable(false); // but for actual cell, not for all vertexes }

How can I do that? 我怎样才能做到这一点?

Instead of mxGraphComponent.setConnectable(false) you can disable the connection for one Cell by calling mxCell.setConnectable(false) . 取而代之的mxGraphComponent.setConnectable(false) ,您可以禁用通过调用一个小区中的连接mxCell.setConnectable(false)

If you want it to be enabled again when the edgecount goes down again you can use: 如果您希望在边缘计数再次下降时再次启用它,则可以使用:

int maxEdgeCount = 2;

cell.setConnectable(cell.getEdgeCount < maxEdgeCount);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM