本文整理了Java中org.kie.workbench.common.stunner.core.graph.Edge
类的一些代码示例,展示了Edge
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Edge
类的具体详情如下:
包路径:org.kie.workbench.common.stunner.core.graph.Edge
类名称:Edge
暂无
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets
private void log(final Edge edge) {
if (null != edge) {
final String uuid = edge.getUUID();
final Object content = edge.getContent();
final Node source = edge.getSourceNode();
final String sId = null != source ? source.getUUID() : "null";
final Node target = edge.getTargetNode();
final String tId = null != target ? target.getUUID() : "null";
log("-- Edge [uuid=" + uuid + ", content=" + content.getClass().getName()
+ ", source=" + sId + ", target=" + tId + "]");
} else {
log("Edge is null...");
}
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-case-mgmt-backend
@SuppressWarnings("unchecked")
private void createChild(String uuid, Node parent, Node child, int parentIndex) {
final Edge<Child, Node> edge = new EdgeImpl<>(uuid);
edge.setContent(new Child());
edge.setSourceNode(parent);
edge.setTargetNode(child);
if (parentIndex >= 0) {
parent.getOutEdges().add(parentIndex, edge);
} else {
parent.getOutEdges().add(edge);
}
child.getInEdges().add(edge);
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common
private Predicate<Edge> isDifferentParent() {
return e -> e.getContent() instanceof Child &&
!parent.equals(e.getSourceNode());
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common
private static void validateConnector(Edge edge) {
Objects.requireNonNull(edge, "Edge should not be null");
if (!(edge.getContent() instanceof ViewConnector)) {
throw new IllegalArgumentException("Edge content should be a ViewConnector. Edge UUID: " + edge.getUUID());
}
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
@SuppressWarnings("unchecked")
public SetConnectionSourceNodeCommand(final Node<? extends View<?>, Edge> sourceNode,
final Edge<? extends View, Node> edge,
final Connection connection) {
this(null != sourceNode ? sourceNode.getUUID() : null,
edge.getUUID(),
connection);
this.sourceNode = sourceNode;
this.edge = edge;
this.targetNode = edge.getTargetNode();
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common
@SuppressWarnings("unchecked")
public static void updateEdgeConnections(final Edge<? extends ViewConnector<?>, Node> edge,
final AbstractCanvasHandler context) {
final Node source = edge.getSourceNode();
final Node target = edge.getTargetNode();
edge.getContent().getSourceConnection()
.ifPresent(connection -> updateEdgeConnection(context,
connection,
source));
edge.getContent().getTargetConnection()
.ifPresent(connection -> updateEdgeConnection(context,
connection,
target));
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
private static boolean isNotCyclicEdge(final Edge edge) {
final String sourceId = edge.getSourceNode() != null ? edge.getSourceNode().getUUID() : null;
final String targetId = edge.getTargetNode() != null ? edge.getTargetNode().getUUID() : null;
return !Objects.equals(sourceId, targetId);
}
}
代码示例来源: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
@Override
public void startEdgeTraversal(final Edge<Object, Node> edge) {
log(indent + "Edge UUID: " + edge.getUUID());
final Object content = edge.getContent();
log(" Edge Content: " + content.getClass().getName());
final Node outNode = edge.getTargetNode();
if (outNode == null) {
log(indent + " No outgoing node found");
} else {
log(indent + " Outgoing Node");
log(indent + " ==============");
}
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-lienzo
@SuppressWarnings("unchecked")
private static boolean isTargetChanged(final Node node,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection) {
final ViewConnector vc = connector.getContent();
return (!eq(node,
connector.getTargetNode(),
connection,
null != vc ? vc.getTargetConnection() : Optional.empty()));
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
@SuppressWarnings("unchecked")
private void removeDockEdge(final GraphCommandExecutionContext context,
final Node<?, Edge> parent,
final Node<?, Edge> candidate,
final Edge edge) {
edge.setSourceNode(null);
edge.setTargetNode(null);
parent.getOutEdges().remove(edge);
candidate.getInEdges().remove(edge);
getMutableIndex(context).removeEdge(edge);
}
代码示例来源: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 Edge<? extends View, Node> edge = getEdge(context);
final Node<?, Edge> targetNode = getTargetNode(context);
final Node<? extends View<?>, Edge> lastTargetNode = edge.getTargetNode();
// New connection being made
if (null != lastTargetNode) {
lastTargetNodeUUID = lastTargetNode.getUUID();
lastTargetNode.getInEdges().remove(edge);
}
if (null != targetNode) {
targetNode.getInEdges().add(edge);
}
edge.setTargetNode(targetNode);
// Magnet being moved on node
ViewConnector connectionContent = (ViewConnector) edge.getContent();
lastConnection = (Connection) connectionContent.getTargetConnection().orElse(null);
connectionContent.setTargetConnection(connection);
}
return results;
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
@SuppressWarnings("unchecked")
public Node<? extends View<?>, Edge> getTargetNode(final GraphCommandExecutionContext context) {
if (null == targetNode) {
targetNode = getEdge(context).getTargetNode();
}
return targetNode;
}
代码示例来源: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 Edge<? extends View, Node> edge = getEdge(context);
final Node<?, Edge> sourceNode = getSourceNode(context);
final Node<? extends View<?>, Edge> lastSourceNode = edge.getSourceNode();
// New connection being made
if (null != lastSourceNode) {
this.lastSourceNodeUUID = lastSourceNode.getUUID();
lastSourceNode.getOutEdges().remove(edge);
}
if (null != sourceNode) {
sourceNode.getOutEdges().add(edge);
}
edge.setSourceNode(sourceNode);
// Magnet being moved on node
ViewConnector connectionContent = (ViewConnector) edge.getContent();
lastConnection = (Connection) connectionContent.getSourceConnection().orElse(null);
connectionContent.setSourceConnection(connection);
}
return results;
}
代码示例来源: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
@SuppressWarnings("unchecked")
private Node<? extends View<?>, Edge> getSourceNode(final GraphCommandExecutionContext context) {
if (null == sourceNode) {
sourceNode = (Node<? extends View<?>, Edge>) getEdge(context).getSourceNode();
}
return sourceNode;
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
@Override
public String toString() {
return "AddEdgeCommand [target=" + nodeUUID + ", edge=" + edge.getUUID() + ", magnet=" + connection + "]";
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
targetConnection = MagnetConnection.Builder.forElement(graphInstance.intermNode);
connectorContent.setTargetConnection(targetConnection);
graphInstance.edge1.setContent(connectorContent);
graphInstance.edge2.setContent(connectorContent);
when(cloneElement.asNode()).thenReturn(clone);
when(cloneElement.asEdge()).thenReturn(cloneEdge);
when(cloneEdge.getContent()).thenReturn(connectorContent);
when(cloneEdge.getUUID()).thenReturn(CLONE_EDGE_UUID);
when(clone.getContent()).thenReturn(cloneContent);
when(clone.getUUID()).thenReturn(CLONE_UUID);
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
@SuppressWarnings("unchecked")
public SetConnectionTargetNodeCommand(final Node<? extends View<?>, Edge> targetNode,
final Edge<? extends View, Node> edge,
final Connection connection) {
this(null != targetNode ? targetNode.getUUID() : null,
edge.getUUID(),
connection);
this.edge = PortablePreconditions.checkNotNull("edge",
edge);
this.sourceNode = edge.getSourceNode();
this.targetNode = targetNode;
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
public static Edge mockEdge(String uuid) {
Edge edge = mock(Edge.class);
when(edge.getUUID()).thenReturn(uuid);
when(edge.asEdge()).thenReturn(edge);
return edge;
}
内容来源于网络,如有侵权,请联系作者删除!