parent
b2f2f1a29c
commit
738a8a64f6
|
@ -130,7 +130,7 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
|
|||
paper
|
||||
.path('M 0,0 7.089123,3.1832974 0.00383366,6.1129516 -7.0814464,3.1832966 z')
|
||||
.attr({
|
||||
'fill': 'white',
|
||||
'fill': 'White',
|
||||
'stroke': 'Black'
|
||||
})
|
||||
.marker(0, 0, 15, 15, 0, 0)
|
||||
|
@ -143,7 +143,27 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
|
|||
'stroke-width': 1,
|
||||
'stroke-dasharray': '1,0',
|
||||
'refX': -8,
|
||||
'refY': 3.15
|
||||
'refY': 3.15
|
||||
}));
|
||||
|
||||
addMarker('conditional-default-flow-marker',
|
||||
paper
|
||||
.path('M 3,0 10,11')
|
||||
.attr({
|
||||
'fill': 'Black',
|
||||
'stroke': 'Black'
|
||||
})
|
||||
.marker(0, 0, 15, 15, 0, 0)
|
||||
.attr({
|
||||
markerUnits: 'strokeWidth',
|
||||
markerWidth: 14.296,
|
||||
markerHeight: 7.238,
|
||||
orient: 'auto',
|
||||
overflow: 'visible',
|
||||
'stroke-width': 1,
|
||||
'stroke-dasharray': '1,0',
|
||||
'refX': -4,
|
||||
'refY': 5.5
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -1072,12 +1092,34 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
|
|||
'bpmn:SequenceFlow': function(p, data) {
|
||||
var polyline = drawLine(p, data.waypoints);
|
||||
|
||||
if(!!bpmnRegistry.getSemantic(data.id).conditionExpression) {
|
||||
var sequence = bpmnRegistry.getSemantic(data.id);
|
||||
|
||||
// Conditional Flow Marker
|
||||
if(!!sequence.conditionExpression) {
|
||||
polyline.attr({
|
||||
'marker-start': marker('conditional-flow-marker')
|
||||
});
|
||||
}
|
||||
|
||||
// Default Marker
|
||||
var srcRef = sequence.sourceRef;
|
||||
if(!!srcRef) {
|
||||
var source = bpmnRegistry.getSemantic(srcRef);
|
||||
if(!!source &&
|
||||
(source.$type === 'bpmn:InclusiveGateway' ||
|
||||
source.$type === 'bpmn:ExclusiveGateway')) {
|
||||
|
||||
if(!!source.default
|
||||
&& source.default.$type === 'bpmn:SequenceFlow'
|
||||
&& source.default.id === data.id) {
|
||||
polyline.attr({
|
||||
'marker-start': marker('conditional-default-flow-marker')
|
||||
});
|
||||
}
|
||||
console.log(source);
|
||||
}
|
||||
}
|
||||
|
||||
return polyline.attr({
|
||||
'marker-end': marker('sequenceflow-end')
|
||||
});
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:signavio="http://www.signavio.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exporter="Signavio Process Editor, http://www.signavio.com" exporterVersion="8.0.0" expressionLanguage="http://www.w3.org/1999/XPath" id="sid-1237c256-d5c0-45c1-8de1-85c54c149d71" targetNamespace="http://www.signavio.com/bpmn20" typeLanguage="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd">
|
||||
<error id="sid-5331eecf-9770-4621-b761-edb204ace8c2"/>
|
||||
<process id="sid-29e45cb7-375a-4e9c-bc1b-b509fac3af2f" isClosed="false" isExecutable="false" processType="None">
|
||||
<startEvent id="sid-7A06429D-56D7-4A95-B057-A81E8AAE9F70">
|
||||
<outgoing>sid-F71776EB-FC77-47EC-A608-4D90422C9C9D</outgoing>
|
||||
</startEvent>
|
||||
<exclusiveGateway default="sid-8372F73C-BF60-4F06-A520-F3D010C17849" gatewayDirection="Diverging" id="sid-6FD586BF-818E-453D-ADB7-B9E8C95596A8">
|
||||
<incoming>sid-F71776EB-FC77-47EC-A608-4D90422C9C9D</incoming>
|
||||
<outgoing>sid-8372F73C-BF60-4F06-A520-F3D010C17849</outgoing>
|
||||
<outgoing>sid-586C231A-A870-475A-9CC7-6E5EB7D96EA0</outgoing>
|
||||
</exclusiveGateway>
|
||||
<task completionQuantity="1" id="sid-BAA241BA-8AA8-4106-9717-294A216FF28D" isForCompensation="false" startQuantity="1">
|
||||
<incoming>sid-8372F73C-BF60-4F06-A520-F3D010C17849</incoming>
|
||||
<outgoing>sid-2AD76A90-5C48-48D5-A1A4-B965E9A176F1</outgoing>
|
||||
</task>
|
||||
<inclusiveGateway default="sid-3D50F08F-F5CA-41F5-8B2D-8AC1E3EE12C1" gatewayDirection="Diverging" id="sid-1D5E8A2E-CCF0-4408-8C11-2BE2020AF37E">
|
||||
<incoming>sid-2AD76A90-5C48-48D5-A1A4-B965E9A176F1</incoming>
|
||||
<outgoing>sid-3D50F08F-F5CA-41F5-8B2D-8AC1E3EE12C1</outgoing>
|
||||
<outgoing>sid-F24B422A-FC22-444F-9B47-B6220BC8BC79</outgoing>
|
||||
</inclusiveGateway>
|
||||
<task completionQuantity="1" id="sid-86596B6B-5D90-4B16-8468-796474369165" isForCompensation="false" startQuantity="1">
|
||||
<incoming>sid-3D50F08F-F5CA-41F5-8B2D-8AC1E3EE12C1</incoming>
|
||||
<outgoing>sid-F861C2E1-3A74-4EE0-850B-ED7251335F00</outgoing>
|
||||
</task>
|
||||
<endEvent id="sid-7251BCEA-F239-4774-A789-47A20DED025F">
|
||||
<extensionElements>
|
||||
<signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
|
||||
<signavio:signavioMetaData metaKey="userstory" metaValue=""/>
|
||||
</extensionElements>
|
||||
<incoming>sid-F861C2E1-3A74-4EE0-850B-ED7251335F00</incoming>
|
||||
</endEvent>
|
||||
<endEvent id="sid-B7F91CEA-A9C9-4988-ADDF-FF3028089433">
|
||||
<incoming>sid-586C231A-A870-475A-9CC7-6E5EB7D96EA0</incoming>
|
||||
<incoming>sid-F24B422A-FC22-444F-9B47-B6220BC8BC79</incoming>
|
||||
<errorEventDefinition errorRef="sid-5331eecf-9770-4621-b761-edb204ace8c2" id="sid-0a185b30-23c4-420b-9f03-9cda63a102ac"/>
|
||||
</endEvent>
|
||||
<sequenceFlow id="sid-F71776EB-FC77-47EC-A608-4D90422C9C9D" sourceRef="sid-7A06429D-56D7-4A95-B057-A81E8AAE9F70" targetRef="sid-6FD586BF-818E-453D-ADB7-B9E8C95596A8" />
|
||||
<sequenceFlow id="sid-8372F73C-BF60-4F06-A520-F3D010C17849" sourceRef="sid-6FD586BF-818E-453D-ADB7-B9E8C95596A8" targetRef="sid-BAA241BA-8AA8-4106-9717-294A216FF28D" />
|
||||
<sequenceFlow id="sid-2AD76A90-5C48-48D5-A1A4-B965E9A176F1" sourceRef="sid-BAA241BA-8AA8-4106-9717-294A216FF28D" targetRef="sid-1D5E8A2E-CCF0-4408-8C11-2BE2020AF37E" />
|
||||
<sequenceFlow id="sid-3D50F08F-F5CA-41F5-8B2D-8AC1E3EE12C1" sourceRef="sid-1D5E8A2E-CCF0-4408-8C11-2BE2020AF37E" targetRef="sid-86596B6B-5D90-4B16-8468-796474369165" />
|
||||
<sequenceFlow id="sid-F861C2E1-3A74-4EE0-850B-ED7251335F00" sourceRef="sid-86596B6B-5D90-4B16-8468-796474369165" targetRef="sid-7251BCEA-F239-4774-A789-47A20DED025F" />
|
||||
<sequenceFlow id="sid-586C231A-A870-475A-9CC7-6E5EB7D96EA0" sourceRef="sid-6FD586BF-818E-453D-ADB7-B9E8C95596A8" targetRef="sid-B7F91CEA-A9C9-4988-ADDF-FF3028089433" />
|
||||
<sequenceFlow id="sid-F24B422A-FC22-444F-9B47-B6220BC8BC79" sourceRef="sid-1D5E8A2E-CCF0-4408-8C11-2BE2020AF37E" targetRef="sid-B7F91CEA-A9C9-4988-ADDF-FF3028089433" />
|
||||
</process>
|
||||
<bpmndi:BPMNDiagram id="sid-339b903e-4940-4c07-ad81-fa001943ae61">
|
||||
<bpmndi:BPMNPlane bpmnElement="sid-29e45cb7-375a-4e9c-bc1b-b509fac3af2f" id="sid-cb926257-3364-4f38-b166-a7a651d63bd4">
|
||||
<bpmndi:BPMNShape bpmnElement="sid-7A06429D-56D7-4A95-B057-A81E8AAE9F70" id="sid-7A06429D-56D7-4A95-B057-A81E8AAE9F70_gui">
|
||||
<omgdc:Bounds height="30.0" width="30.0" x="75.0" y="270.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="sid-6FD586BF-818E-453D-ADB7-B9E8C95596A8" id="sid-6FD586BF-818E-453D-ADB7-B9E8C95596A8_gui" isMarkerVisible="true">
|
||||
<omgdc:Bounds height="40.0" width="40.0" x="285.0" y="265.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="sid-BAA241BA-8AA8-4106-9717-294A216FF28D" id="sid-BAA241BA-8AA8-4106-9717-294A216FF28D_gui">
|
||||
<omgdc:Bounds height="80.0" width="100.0" x="505.0" y="245.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="sid-1D5E8A2E-CCF0-4408-8C11-2BE2020AF37E" id="sid-1D5E8A2E-CCF0-4408-8C11-2BE2020AF37E_gui">
|
||||
<omgdc:Bounds height="40.0" width="40.0" x="535.0" y="420.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="sid-86596B6B-5D90-4B16-8468-796474369165" id="sid-86596B6B-5D90-4B16-8468-796474369165_gui">
|
||||
<omgdc:Bounds height="80.0" width="100.0" x="255.0" y="400.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="sid-7251BCEA-F239-4774-A789-47A20DED025F" id="sid-7251BCEA-F239-4774-A789-47A20DED025F_gui">
|
||||
<omgdc:Bounds height="28.0" width="28.0" x="76.0" y="426.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="sid-B7F91CEA-A9C9-4988-ADDF-FF3028089433" id="sid-B7F91CEA-A9C9-4988-ADDF-FF3028089433_gui">
|
||||
<omgdc:Bounds height="28.0" width="28.0" x="785.0" y="75.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-2AD76A90-5C48-48D5-A1A4-B965E9A176F1" id="sid-2AD76A90-5C48-48D5-A1A4-B965E9A176F1_gui">
|
||||
<omgdi:waypoint x="555.128617363344" y="325.0"/>
|
||||
<omgdi:waypoint x="555.4340836012861" y="420.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-F24B422A-FC22-444F-9B47-B6220BC8BC79" id="sid-F24B422A-FC22-444F-9B47-B6220BC8BC79_gui">
|
||||
<omgdi:waypoint x="575.0" y="440.5"/>
|
||||
<omgdi:waypoint x="799.0" y="440.5"/>
|
||||
<omgdi:waypoint x="799.0" y="103.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-F71776EB-FC77-47EC-A608-4D90422C9C9D" id="sid-F71776EB-FC77-47EC-A608-4D90422C9C9D_gui">
|
||||
<omgdi:waypoint x="105.0" y="285.03480278422273"/>
|
||||
<omgdi:waypoint x="285.0" y="285.4524361948956"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-F861C2E1-3A74-4EE0-850B-ED7251335F00" id="sid-F861C2E1-3A74-4EE0-850B-ED7251335F00_gui">
|
||||
<omgdi:waypoint x="255.0" y="440.0"/>
|
||||
<omgdi:waypoint x="104.0" y="440.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-8372F73C-BF60-4F06-A520-F3D010C17849" id="sid-8372F73C-BF60-4F06-A520-F3D010C17849_gui">
|
||||
<omgdi:waypoint x="325.0" y="285.4609218436874"/>
|
||||
<omgdi:waypoint x="505.0" y="285.1002004008016"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-586C231A-A870-475A-9CC7-6E5EB7D96EA0" id="sid-586C231A-A870-475A-9CC7-6E5EB7D96EA0_gui">
|
||||
<omgdi:waypoint x="305.5" y="265.0"/>
|
||||
<omgdi:waypoint x="305.5" y="89.0"/>
|
||||
<omgdi:waypoint x="785.0" y="89.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-3D50F08F-F5CA-41F5-8B2D-8AC1E3EE12C1" id="sid-3D50F08F-F5CA-41F5-8B2D-8AC1E3EE12C1_gui">
|
||||
<omgdi:waypoint x="535.0" y="440.45908183632736"/>
|
||||
<omgdi:waypoint x="355.0" y="440.0998003992016"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</definitions>
|
|
@ -28,6 +28,17 @@ describe('draw/BpmnRenderer', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should render conditional default flows', function(done) {
|
||||
|
||||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/conditional-default-flow.bpmn', 'utf8');
|
||||
|
||||
var renderer = new Viewer(container);
|
||||
|
||||
renderer.importXML(xml, function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should render conditional flows', function(done) {
|
||||
|
||||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/conditional-flow.bpmn', 'utf8');
|
||||
|
|
Loading…
Reference in New Issue