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

x33g5p2x  于2022-01-19 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.kie.workbench.common.stunner.core.graph.Edge.getContent()方法的一些代码示例,展示了Edge.getContent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Edge.getContent()方法的具体详情如下:
包路径:org.kie.workbench.common.stunner.core.graph.Edge
类名称:Edge
方法名:getContent

Edge.getContent介绍

暂无

代码示例

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

private long countEdges(List<Edge> inEdges) {
    return inEdges.stream()
        .filter(e -> e.getContent() instanceof ViewConnector)
        .count();
  }
}

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

private static Function<List<Edge>, Edge> getViewConnector() {
  return edges -> edges
      .stream()
      .filter(e -> e.getContent() instanceof ViewConnector)
      .findAny()
      .get();
}

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

private static List<Edge<? extends ViewConnector<?>, Node>> getConnections(List<? extends Edge> edges) {
  return edges.stream()
      .filter(edge -> (edge.getContent() instanceof ViewConnector))
      .map(edge -> (Edge<? extends ViewConnector<?>, Node>) edge)
      .collect(Collectors.toList());
}

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

@SuppressWarnings("unchecked")
public static Element<?> getParent(final Node<?, ? extends Edge> element) {
  return Optional.ofNullable(element)
      .map(Node::getInEdges)
      .orElse(Collections.emptyList())
      .stream()
      .filter(e -> e.getContent() instanceof Child)
      .findAny()
      .map(Edge::getSourceNode)
      .orElse(null);
}

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

@Override
public void endEdgeTraversal(final Edge edge) {
  super.endEdgeTraversal(edge);
  if (edge.getContent() instanceof Child) {
    this.currentParents.pop();
  }
}

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

private static boolean isRelationshipConnector(Edge e) {
    return e.getContent() instanceof Parent
        || e.getContent() instanceof Child
        || e.getContent() instanceof Dock;
  }
}

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

private static boolean isRelationshipConnector(Edge e) {
    return e.getContent() instanceof Parent
        || e.getContent() instanceof Child
        || e.getContent() instanceof Dock;
  }
}

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

public static Optional<Node> getDockParent(final Node<?, ? extends Edge> element) {
  return Objects.nonNull(element.getInEdges()) ?
      element.getInEdges()
          .stream()
          .filter(edge -> edge.getContent() instanceof Dock)
          .map(Edge::getSourceNode)
          .findFirst() :
      Optional.empty();
}

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

@Inject
public ChildrenTraverseProcessorImpl(final TreeWalkTraverseProcessor treeWalkTraverseProcessor) {
  super(treeWalkTraverseProcessor);
  treeWalkTraverseProcessor.useStartNodePredicate(node -> !node.getInEdges().stream()
      .filter(e -> e.getContent() instanceof Child)
      .findAny()
      .isPresent());
}

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

@Override
public void endEdgeTraversal(final Edge edge) {
  if (edge.getContent() instanceof View) {
    callback.endViewEdgeTraversal(edge);
  } else if (edge.getContent() instanceof Child) {
    callback.endChildEdgeTraversal(edge);
  } else if (edge.getContent() instanceof Parent) {
    callback.endParentEdgeTraversal(edge);
  } else {
    callback.endEdgeTraversal(edge);
  }
}

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

@SuppressWarnings("unchecked")
public static boolean hasChildren(final Node<?, ? extends Edge> element) {
  return Objects.nonNull(element.getOutEdges()) ?
      element.getOutEdges().stream()
          .anyMatch(edge -> (edge.getContent() instanceof Child)) :
      false;
}

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

public static boolean isDockedNode(final Node<?, ? extends Edge> element) {
  return Objects.nonNull(element.getInEdges()) ?
      element.getInEdges()
          .stream()
          .anyMatch(edge -> edge.getContent() instanceof Dock) :
      false;
}

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

public Result<BasePropertyWriter> toFlowElement(Edge<?, ?> edge,
                          ElementContainer process) {
    if (edge.getContent() instanceof ViewConnector && ((ViewConnector) edge.getContent()).getDefinition() instanceof SequenceFlow) {
      return converterFactory.sequenceFlowConverter().toFlowElement(edge,
                                     process);
    } else if (edge.getContent() instanceof ViewConnector && ((ViewConnector) edge.getContent()).getDefinition() instanceof Association) {
      return converterFactory.associationFlowConverter().toFlowElement(edge,
                                       process);
    }
    return Result.failure("Converter is not implemented for edge content type: " + edge.getContent());
  }
}

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

private static Optional<ControlPoint> getControlPointyByIndex(final Edge edge,
                               final int index) {
  ViewConnector viewConnector = (ViewConnector) edge.getContent();
  return viewConnector.getControlPoints().stream()
      .filter(cp -> Objects.nonNull(cp.getIndex()))
      .filter(cp -> cp.getIndex() == index - 1)
      .findFirst();
}

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

@SuppressWarnings("unchecked")
private static Node getParent(final Node node) {
  List<Edge> inEdges = node.getInEdges();
  if (null != inEdges && !inEdges.isEmpty()) {
    for (final Edge edge : inEdges) {
      if (edge.getContent() instanceof Child) {
        return edge.getSourceNode();
      }
    }
  }
  return null;
}

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

private ViewConnector getInEdgeViewConnector(Node node) {
  List<Edge> edges = node.getInEdges();
  if (edges != null) {
    for (Edge edge : edges) {
      if (edge.getContent() instanceof ViewConnector) {
        return (ViewConnector) edge.getContent();
      }
    }
  }
  return null;
}

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

private ViewConnector getInEdgeViewConnector(Node node) {
  List<Edge> edges = node.getInEdges();
  if (edges != null) {
    for (Edge edge : edges) {
      if (edge.getContent() instanceof ViewConnector) {
        return (ViewConnector) edge.getContent();
      }
    }
  }
  return null;
}

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

private ViewConnector getOutEdgeViewConnector(Node node) {
  List<Edge> edges = node.getOutEdges();
  if (edges != null) {
    for (Edge edge : edges) {
      if (edge.getContent() instanceof ViewConnector) {
        return (ViewConnector) edge.getContent();
      }
    }
  }
  return null;
}

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

@SuppressWarnings("unchecked")
private void createEdge(String uuid, Node sourceNode, Node targetNode) {
  final Edge<View<SequenceFlow>, Node> edge = typedFactoryManager.newEdge(uuid, SequenceFlow.class);
  edge.setSourceNode(sourceNode);
  edge.setTargetNode(targetNode);
  sourceNode.getOutEdges().add(edge);
  targetNode.getInEdges().add(edge);
  ViewConnector<SequenceFlow> content = (ViewConnector<SequenceFlow>) edge.getContent();
  content.setSourceConnection(MagnetConnection.Builder.forElement(sourceNode));
  content.setTargetConnection(MagnetConnection.Builder.forElement(targetNode));
}

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

@Test
@SuppressWarnings("unchecked")
public void testAccepts() {
  when(ruleExtension.getTypeArguments()).thenReturn(new Class[]{ParentDefinition.class});
  when(containmentContext.getCandidate()).thenReturn(nodeA);
  when(containmentContext.getParent()).thenReturn(parentNode);
  nodeA.getInEdges().add(edge);
  when(edge.getContent()).thenReturn(viewConnector);
  assertTrue(tested.accepts(ruleExtension,
               containmentContext));
}

相关文章