Changing the BPMN sample to use vertical lanes will be a lot of work. I think the BPMN project code started from the Swim Lanes sample, whereas you want to start from the Swim Lanes (vertical) sample. If you don’t actually need BPMN graphical notation, it might be easiest to start over from the “Vertical” Swim Lanes sample and add what you do need.
If you add the code to the “Pool” Group template to handle a drop of a lane Group, then the user can drag-and-drop lanes between pools. Note that this requires them to drop onto the “Pool” header – the lane Group mouseDrop event handler disallows dropping any groups into a lane Group.
myDiagram.groupTemplateMap.add("Pool",
$(go.Group, "Auto", groupStyle(),
{ // use a simple layout that ignores links to stack the "lane" Groups next to each other
layout: $(PoolLayout, { spacing: new go.Size(0, 0) }), // no space between lanes
computesBoundsAfterDrag: true, // needed to prevent recomputing Group.placeholder bounds too soon
handlesDragDropForMembers: true, // don't need to define handlers on member Nodes and Links
mouseDrop: function(e, grp) { // dropping a copy of some Nodes and Links onto this Group adds them to this Group
// don't allow drag-and-dropping a mix of regular Nodes and Groups
if (e.diagram.selection.all(function(n) { return n instanceof go.Group && n.category !== "Pool"; })) {
var ok = grp.addMembers(grp.diagram.selection, true);
if (ok) {
updateCrossLaneLinks(grp);
} else {
grp.diagram.currentTool.doCancel();
}
} else {
e.diagram.currentTool.doCancel();
}
},
},
Thank you.
The sample ‘BPMN’ is really too complex for me.
At first,I used the ‘Swim Lanes’ as a template,but I failed in add a vertical-pool group too.
I will restart with ’ Swim Lanes’
ok,
Can I add the “Swim Lanes Vertical” sample’s groupTemplate to gouptemplateMap to support it?
I tried, but the effect was not ideal.
In “Swim Lanes” sample, if I add a new node in some lane use “diagram.model.addNodeData” without “relayoutLanes”,the node will be “disappear”
The Diagram.groupTemplate, which is the default template for groups, is exactly the same template as the one named “” (the empty string) in the Diagram.groupTemplateMap.
If a Node does not have a real location (i.e. if Node.location doesn’t have a real value for Point.x and Point.y), how can the diagram know where to draw the node? That’s why if you do not set or bind the node’s location to a real point, a layout has to happen in order to assign a location to the node.