Search in sources :

Example 1 with SetConnectionTargetNodeCommand

use of org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionTargetNodeCommand in project kie-wb-common by kiegroup.

the class GraphBuilder method addEdge.

private void addEdge(Edge<? extends View<?>, Node> edge, Node source, Connection sourceConnection, Node target, Connection targetConnection) {
    SetConnectionSourceNodeCommand setSourceNode = commandFactory.setSourceNode(source, edge, sourceConnection);
    SetConnectionTargetNodeCommand setTargetNode = commandFactory.setTargetNode(target, edge, targetConnection);
    execute(setSourceNode);
    execute(setTargetNode);
}
Also used : SetConnectionTargetNodeCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionTargetNodeCommand) SetConnectionSourceNodeCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionSourceNodeCommand)

Example 2 with SetConnectionTargetNodeCommand

use of org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionTargetNodeCommand in project kie-wb-common by kiegroup.

the class AbstractEdgeBuilder method buildTargetConnection.

private void buildTargetConnection(BuilderContext context, T edge, Node node, GraphCommandFactory commandFactory) {
    Double[] targetDocker = null;
    if (dockers != null && dockers.size() > 1) {
        targetDocker = dockers.get(dockers.size() - 1);
    }
    Connection targetConnection = null;
    if (null != targetDocker) {
        targetConnection = MagnetConnection.Builder.at(targetDocker[0], targetDocker[1]).setAuto(isTargetAutoConnection());
    }
    SetConnectionTargetNodeCommand setTargetNodeCommand = commandFactory.setTargetNode(node, edge, targetConnection);
    CommandResult<RuleViolation> setTargetResult = context.execute(setTargetNodeCommand);
    if (hasErrors(setTargetResult)) {
        throw new RuntimeException("Error building BPMN graph. Command 'SetConnectionTargetNodeCommand' execution failed.");
    }
}
Also used : SetConnectionTargetNodeCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionTargetNodeCommand) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) MagnetConnection(org.kie.workbench.common.stunner.core.graph.content.view.MagnetConnection) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation)

Aggregations

SetConnectionTargetNodeCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionTargetNodeCommand)2 SetConnectionSourceNodeCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionSourceNodeCommand)1 Connection (org.kie.workbench.common.stunner.core.graph.content.view.Connection)1 MagnetConnection (org.kie.workbench.common.stunner.core.graph.content.view.MagnetConnection)1 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)1