use of org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape 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.bpmndi.BpmnShape in project camunda-bpmn-model by camunda.
the class AbstractFlowNodeBuilder method createTarget.
protected <T extends FlowNode> T createTarget(Class<T> typeClass, String identifier) {
T target = createSibling(typeClass, identifier);
BpmnShape targetBpmnShape = createBpmnShape(target);
setCoordinates(targetBpmnShape);
connectTarget(target);
resizeSubProcess(targetBpmnShape);
return target;
}
use of org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape in project camunda-bpmn-model by camunda.
the class DiGeneratorForFlowNodesTest method shouldGenerateShapeForBlankSubProcess.
@Test
public void shouldGenerateShapeForBlankSubProcess() {
// given
ProcessBuilder processBuilder = Bpmn.createExecutableProcess();
// when
instance = processBuilder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).endEvent(END_EVENT_ID).done();
// then
Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class);
assertEquals(3, allShapes.size());
BpmnShape bpmnShapeSubProcess = findBpmnShape(SUB_PROCESS_ID);
assertNotNull(bpmnShapeSubProcess);
assertSubProcessSize(bpmnShapeSubProcess);
assertTrue(bpmnShapeSubProcess.isExpanded());
}
use of org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape in project camunda-bpmn-model by camunda.
the class DiGeneratorForFlowNodesTest method shouldGenerateShapeForBoundaryIntermediateEvent.
@Test
public void shouldGenerateShapeForBoundaryIntermediateEvent() {
// given
ProcessBuilder processBuilder = Bpmn.createExecutableProcess();
// when
instance = processBuilder.startEvent(START_EVENT_ID).userTask(USER_TASK_ID).endEvent(END_EVENT_ID).moveToActivity(USER_TASK_ID).boundaryEvent(BOUNDARY_ID).conditionalEventDefinition(CONDITION_ID).condition(TEST_CONDITION).conditionalEventDefinitionDone().endEvent().done();
// then
Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class);
assertEquals(5, allShapes.size());
assertEventShapeProperties(BOUNDARY_ID);
}
use of org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape in project camunda-bpmn-model by camunda.
the class DiGeneratorForFlowNodesTest method findBpmnShape.
protected BpmnShape findBpmnShape(String id) {
Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class);
Iterator<BpmnShape> iterator = allShapes.iterator();
while (iterator.hasNext()) {
BpmnShape shape = iterator.next();
if (shape.getBpmnElement().getId().equals(id)) {
return shape;
}
}
return null;
}
Aggregations