org.kie.workbench.common.stunner.core.graph.Graph.clear()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(135)

本文整理了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

Graph.clear介绍

暂无

代码示例

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

  1. protected void destroyGraph(final Command callback) {
  2. destroyGraphIndex(() -> {
  3. if (null != diagram && null != diagram.getGraph()) {
  4. diagram.getGraph().clear();
  5. }
  6. callback.execute();
  7. });
  8. }

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

  1. @Test
  2. public void testExecute() {
  3. CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext);
  4. assertEquals(CommandResult.Type.INFO,
  5. result.getType());
  6. verify(graph,
  7. times(1)).clear();
  8. verify(graphIndex,
  9. times(1)).clear();
  10. }

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

  1. @Override
  2. @SuppressWarnings("unchecked")
  3. public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) {
  4. final CommandResult<RuleViolation> results = allow(context);
  5. if (!results.getType().equals(CommandResult.Type.ERROR)) {
  6. final Graph<?, Node> graph = getGraph(context);
  7. if (hasRootUUID()) {
  8. Iterator<Node> nodes = graph.nodes().iterator();
  9. if (null != nodes) {
  10. nodes.forEachRemaining(node -> {
  11. if (!node.getUUID().equals(rootUUID)) {
  12. getMutableIndex(context).removeNode(node);
  13. nodes.remove();
  14. } else {
  15. // Clear outgoing edges for canvas root element.
  16. node.getOutEdges().stream().forEach(edge -> getMutableIndex(context).removeEdge((Edge) edge));
  17. node.getOutEdges().clear();
  18. }
  19. });
  20. }
  21. } else {
  22. graph.clear();
  23. getMutableIndex(context).clear();
  24. }
  25. }
  26. return results;
  27. }

相关文章