Skip to content

Commit

Permalink
fixed behavior of MessageFlow
Browse files Browse the repository at this point in the history
Issue #296
  • Loading branch information
rsoika committed Sep 25, 2023
1 parent 1789fb5 commit c06b383
Showing 1 changed file with 2 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import org.openbpmn.bpmn.exceptions.BPMNModelException;
import org.openbpmn.extensions.BPMNElementExtension;
import org.openbpmn.glsp.bpmn.BPMNGEdge;
import org.openbpmn.glsp.bpmn.BPMNGNode;
import org.openbpmn.glsp.bpmn.DataObjectGNode;
import org.openbpmn.glsp.bpmn.EventGNode;
import org.openbpmn.glsp.bpmn.GatewayGNode;
Expand Down Expand Up @@ -274,47 +273,24 @@ public GGraph buildGGraph(final BPMNModel model) {
}

// Next add all Message objects.
// A message object is not assigned to any process. But in case the message is
// placed on a Pool it should become a child of this parent GNode.
// See issue #244
// A message object is not assigned to any process!
for (Message message : modelState.getBpmnModel().getMessages()) {
logger.debug("message: " + message.getName());
GPoint point = computeRelativeGPoint(message.getBounds(), null);
List<GModelElement> containerNodeList = gRootNodeList; // default add message to root

// If the message contained by a Pool we add the message to the poolGNode
Participant participant = null;
if (modelState.getBpmnModel().isCollaborationDiagram()) {
participant = modelState.getBpmnModel()
.findParticipantByPoint(message.getBounds().getPosition());
if (participant != null) {
BPMNGNode poolGNode = null;
try {
point = computeRelativeGPoint(message.getBounds(), participant);
// find PoolGNode
poolGNode = (BPMNGNode) findPoolGNode(participant.getId(), gRootNodeList);
} catch (BPMNMissingElementException e) {
// no match - add the message to the root...
}
if (poolGNode != null) {
containerNodeList = poolGNode.getChildren();
}
}
}

// Build the GLSP Node....
MessageGNode messageNode = new MessageGNodeBuilder(message) //
.position(point) //
.build();
containerNodeList.add(messageNode);
// now add a GLabel
BPMNLabel bpmnLabel = message.getLabel();
LabelGNode labelNode = createLabelNode(bpmnLabel, message, participant);
LabelGNode labelNode = createLabelNode(bpmnLabel, message, null);
containerNodeList.add(labelNode);

// finally apply BPMN Extensions
applyBPMNElementExtensions(messageNode, message);

}

// Add all MessageFlow elements...
Expand Down

0 comments on commit c06b383

Please sign in to comment.