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

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

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

Edge.setSourceNode介绍

暂无

代码示例

代码示例来源: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-case-mgmt-client

@SuppressWarnings("unchecked")
private void removeRelationship(final Edge e,
                final Node parent,
                final Node child,
                final GraphCommandExecutionContext context) {
  e.setSourceNode(null);
  e.setTargetNode(null);
  parent.getOutEdges().remove(e);
  child.getInEdges().remove(e);
  getMutableIndex(context).removeEdge(e);
}

代码示例来源: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/kie-wb-common-dmn-api

@SuppressWarnings("unchecked")
  private void connectNodes(final Node source,
               final Node target,
               final Edge connector) {
    source.getOutEdges().add(connector);
    target.getInEdges().add(connector);
    connector.setSourceNode(source);
    connector.setTargetNode(target);
  }
}

代码示例来源: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-case-mgmt-client

@SuppressWarnings("unchecked")
private void addRelationship(final Node parent,
               final Node child,
               final OptionalInt index,
               final GraphCommandExecutionContext context) {
  final String uuid = UUID.uuid();
  final Edge<Child, Node> edge = new EdgeImpl<>(uuid);
  edge.setContent(new Child());
  edge.setSourceNode(parent);
  edge.setTargetNode(child);
  parent.getOutEdges().add(index.orElseGet(() -> parent.getOutEdges().size()), edge);
  child.getInEdges().add(edge);
  getMutableIndex(context).addEdge(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> 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-core-common

@Override
public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) {
  final CommandResult<RuleViolation> results = allow(context);
  if (!results.getType().equals(CommandResult.Type.ERROR)) {
    final Node<?, Edge> parent = getParent(context);
    final Node<?, Edge> candidate = getCandidate(context);
    final Edge<Parent, Node> edge = getEdgeForTarget(parent,
                             candidate);
    if (null != edge) {
      edge.setSourceNode(null);
      edge.setTargetNode(null);
      parent.getInEdges().remove(edge);
      candidate.getOutEdges().remove(edge);
      getMutableIndex(context).removeEdge(edge);
    }
  }
  return results;
}

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

@Override
public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) {
  final CommandResult<RuleViolation> results = allow(context);
  if (!results.getType().equals(CommandResult.Type.ERROR)) {
    final Node<?, Edge> parent = getParent(context);
    final Node<?, Edge> candidate = getCandidate(context);
    final Edge<Parent, Node> edge = getEdgeForTarget(parent,
                             candidate);
    if (null != edge) {
      edge.setSourceNode(null);
      edge.setTargetNode(null);
      parent.getOutEdges().remove(edge);
      candidate.getInEdges().remove(edge);
      getMutableIndex(context).removeEdge(edge);
    }
  }
  return results;
}

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

times(1)).setSourceConnection(any(Connection.class));
verify(edge,
    times(1)).setSourceNode(eq(node));
verify(targetInEdges,
    times(0)).remove(any(Edge.class));

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

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
  super.init();
  this.parent = mockNode(PARENT_UUID);
  this.candidate = mockNode(CANDIDATE_UUID);
  this.edge = new EdgeImpl<>(EDGE_UUID);
  this.edge.setContent(new Dock());
  this.edge.setSourceNode(parent);
  this.edge.setTargetNode(candidate);
  when(graphIndex.getNode(eq(PARENT_UUID))).thenReturn(parent);
  when(graphIndex.getNode(eq(CANDIDATE_UUID))).thenReturn(candidate);
  when(graphIndex.getEdge(eq(EDGE_UUID))).thenReturn(edge);
  when(parent.getOutEdges()).thenReturn(parentOutEdges);
  when(candidate.getInEdges()).thenReturn(candidateInEdges);
  parentOutEdges.add(edge);
  candidateInEdges.add(edge);
  this.tested = new UnDockNodeCommand(PARENT_UUID,
                    CANDIDATE_UUID);
}

