Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果顶点的边缘> = 2,我需要禁用实际顶点的连接
if(graph.getModel().getEdgeCount(cell)>=2){ graphComp.setConnectable(false); // but for actual cell, not for all vertexes }
我怎样才能做到这一点?
而不是mxGraphComponent.setConnectable(false)您可以通过调用禁用一个 Cell 的连接mxCell.setConnectable(false)。
mxGraphComponent.setConnectable(false)
mxCell.setConnectable(false)
如果您希望在 edgecount 再次下降时再次启用它,您可以使用:
int maxEdgeCount = 2; cell.setConnectable(cell.getEdgeCount < maxEdgeCount);