cancel
Showing results for 
Search instead for 
Did you mean: 

How to Name Sequence Flow and make them visible on generated diagram

smadhu
Champ in-the-making
Champ in-the-making
Hi,

         Iam stuck. I need help in naming SequenceFlows. When I use Eclipse Designer Iam able to name Sequence Flows and Also see them in the diagram inside the IDE.

But now the problem is, I have written a small program to generate BPM diagram using Activiti. It works perfectly, but in the generated diagram Iam unable to see the below set sequenceFlow name ( refer below to flow.setName()).  I also tried generating the corresponding BPMN
XML, Iam able to see the name inside the XML. But this is not visible in the generated PNG.  Can anybody help me out in this.

SequenceFlow flow = new SequenceFlow();
flow.setSourceRef(from);
flow.setTargetRef(to);
flow.setName("X > 10");
11 REPLIES 11

shar
Champ in-the-making
Champ in-the-making
I think that the problem solved (Ruckenhof) is not relevant to your situation. It seems to me that the problem lies in the error Activiti Engine. Indeed, the generated PNG, names sequences are absent.
Indeed, in the case of dynamic (via API) describe the process of creating the names of sequences apparently formed incomplete. And therefore are not shown. I can not say exactly why.
However, in my opinion, the case https://github.com/Activiti/Activiti/pull/331 also not relevant to your situation. There is debate about the show names of sequences in Diagram viewer and corrections are included in the file js.

In org.activiti.image.impl.DefaultProcessDiagramCanvas.java:
If replace snippet

            GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId());
            if (labelGraphicInfo != null) {
                processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);
            }

with
            GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId());
            List<GraphicInfo> gi = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId());
            if (labelGraphicInfo != null) {
                processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);
            } else if (gi != null && !gi.isEmpty()){
                processDiagramCanvas.drawLabel(sequenceFlow.getName(), gi.get(0), false);
            }
You view Sequences Names
But I'm not sure that this will be the right decision


frederikherema1
Star Contributor
Star Contributor
shar, thanks for your insight. If one of you could perhaps create a pull-request for this, that would be great  Smiley Wink