Search in sources :

Example 31 with Waypoint

use of org.camunda.bpm.model.bpmn.instance.di.Waypoint in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldPlaceExclusiveGateway.

@Test
public void shouldPlaceExclusiveGateway() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId(SEQUENCE_FLOW_ID).exclusiveGateway("id").done();
    Bounds gatewayBounds = findBpmnShape("id").getBounds();
    assertShapeCoordinates(gatewayBounds, 186, 93);
    Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge(SEQUENCE_FLOW_ID).getWaypoints();
    Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 136, 118);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 186, 118);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Waypoint(org.camunda.bpm.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Example 32 with Waypoint

use of org.camunda.bpm.model.bpmn.instance.di.Waypoint in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldPlaceUserTask.

@Test
public void shouldPlaceUserTask() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId(SEQUENCE_FLOW_ID).userTask(USER_TASK_ID).done();
    Bounds userTaskBounds = findBpmnShape(USER_TASK_ID).getBounds();
    assertShapeCoordinates(userTaskBounds, 186, 78);
    Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge(SEQUENCE_FLOW_ID).getWaypoints();
    Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 136, 118);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 186, 118);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Waypoint(org.camunda.bpm.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Example 33 with Waypoint

use of org.camunda.bpm.model.bpmn.instance.di.Waypoint in project camunda-bpmn-model by camunda.

the class AbstractBoundaryEventBuilder method setWaypointsWithSourceAndTarget.

@Override
protected void setWaypointsWithSourceAndTarget(BpmnEdge edge, FlowNode edgeSource, FlowNode edgeTarget) {
    BpmnShape source = findBpmnShape(edgeSource);
    BpmnShape target = findBpmnShape(edgeTarget);
    if (source != null && target != null) {
        Bounds sourceBounds = source.getBounds();
        Bounds targetBounds = target.getBounds();
        double sourceX = sourceBounds.getX();
        double sourceY = sourceBounds.getY();
        double sourceWidth = sourceBounds.getWidth();
        double sourceHeight = sourceBounds.getHeight();
        double targetX = targetBounds.getX();
        double targetY = targetBounds.getY();
        double targetHeight = targetBounds.getHeight();
        Waypoint w1 = createInstance(Waypoint.class);
        w1.setX(sourceX + sourceWidth / 2);
        w1.setY(sourceY + sourceHeight);
        Waypoint w2 = createInstance(Waypoint.class);
        w2.setX(sourceX + sourceWidth / 2);
        w2.setY(sourceY + sourceHeight + SPACE);
        Waypoint w3 = createInstance(Waypoint.class);
        w3.setX(targetX);
        w3.setY(targetY + targetHeight / 2);
        edge.addChildElement(w1);
        edge.addChildElement(w2);
        edge.addChildElement(w3);
    }
}
Also used : BpmnShape(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Waypoint(org.camunda.bpm.model.bpmn.instance.di.Waypoint)

Example 34 with Waypoint

use of org.camunda.bpm.model.bpmn.instance.di.Waypoint in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldPlaceFollowingFlowNodeForSubProcess.

@Test
public void shouldPlaceFollowingFlowNodeForSubProcess() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).boundaryEvent("boundary").sequenceFlowId(SEQUENCE_FLOW_ID).endEvent(END_EVENT_ID).moveToActivity(SUB_PROCESS_ID).endEvent().done();
    Bounds endEventBounds = findBpmnShape(END_EVENT_ID).getBounds();
    assertShapeCoordinates(endEventBounds, 391.5, 268);
    Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge(SEQUENCE_FLOW_ID).getWaypoints();
    Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 361, 236);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 391.5, 286);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Waypoint(org.camunda.bpm.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Aggregations

Waypoint (org.camunda.bpm.model.bpmn.instance.di.Waypoint)34 Bounds (org.camunda.bpm.model.bpmn.instance.dc.Bounds)33 Test (org.junit.Test)31 ProcessBuilder (org.camunda.bpm.model.bpmn.builder.ProcessBuilder)30 BpmnShape (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape)2 Point (org.camunda.bpm.model.bpmn.instance.dc.Point)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1