Search in sources :

Example 31 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class SequenceFlowPropertyWriter method setWaypoints.

private void setWaypoints(ViewConnector<? extends BPMNViewDefinition> connector) {
    BPMNEdge bpmnEdge = di.createBPMNEdge();
    bpmnEdge.setBpmnElement(sequenceFlow);
    Point2D sourcePt = connector.getSourceConnection().get().getLocation();
    Point2D targetPt = connector.getTargetConnection().get().getLocation();
    org.eclipse.dd.dc.Point sourcePoint = dc.createPoint();
    sourcePoint.setX(source.getShape().getBounds().getX() + (float) sourcePt.getX());
    sourcePoint.setY(source.getShape().getBounds().getY() + (float) sourcePt.getY());
    org.eclipse.dd.dc.Point targetPoint = dc.createPoint();
    targetPoint.setX(target.getShape().getBounds().getX() + (float) targetPt.getX());
    targetPoint.setY(target.getShape().getBounds().getY() + (float) targetPt.getY());
    bpmnEdge.getWaypoint().add(sourcePoint);
    bpmnEdge.getWaypoint().add(targetPoint);
    this.bpmnEdge = bpmnEdge;
}
Also used : Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) BPMNEdge(org.eclipse.bpmn2.di.BPMNEdge) Factories.dc(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.dc)

Example 32 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class GatewayPropertyWriterTest method testSetSourceForInclusiveGateway.

@Test
public void testSetSourceForInclusiveGateway() {
    InclusiveGateway inclusiveGateway = mockGateway(InclusiveGateway.class, ID);
    prepareTestSetSourceOrTarget(inclusiveGateway);
    propertyWriter.setSource(anotherPropertyWriter);
    verify(inclusiveGateway).setDefault(sequenceFlow);
}
Also used : InclusiveGateway(org.eclipse.bpmn2.InclusiveGateway) Test(org.junit.Test)

Example 33 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class SequenceFlowPropertyWriterTest method setControlPoints.

@Test
public void setControlPoints() {
    TestSequenceFlowWriter w = new TestSequenceFlowWriter();
    SequenceFlowPropertyWriter p = w.sequenceFlowOf(SEQ_ID);
    float sx = 10, sy = 10, sWidth = 50, sHeight = 70;
    PropertyWriter source = w.nodeOf(SOURCE_ID, sx, sy, sWidth, sHeight);
    float tx = 100, ty = 100, tWidth = 20, tHeight = 30;
    PropertyWriter target = w.nodeOf(TARGET_ID, tx, ty, tWidth, tHeight);
    p.setSource(source);
    p.setTarget(target);
    // magnets have null location
    ViewConnectorImpl<SequenceFlow> connector = makeConnector();
    connector.setSourceConnection(MagnetConnection.Builder.at(1, 2));
    connector.setTargetConnection(MagnetConnection.Builder.at(2, 3));
    connector.setControlPoints(new ControlPoint[] { ControlPoint.build(Point2D.create(sx + 100, sy + 100)), ControlPoint.build(Point2D.create(sx + 150, sy + 150)) });
    p.setConnection(connector);
    BPMNEdge edge = p.getEdge();
    List<Point> expected = asList(pointOf(sx + 1, sy + 2), pointOf(sx + 100, sy + 100), pointOf(sx + 150, sy + 150), pointOf(tx + 2, ty + 3));
    List<Point> waypoints = edge.getWaypoint();
    assertPointsEqual(expected, waypoints, "when magnet location is defined, waypoints should be translated into an absolute position");
}
Also used : SequenceFlow(org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) Point(org.eclipse.dd.dc.Point) BPMNEdge(org.eclipse.bpmn2.di.BPMNEdge) Test(org.junit.Test)

Example 34 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class TestDefinitionsWriter method sequenceFlowOf.

public SequenceFlow sequenceFlowOf(String id, FlowNode source, FlowNode target, List<Point> waypoints) {
    SequenceFlow sequenceFlow = bpmn2.createSequenceFlow();
    sequenceFlow.setId(id);
    sequenceFlow.setSourceRef(source);
    sequenceFlow.setTargetRef(target);
    BPMNEdge edge = di.createBPMNEdge();
    edge.setBpmnElement(sequenceFlow);
    bpmnPlane.getPlaneElement().add(edge);
    edge.getWaypoint().addAll(waypoints);
    return sequenceFlow;
}
Also used : SequenceFlow(org.eclipse.bpmn2.SequenceFlow) BPMNEdge(org.eclipse.bpmn2.di.BPMNEdge)

Example 35 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class MatchTest method ignoreTestIgnore.

@Test
public void ignoreTestIgnore() {
    ManualTask manualTask = Bpmn2Factory.eINSTANCE.createManualTask();
    Result<BpmnNode> result1 = match().mode(MarshallingRequest.Mode.IGNORE).apply(manualTask);
    assertEquals(result1.value(), defaultValue);
    assertTrue(result1.isIgnored());
    assertFalse(result1.isFailure());
    SequenceFlow sequenceFlow = Bpmn2Factory.eINSTANCE.createSequenceFlow();
    Result<BpmnNode> result2 = match().mode(MarshallingRequest.Mode.IGNORE).apply(sequenceFlow);
    assertEquals(result2.value(), outValue);
    assertTrue(result2.isIgnored());
    assertFalse(result2.isFailure());
}
Also used : ManualTask(org.eclipse.bpmn2.ManualTask) SequenceFlow(org.eclipse.bpmn2.SequenceFlow) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) Test(org.junit.Test)

Aggregations

SequenceFlow (org.eclipse.bpmn2.SequenceFlow)24 Test (org.junit.Test)20 Point (org.eclipse.dd.dc.Point)15 ArrayList (java.util.ArrayList)12 FlowElement (org.eclipse.bpmn2.FlowElement)12 Bounds (org.eclipse.dd.dc.Bounds)11 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)10 FlowNode (org.eclipse.bpmn2.FlowNode)10 Process (org.eclipse.bpmn2.Process)10 SubProcess (org.eclipse.bpmn2.SubProcess)10 BPMNEdge (org.eclipse.bpmn2.di.BPMNEdge)10 RootElement (org.eclipse.bpmn2.RootElement)9 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)7 List (java.util.List)6 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)6 DataObject (org.eclipse.bpmn2.DataObject)6 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)6 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)6 InclusiveGateway (org.eclipse.bpmn2.InclusiveGateway)5 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)5