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);
}
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();
}
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();
}
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);
}
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);
}
Aggregations