Search in sources :

Example 21 with Bounds

use of org.camunda.bpm.model.bpmn.instance.dc.Bounds in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldPlaceCompensation.

@Test
public void shouldPlaceCompensation() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent().userTask("task").boundaryEvent("boundary").compensateEventDefinition().compensateEventDefinitionDone().compensationStart().userTask("compensate").name("compensate").compensationDone().userTask("task2").boundaryEvent("boundary2").compensateEventDefinition().compensateEventDefinitionDone().compensationStart().userTask("compensate2").name("compensate2").compensationDone().endEvent("theend").done();
    Bounds compensationBounds = findBpmnShape("compensate").getBounds();
    assertShapeCoordinates(compensationBounds, 266.5, 186);
    Bounds compensation2Bounds = findBpmnShape("compensate2").getBounds();
    assertShapeCoordinates(compensation2Bounds, 416.5, 186);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Test(org.junit.Test)

Example 22 with Bounds

use of org.camunda.bpm.model.bpmn.instance.dc.Bounds in project camunda-bpmn-model by camunda.

the class BoundsImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Bounds.class, DC_ELEMENT_BOUNDS).namespaceUri(DC_NS).instanceProvider(new ModelTypeInstanceProvider<Bounds>() {

        public Bounds newInstance(ModelTypeInstanceContext instanceContext) {
            return new BoundsImpl(instanceContext);
        }
    });
    xAttribute = typeBuilder.doubleAttribute(DC_ATTRIBUTE_X).required().build();
    yAttribute = typeBuilder.doubleAttribute(DC_ATTRIBUTE_Y).required().build();
    widthAttribute = typeBuilder.doubleAttribute(DC_ATTRIBUTE_WIDTH).required().build();
    heightAttribute = typeBuilder.doubleAttribute(DC_ATTRIBUTE_HEIGHT).required().build();
    typeBuilder.build();
}
Also used : Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 23 with Bounds

use of org.camunda.bpm.model.bpmn.instance.dc.Bounds in project camunda-bpmn-model by camunda.

the class EmbeddedSubProcessBuilder method startEvent.

public StartEventBuilder startEvent(String id) {
    StartEvent start = subProcessBuilder.createChild(StartEvent.class, id);
    BpmnShape startShape = subProcessBuilder.createBpmnShape(start);
    BpmnShape subProcessShape = subProcessBuilder.findBpmnShape(subProcessBuilder.getElement());
    if (subProcessShape != null) {
        Bounds subProcessBounds = subProcessShape.getBounds();
        Bounds startBounds = startShape.getBounds();
        double subProcessX = subProcessBounds.getX();
        double subProcessY = subProcessBounds.getY();
        double subProcessHeight = subProcessBounds.getHeight();
        double startHeight = startBounds.getHeight();
        startBounds.setX(subProcessX + SPACE);
        startBounds.setY(subProcessY + subProcessHeight / 2 - startHeight / 2);
    }
    return start.builder();
}
Also used : BpmnShape(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) StartEvent(org.camunda.bpm.model.bpmn.instance.StartEvent)

Example 24 with Bounds

use of org.camunda.bpm.model.bpmn.instance.dc.Bounds in project camunda-bpmn-model by camunda.

the class ProcessBuilder method setCoordinates.

@Override
protected void setCoordinates(BpmnShape targetBpmnShape) {
    Bounds bounds = targetBpmnShape.getBounds();
    bounds.setX(100);
    bounds.setY(100);
}
Also used : Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds)

Example 25 with Bounds

use of org.camunda.bpm.model.bpmn.instance.dc.Bounds in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldPlaceManualTask.

@Test
public void shouldPlaceManualTask() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId(SEQUENCE_FLOW_ID).manualTask(TASK_ID).done();
    Bounds manualTaskBounds = findBpmnShape(TASK_ID).getBounds();
    assertShapeCoordinates(manualTaskBounds, 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)

Aggregations

Bounds (org.camunda.bpm.model.bpmn.instance.dc.Bounds)60 ProcessBuilder (org.camunda.bpm.model.bpmn.builder.ProcessBuilder)45 Test (org.junit.Test)45 Waypoint (org.camunda.bpm.model.bpmn.instance.di.Waypoint)33 BpmnShape (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape)12 StartEvent (org.camunda.bpm.model.bpmn.instance.StartEvent)2 SubProcess (org.camunda.bpm.model.bpmn.instance.SubProcess)2 ArrayList (java.util.ArrayList)1 BoundaryEvent (org.camunda.bpm.model.bpmn.instance.BoundaryEvent)1 BpmnPlane (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnPlane)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1