本文整理了Java中org.kie.workbench.common.stunner.core.graph.Graph.clear()
方法的一些代码示例,展示了Graph.clear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.clear()
方法的具体详情如下:
包路径:org.kie.workbench.common.stunner.core.graph.Graph
类名称:Graph
方法名:clear
暂无
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common
protected void destroyGraph(final Command callback) {
destroyGraphIndex(() -> {
if (null != diagram && null != diagram.getGraph()) {
diagram.getGraph().clear();
}
callback.execute();
});
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
@Test
public void testExecute() {
CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext);
assertEquals(CommandResult.Type.INFO,
result.getType());
verify(graph,
times(1)).clear();
verify(graphIndex,
times(1)).clear();
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
@Override
@SuppressWarnings("unchecked")
public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) {
final CommandResult<RuleViolation> results = allow(context);
if (!results.getType().equals(CommandResult.Type.ERROR)) {
final Graph<?, Node> graph = getGraph(context);
if (hasRootUUID()) {
Iterator<Node> nodes = graph.nodes().iterator();
if (null != nodes) {
nodes.forEachRemaining(node -> {
if (!node.getUUID().equals(rootUUID)) {
getMutableIndex(context).removeNode(node);
nodes.remove();
} else {
// Clear outgoing edges for canvas root element.
node.getOutEdges().stream().forEach(edge -> getMutableIndex(context).removeEdge((Edge) edge));
node.getOutEdges().clear();
}
});
}
} else {
graph.clear();
getMutableIndex(context).clear();
}
}
return results;
}
内容来源于网络,如有侵权,请联系作者删除!