How to dynamically generate a flowchart of vertical layout

cancel
Showing results for 
Search instead for 
Did you mean: 
hankzhousandy
Member II

How to dynamically generate a flowchart of vertical layout

new BpmnAutoLayout(model).execute();

this create a  flowchart  of horizontal layout,How to dynamically generate a flowchart of vertical layout?

3 Replies
cjose
Senior Member II

Re: How to dynamically generate a flowchart of vertical layout

Not sure if I understood the question, could you please explain the use case/question a little bit more so that we can help?

hankzhousandy
Member II

Re: How to dynamically generate a flowchart of vertical layout

process.addFlowElement(createStartEvent());
process.addFlowElement(createUserTask("task1", "node01", "candidateGroup1"));
process.addFlowElement(createUserTask("task2", "node02", "candidateGroup2"));
process.addFlowElement(createEndEvent());

process.addFlowElement(createSequenceFlow("startEvent", "task1", "", ""));
process.addFlowElement(createSequenceFlow("task1", "task2", "", ""));
process.addFlowElement(createSequenceFlow("task2", "endEvent", "", ""));
// 2. Generate graphical information
new BpmnAutoLayout(model).execute();
// 3. Deploy the process to the engine
Deployment deployment = repositoryService.createDeployment()
        .addBpmnModel(PROCESS_ID+".bpmn", model).name(PROCESS_ID+"_deployment").deploy();
// 4. Start a process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_ID);

// 5. Check if task is available
List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
Assert.assertEquals(1, tasks.size());

// 6. Save process diagram to a file
InputStream processDiagram = repositoryService
        .getProcessDiagram(processInstance.getProcessDefinitionId());
FileUtils.copyInputStreamToFile(processDiagram, new File("/deployments/"+PROCESS_ID+".png"));

the code, png show horizontal

i like this 

I don't know how to do it

salaboy
Senior Member

Re: How to dynamically generate a flowchart of vertical layout

So you probably need to hack your own version of 

new BpmnAutoLayout(model)

And probably check this: Activiti/BpmnAutoLayout.java at develop · Activiti/Activiti · GitHub