parent
b9bf021bed
commit
566f0eadaa
|
@ -115,7 +115,8 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|||
// SHAPE
|
||||
else if (is(di, 'bpmndi:BPMNShape')) {
|
||||
|
||||
var collapsed = !isExpanded(semantic);
|
||||
var collapsed = !isExpanded(semantic),
|
||||
isFrame = isFrameElement(semantic);
|
||||
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
||||
|
||||
var bounds = semantic.di.bounds;
|
||||
|
@ -126,7 +127,8 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|||
x: Math.round(bounds.x),
|
||||
y: Math.round(bounds.y),
|
||||
width: Math.round(bounds.width),
|
||||
height: Math.round(bounds.height)
|
||||
height: Math.round(bounds.height),
|
||||
isFrame: isFrame
|
||||
}));
|
||||
|
||||
if (is(semantic, 'bpmn:BoundaryEvent')) {
|
||||
|
@ -333,3 +335,7 @@ function isPointInsideBBox(bbox, point) {
|
|||
y >= bbox.y &&
|
||||
y <= bbox.y + bbox.height;
|
||||
}
|
||||
|
||||
function isFrameElement(semantic) {
|
||||
return is(semantic, 'bpmn:Group');
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="simple" targetNamespace="http://bpmn.io/schema/bpmn" exporter="camunda modeler" exporterVersion="2.6.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
|
||||
<bpmn2:process id="Process_1" isExecutable="false">
|
||||
<bpmn2:group id="Group_1" categoryValueRef="CategoryValue_1o9po2j" />
|
||||
</bpmn2:process>
|
||||
<bpmn2:category id="Category_0fj5y1s">
|
||||
<bpmn2:categoryValue id="CategoryValue_1o9po2j" />
|
||||
</bpmn2:category>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||
<bpmndi:BPMNShape id="Group_1_di" bpmnElement="Group_1">
|
||||
<dc:Bounds x="280" y="60" width="430" height="360" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn2:definitions>
|
|
@ -480,6 +480,38 @@ describe('import - Importer', function() {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
it('should import groups', function(done) {
|
||||
|
||||
// given
|
||||
var xml = require('../../fixtures/bpmn/import/groups.bpmn');
|
||||
|
||||
var events = [];
|
||||
|
||||
// log events
|
||||
diagram.get('eventBus').on('bpmnElement.added', function(e) {
|
||||
events.push({
|
||||
type: 'add',
|
||||
semantic: e.element.businessObject.id,
|
||||
di: e.element.businessObject.di.id,
|
||||
diagramElement: e.element && e.element.id,
|
||||
isFrame: e.element && e.element.isFrame
|
||||
});
|
||||
});
|
||||
|
||||
// when
|
||||
runImport(diagram, xml, function(err) {
|
||||
|
||||
// then
|
||||
expect(events).to.eql([
|
||||
{ type: 'add', semantic: 'Process_1', di: 'BPMNPlane_1', diagramElement: 'Process_1', isFrame: undefined },
|
||||
{ type: 'add', semantic: 'Group_1', di: 'Group_1_di', diagramElement: 'Group_1', isFrame: true }
|
||||
]);
|
||||
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue