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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2014 01:26 AM
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");
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2014 09:07 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2014 08:01 AM
I downloaded 5.16 based on your suggestion and tried the above code example
(flow.setName("x > 10"));
it still does not gets displayed in generated png diagram. Not sure if this feature has been enabled. Can u suggest me how to get this done, is there any alternative.
thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2014 04:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2014 10:04 AM
In org.activiti.image.impl.DefaultProcessDiagramCanvas.java:
1) find method "public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered)"
2) str 1105: replace "int textY = (int) (graphicInfo.getY() + graphicInfo.getHeight());" with "int textY = (int) graphicInfo.getY();"
3) str 1119: replace "double tY = graphicInfo.getY();" with "double tY = graphicInfo.getX();"
In org.activiti.image.impl.DefaultProcessDiagramGenerator.java:
1) find method "protected void drawActivity( …args here )"
2) str 566: comment the line "GraphicInfo lineCenter = getLineCenter(graphicInfoList);"
3) str 567: replace "processDiagramCanvas.drawLabel(sequenceFlow.getName(), lineCenter, false);" with "processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);"
That should fix horizontal and vertical alignment of your labels. Hope this will help you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2014 10:04 AM
Probably needs to be done to fix initProcessDiagramCanvas. Labels at the bottom boundary of the diagram are cut off.
I still do not understand where I need to fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2014 10:21 AM
Modify it like that:
1) add initialization of label's GraphicInfo after line 727:
"GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId());"
2) add the next snippet immediately after, before the declaration of graphicInfoList and appropriate for-loop:
if (labelGraphicInfo.getX() + labelGraphicInfo.getWidth() > maxX) {
maxX = labelGraphicInfo.getX() + labelGraphicInfo.getWidth();
}
if (labelGraphicInfo.getX() < minX) {
minX = labelGraphicInfo.getX();
}
if (labelGraphicInfo.getY() + labelGraphicInfo.getHeight() > maxY) {
maxY = labelGraphicInfo.getY() + labelGraphicInfo.getHeight();
}
if (labelGraphicInfo.getY() < minY) {
minY = labelGraphicInfo.getY();
}
It should push the boundaries of canvas if necessary.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2014 01:25 AM
It is only necessary to insert the check
if (labelGraphicInfo! = null) {
before the snippet.
Like this
if(labelGraphicInfo != null){
if (labelGraphicInfo.getX() + labelGraphicInfo.getWidth() > maxX) {
maxX = labelGraphicInfo.getX() + labelGraphicInfo.getWidth();
}
if (labelGraphicInfo.getX() < minX) {
minX = labelGraphicInfo.getX();
}
if (labelGraphicInfo.getY() + labelGraphicInfo.getHeight() > maxY) {
maxY = labelGraphicInfo.getY() + labelGraphicInfo.getHeight();
}
if (labelGraphicInfo.getY() < minY) {
minY = labelGraphicInfo.getY();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2014 01:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2014 07:51 AM
Thanks for your response, really appreciate your help. I tried as you have mentioned above. But still the label does not gets displayed in the diagram. I have attached my class, the modified files (as you have mentioned above), I'm not sure what's happening, Can you please me out.
thanks