代码示例来源: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 Node<?, Edge> parent = getParent(context);
    final Node<?, Edge> candidate = getCandidate(context);
    final String uuid = UUID.uuid();
    final Edge<Child, Node> edge = new EdgeImpl<>(uuid);
    edge.setContent(new Child());
    edge.setSourceNode(parent);
    edge.setTargetNode(candidate);
    parent.getOutEdges().add(edge);
    candidate.getInEdges().add(edge);
    getMutableIndex(context).addEdge(edge);
  }
  return results;
}

代码示例来源: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 Node<?, Edge> parent = getParent(context);
    final Node<?, Edge> candidate = getCandidate(context);
    final String uuid = UUID.uuid();
    final Edge<Dock, Node> edge = new EdgeImpl<>(uuid);
    edge.setContent(new Dock());
    edge.setSourceNode(parent);
    edge.setTargetNode(candidate);
    parent.getOutEdges().add(edge);
    candidate.getInEdges().add(edge);
    getMutableIndex(context).addEdge(edge);
  }
  return results;
}

代码示例来源: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 Node<?, Edge> parent = getParent(context);
    final Node<?, Edge> candidate = getCandidate(context);
    // TODO: Create a ParentEdgeFactory iface extending EdgeFactory using as content generics type Relationship
    final String uuid = UUID.uuid();
    final Edge<Parent, Node> edge = new EdgeImpl<>(uuid);
    edge.setContent(new Parent());
    edge.setSourceNode(parent);
    edge.setTargetNode(candidate);
    parent.getOutEdges().add(edge);
    candidate.getInEdges().add(edge);
    getMutableIndex(context).addEdge(edge);
  }
  return results;
}

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

c1.setSourceNode(node1);
c1.setTargetNode(node2);

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

@Override
@SuppressWarnings("unchecked")
public ToolboxAction<AbstractCanvasHandler> onMouseClick(final AbstractCanvasHandler canvasHandler,
                             final String uuid,
                             final MouseClickEvent event) {
  // Obtain the connector and source node instances for proxying.
  final Element<?> element = CanvasLayoutUtils.getElement(canvasHandler,
                              uuid);
  final Node<View<?>, Edge> sourceNode = (Node<View<?>, Edge>) element.asNode();
  final Edge<? extends ViewConnector<?>, Node> connector =
      (Edge<? extends ViewConnector<?>, Node>) clientFactoryManager
          .newElement(UUID.uuid(),
                edgeId)
          .asEdge();
  // Set the transient connection to the source node, for further rule evaluations.
  connector.setSourceNode(sourceNode);
  // Built and show a connector drag proxy, to check and finally set
  // candidate the target node.
  final double x = event.getX();
  final double y = event.getY();
  dragProxy = showDragProxy(canvasHandler,
               connector,
               sourceNode,
               (int) x,
               (int) y);
  return this;
}

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

existingConnector.setSourceNode(node1);
existingConnector.setTargetNode(node2);

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

@Before
public void setup() {
  super.setup();
  this.parent = CommandTestUtils.makeNode("uuid1",
                      "parent",
                      10.0,
                      20.0,
                      50.0,
                      50.0);
  this.candidate = CommandTestUtils.makeNode("uuid2",
                        "candidate",
                        10.0,
                        20.0,
                        50.0,
                        50.0);
  this.command = new CaseManagementRemoveChildCommand(parent,
                            candidate);
  final Edge<Child, Node> edge = new EdgeImpl<>("edge1");
  edge.setContent(new Child());
  edge.setSourceNode(parent);
  edge.setTargetNode(candidate);
  parent.getOutEdges().add(edge);
  candidate.getInEdges().add(edge);
}

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

stageInEdge.setSourceNode(rootNode);
stageInEdge.setTargetNode(stageNode);
stageInEdge.setContent(new Child());
subcaseInEdge.setSourceNode(stageNode);
subcaseInEdge.setTargetNode(subcaseNode);
subcaseInEdge.setContent(new Child());

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

stageInEdge.setSourceNode(rootNode);
stageInEdge.setTargetNode(stageNode);
stageInEdge.setContent(new Child());

相关文章