parent
4e518656c5
commit
4af603e5be
|
@ -828,11 +828,10 @@ function BpmnRenderer(events, styles, pathMap) {
|
|||
'bpmn:SubProcess': function(p, element, attrs) {
|
||||
var rect = renderer('bpmn:Activity')(p, element, attrs);
|
||||
|
||||
var semantic = getSemantic(element);
|
||||
var expanded = DiUtil.isExpanded(element);
|
||||
|
||||
var expanded = DiUtil.isExpanded(semantic);
|
||||
var isEventSubProcess = DiUtil.isEventSubProcess(element);
|
||||
|
||||
var isEventSubProcess = !!semantic.triggeredByEvent;
|
||||
if (isEventSubProcess) {
|
||||
rect.attr({
|
||||
strokeDasharray: '1,2'
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
var assign = require('lodash/object/assign'),
|
||||
forEach = require('lodash/collection/forEach'),
|
||||
is = require('../../util/ModelUtil').is;
|
||||
is = require('../../util/ModelUtil').is,
|
||||
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -114,7 +115,8 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
|
||||
if (!is(bpmnElement, 'bpmn:EndEvent') &&
|
||||
!is(bpmnElement, 'bpmn:EventBasedGateway') &&
|
||||
!isEventType(bpmnElement, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition')) {
|
||||
!isEventType(bpmnElement, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
|
||||
!isEventSubProcess(bpmnElement)) {
|
||||
|
||||
assign(actions, {
|
||||
'append.end-event': appendAction('bpmn:EndEvent', 'icon-end-event-none'),
|
||||
|
|
|
@ -9,7 +9,8 @@ var groupBy = require('lodash/collection/groupBy'),
|
|||
var getParents = require('../ModelingUtil').getParents,
|
||||
is = require('../../../util/ModelUtil').is,
|
||||
getBusinessObject = require('../../../util/ModelUtil').getBusinessObject,
|
||||
isExpanded = require('../../../util/DiUtil').isExpanded;
|
||||
isExpanded = require('../../../util/DiUtil').isExpanded,
|
||||
isEventSubProcess = require('../../../util/DiUtil').isEventSubProcess;
|
||||
|
||||
|
||||
var RuleProvider = require('diagram-js/lib/features/rules/RuleProvider');
|
||||
|
@ -204,18 +205,24 @@ function hasEventDefinitionOrNone(element, eventDefinition) {
|
|||
}
|
||||
|
||||
function isSequenceFlowSource(element) {
|
||||
return is(element, 'bpmn:FlowNode') && !is(element, 'bpmn:EndEvent') &&
|
||||
return is(element, 'bpmn:FlowNode') &&
|
||||
!is(element, 'bpmn:EndEvent') &&
|
||||
!isEventSubProcess(element) &&
|
||||
!(is(element, 'bpmn:IntermediateThrowEvent') &&
|
||||
hasEventDefinition(element, 'bpmn:LinkEventDefinition')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function isSequenceFlowTarget(element) {
|
||||
return is(element, 'bpmn:FlowNode') &&
|
||||
!is(element, 'bpmn:StartEvent') &&
|
||||
!is(element, 'bpmn:BoundaryEvent') &&
|
||||
!isEventSubProcess(element) &&
|
||||
!(is(element, 'bpmn:IntermediateCatchEvent') &&
|
||||
hasEventDefinition(element, 'bpmn:LinkEventDefinition'));
|
||||
hasEventDefinition(element, 'bpmn:LinkEventDefinition')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function isEventBasedTarget(element) {
|
||||
|
@ -358,6 +365,11 @@ function canAttach(elements, target, source, position) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// disallow drop on event sub processes
|
||||
if (isEventSubProcess(target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// only allow drop on activities
|
||||
if (!is(target, 'bpmn:Activity')) {
|
||||
return false;
|
||||
|
|
|
@ -14,16 +14,22 @@ var startEventReplace = REPLACE_OPTIONS.START_EVENT,
|
|||
taskReplace = REPLACE_OPTIONS.TASK,
|
||||
subProcessExpandedReplace = REPLACE_OPTIONS.SUBPROCESS_EXPANDED,
|
||||
transactionReplace = REPLACE_OPTIONS.TRANSACTION,
|
||||
boundaryEventReplace = REPLACE_OPTIONS.BOUNDARY_EVENT;
|
||||
eventSubProcessReplace = REPLACE_OPTIONS.EVENT_SUB_PROCESS,
|
||||
boundaryEventReplace = REPLACE_OPTIONS.BOUNDARY_EVENT,
|
||||
eventSubProcessStartEventReplace = REPLACE_OPTIONS.EVENT_SUB_PROCESS_START_EVENT;
|
||||
|
||||
var is = require('../../util/ModelUtil').is,
|
||||
getBusinessObject = require('../../util/ModelUtil').getBusinessObject,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded;
|
||||
isExpanded = require('../../util/DiUtil').isExpanded,
|
||||
isEventSubProcess = require('../../util/DiUtil').isEventSubProcess;
|
||||
|
||||
|
||||
var CUSTOM_PROPERTIES = [
|
||||
'cancelActivity',
|
||||
'instantiate',
|
||||
'eventGatewayType'
|
||||
'eventGatewayType',
|
||||
'triggeredByEvent',
|
||||
'isInterrupting'
|
||||
];
|
||||
|
||||
|
||||
|
@ -84,14 +90,16 @@ function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection, modelin
|
|||
newElement.height = element.height;
|
||||
}
|
||||
|
||||
|
||||
if (is(oldBusinessObject, 'bpmn:SubProcess')) {
|
||||
newElement.isExpanded = isExpanded(oldBusinessObject);
|
||||
}
|
||||
|
||||
// TODO: copy other elligable properties from old business object
|
||||
businessObject.name = oldBusinessObject.name;
|
||||
businessObject.loopCharacteristics = oldBusinessObject.loopCharacteristics;
|
||||
|
||||
// retain loop characteristics if the target element is not an event sub process
|
||||
if (!isEventSubProcess(businessObject)) {
|
||||
businessObject.loopCharacteristics = oldBusinessObject.loopCharacteristics;
|
||||
}
|
||||
|
||||
newElement = replace.replaceElement(element, newElement);
|
||||
|
||||
|
@ -204,10 +212,16 @@ function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection, modelin
|
|||
var menuEntries = [];
|
||||
var businessObject = element.businessObject;
|
||||
|
||||
if (is(businessObject, 'bpmn:StartEvent')) {
|
||||
// start events outside event sub processes
|
||||
if (is(businessObject, 'bpmn:StartEvent') && !isEventSubProcess(businessObject.$parent)) {
|
||||
addEntries(startEventReplace, filterEvents);
|
||||
} else
|
||||
|
||||
// start events inside event sub processes
|
||||
if (is(businessObject, 'bpmn:StartEvent') && isEventSubProcess(businessObject.$parent)) {
|
||||
addEntries(eventSubProcessStartEventReplace, filterEvents);
|
||||
} else
|
||||
|
||||
if (is(businessObject, 'bpmn:IntermediateCatchEvent') ||
|
||||
is(businessObject, 'bpmn:IntermediateThrowEvent')) {
|
||||
|
||||
|
@ -229,16 +243,20 @@ function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection, modelin
|
|||
|
||||
if (is(businessObject, 'bpmn:Transaction')) {
|
||||
|
||||
addEntries(transactionReplace, filterEvents);
|
||||
addEntries(transactionReplace);
|
||||
} else
|
||||
|
||||
if (isEventSubProcess(businessObject) && isExpanded(businessObject)) {
|
||||
|
||||
addEntries(eventSubProcessReplace);
|
||||
} else
|
||||
|
||||
if (is(businessObject, 'bpmn:SubProcess') && isExpanded(businessObject)) {
|
||||
|
||||
addEntries(subProcessExpandedReplace, filterEvents);
|
||||
addEntries(subProcessExpandedReplace);
|
||||
} else
|
||||
|
||||
if (is(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(businessObject)) {
|
||||
|
||||
addEntries(taskReplace, function(entry) {
|
||||
return entry.target.type !== 'bpmn:SubProcess';
|
||||
});
|
||||
|
@ -259,20 +277,31 @@ function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection, modelin
|
|||
|
||||
var target = entry.target;
|
||||
|
||||
var eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0].$type,
|
||||
cancelActivity;
|
||||
|
||||
if (businessObject.$type === 'bpmn:BoundaryEvent') {
|
||||
cancelActivity = target.cancelActivity !== false;
|
||||
}
|
||||
var eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0].$type;
|
||||
|
||||
var isEventDefinitionEqual = target.eventDefinition == eventDefinition,
|
||||
isEventTypeEqual = businessObject.$type == target.type,
|
||||
isInterruptingEqual = businessObject.cancelActivity == cancelActivity;
|
||||
isEventTypeEqual = businessObject.$type == target.type;
|
||||
|
||||
return ((!isEventDefinitionEqual && isEventTypeEqual) ||
|
||||
!isEventTypeEqual) ||
|
||||
!(isEventDefinitionEqual && isEventTypeEqual && isInterruptingEqual);
|
||||
// filter for boundary events
|
||||
if (is(businessObject, 'bpmn:BoundaryEvent')) {
|
||||
var cancelActivity = target.cancelActivity !== false;
|
||||
|
||||
var isCancelActivityEqual = businessObject.cancelActivity == cancelActivity;
|
||||
|
||||
return !(isEventDefinitionEqual && isEventTypeEqual && isCancelActivityEqual);
|
||||
}
|
||||
|
||||
// filter for start events inside event sub processes
|
||||
if (is(businessObject, 'bpmn:StartEvent') && isEventSubProcess(businessObject.$parent)) {
|
||||
var isInterrupting = target.isInterrupting !== false;
|
||||
|
||||
var isInterruptingEqual = businessObject.isInterrupting == isInterrupting;
|
||||
|
||||
return !(isEventDefinitionEqual && isEventDefinitionEqual && isInterruptingEqual);
|
||||
}
|
||||
|
||||
// filter for all other elements
|
||||
return (!isEventDefinitionEqual && isEventTypeEqual) || !isEventTypeEqual;
|
||||
}
|
||||
|
||||
|
||||
|
@ -313,11 +342,13 @@ function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection, modelin
|
|||
var entries = this.getReplaceOptions(element),
|
||||
headerEntries = [];
|
||||
|
||||
if (is(element, 'bpmn:Activity')) {
|
||||
if (is(element, 'bpmn:Activity') && !isEventSubProcess(element)) {
|
||||
headerEntries = headerEntries.concat(this.getLoopEntries(element));
|
||||
}
|
||||
|
||||
if (is(element, 'bpmn:SubProcess') && !is(element, 'bpmn:Transaction')) {
|
||||
if (is(element, 'bpmn:SubProcess') &&
|
||||
!is(element, 'bpmn:Transaction') &&
|
||||
!isEventSubProcess(element)) {
|
||||
headerEntries.push(this.getAdHocEntry(element));
|
||||
}
|
||||
|
||||
|
|
|
@ -347,6 +347,16 @@ module.exports.SUBPROCESS_EXPANDED = [
|
|||
type: 'bpmn:Transaction',
|
||||
isExpanded: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Event Sub Process',
|
||||
actionName: 'replace-with-event-subprocess',
|
||||
className: 'icon-event-subprocess-expanded',
|
||||
target: {
|
||||
type: 'bpmn:SubProcess',
|
||||
triggeredByEvent: true,
|
||||
isExpanded: true
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -356,11 +366,43 @@ module.exports.TRANSACTION = [
|
|||
actionName: 'replace-with-subprocess',
|
||||
className: 'icon-subprocess-expanded',
|
||||
target: {
|
||||
type: 'bpmn:SubProcess'
|
||||
type: 'bpmn:SubProcess',
|
||||
isExpanded: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Event Sub Process',
|
||||
actionName: 'replace-with-event-subprocess',
|
||||
className: 'icon-event-subprocess-expanded',
|
||||
target: {
|
||||
type: 'bpmn:SubProcess',
|
||||
triggeredByEvent: true,
|
||||
isExpanded: true
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.EVENT_SUB_PROCESS = [
|
||||
{
|
||||
label: 'Sub Process',
|
||||
actionName: 'replace-with-subprocess',
|
||||
className: 'icon-subprocess-expanded',
|
||||
target: {
|
||||
type: 'bpmn:SubProcess',
|
||||
isExpanded: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Transaction',
|
||||
actionName: 'replace-with-transaction',
|
||||
className: 'icon-transaction',
|
||||
target: {
|
||||
type: 'bpmn:Transaction',
|
||||
isExpanded: true
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
module.exports.TASK = [
|
||||
{
|
||||
label: 'Task',
|
||||
|
@ -551,3 +593,119 @@ module.exports.BOUNDARY_EVENT = [
|
|||
}
|
||||
},
|
||||
];
|
||||
|
||||
module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||
{
|
||||
label: 'Message Start Event',
|
||||
actionName: 'replace-with-message-start',
|
||||
className: 'icon-start-event-message',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Timer Start Event',
|
||||
actionName: 'replace-with-timer-start',
|
||||
className: 'icon-start-event-timer',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:TimerEventDefinition'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Conditional Start Event',
|
||||
actionName: 'replace-with-conditional-start',
|
||||
className: 'icon-start-event-condition',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:ConditionalEventDefinition'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Signal Start Event',
|
||||
actionName: 'replace-with-signal-start',
|
||||
className: 'icon-start-event-signal',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:SignalEventDefinition'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Error Start Event',
|
||||
actionName: 'replace-with-error-start',
|
||||
className: 'icon-start-event-error',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:ErrorEventDefinition'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Escalation Start Event',
|
||||
actionName: 'replace-with-escalation-start',
|
||||
className: 'icon-start-event-escalation',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:EscalationEventDefinition'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Compensation Start Event',
|
||||
actionName: 'replace-with-compensation-start',
|
||||
className: 'icon-start-event-compensation',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:CompensateEventDefinition'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Message Start Event (non-interrupting)',
|
||||
actionName: 'replace-with-non-interrupting-message-start',
|
||||
className: 'icon-start-event-non-interrupting-message',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:MessageEventDefinition',
|
||||
isInterrupting: false
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Timer Start Event (non-interrupting)',
|
||||
actionName: 'replace-with-non-interrupting-timer-start',
|
||||
className: 'icon-start-event-non-interrupting-timer',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:TimerEventDefinition',
|
||||
isInterrupting: false
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Conditional Start Event (non-interrupting)',
|
||||
actionName: 'replace-with-non-interrupting-conditional-start',
|
||||
className: 'icon-start-event-non-interrupting-condition',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:ConditionalEventDefinition',
|
||||
isInterrupting: false
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Signal Start Event (non-interrupting)',
|
||||
actionName: 'replace-with-non-interrupting-signal-start',
|
||||
className: 'icon-start-event-non-interrupting-signal',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:SignalEventDefinition',
|
||||
isInterrupting: false
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Escalation Start Event (non-interrupting)',
|
||||
actionName: 'replace-with-non-interrupting-escalation-start',
|
||||
className: 'icon-start-event-non-interrupting-escalation',
|
||||
target: {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:EscalationEventDefinition',
|
||||
isInterrupting: false
|
||||
}
|
||||
},
|
||||
];
|
||||
|
|
|
@ -19,3 +19,7 @@ module.exports.isExpanded = function(element) {
|
|||
|
||||
return true;
|
||||
};
|
||||
|
||||
module.exports.isEventSubProcess = function(element) {
|
||||
return element && !!getBusinessObject(element).triggeredByEvent;
|
||||
};
|
||||
|
|
|
@ -16,9 +16,12 @@
|
|||
<bpmn:sequenceFlow id="SequenceFlow_2" sourceRef="Task_1" targetRef="ExclusiveGateway_1" />
|
||||
<bpmn:endEvent id="EndEvent_1">
|
||||
<bpmn:incoming>SequenceFlow_3</bpmn:incoming>
|
||||
<bpmn:incoming>SequenceFlow_8</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_3" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1" />
|
||||
<bpmn:subProcess id="SubProcess_1">
|
||||
<bpmn:incoming>SequenceFlow_7</bpmn:incoming>
|
||||
<bpmn:outgoing>SequenceFlow_6</bpmn:outgoing>
|
||||
<bpmn:startEvent id="StartEvent_2">
|
||||
<bpmn:outgoing>SequenceFlow_4</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
|
@ -32,7 +35,10 @@
|
|||
</bpmn:intermediateThrowEvent>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_5" sourceRef="Task_2" targetRef="IntermediateThrowEvent_1" />
|
||||
</bpmn:subProcess>
|
||||
<bpmn:transaction id="Transaction_1" />
|
||||
<bpmn:transaction id="Transaction_1">
|
||||
<bpmn:incoming>SequenceFlow_6</bpmn:incoming>
|
||||
<bpmn:outgoing>SequenceFlow_8</bpmn:outgoing>
|
||||
</bpmn:transaction>
|
||||
<bpmn:subProcess id="SubProcessCollapsed" />
|
||||
<bpmn:adHocSubProcess id="AdHocSubProcessCollapsed" />
|
||||
<bpmn:adHocSubProcess id="AdHocSubProcessExpanded" />
|
||||
|
@ -40,8 +46,17 @@
|
|||
<bpmn:timerEventDefinition />
|
||||
</bpmn:boundaryEvent>
|
||||
<bpmn:boundaryEvent id="BoundaryEvent_2" attachedToRef="Task_1">
|
||||
<bpmn:outgoing>SequenceFlow_7</bpmn:outgoing>
|
||||
<bpmn:conditionalEventDefinition />
|
||||
</bpmn:boundaryEvent>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_6" sourceRef="SubProcess_1" targetRef="Transaction_1" />
|
||||
<bpmn:sequenceFlow id="SequenceFlow_7" sourceRef="BoundaryEvent_2" targetRef="SubProcess_1" />
|
||||
<bpmn:sequenceFlow id="SequenceFlow_8" sourceRef="Transaction_1" targetRef="EndEvent_1" />
|
||||
<bpmn:subProcess id="EventSubProcess_1" triggeredByEvent="true">
|
||||
<bpmn:startEvent id="StartEvent_3">
|
||||
<bpmn:messageEventDefinition />
|
||||
</bpmn:startEvent>
|
||||
</bpmn:subProcess>
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||
|
@ -143,6 +158,36 @@
|
|||
<dc:Bounds x="273" y="248" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="SequenceFlow_6_di" bpmnElement="SequenceFlow_6">
|
||||
<di:waypoint xsi:type="dc:Point" x="451" y="238" />
|
||||
<di:waypoint xsi:type="dc:Point" x="490" y="238" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="425.5" y="228" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="SequenceFlow_7_di" bpmnElement="SequenceFlow_7">
|
||||
<di:waypoint xsi:type="dc:Point" x="280" y="110" />
|
||||
<di:waypoint xsi:type="dc:Point" x="280" y="138" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="233" y="114" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="SequenceFlow_8_di" bpmnElement="SequenceFlow_8">
|
||||
<di:waypoint xsi:type="dc:Point" x="714" y="138" />
|
||||
<di:waypoint xsi:type="dc:Point" x="714" y="70" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="644.5" y="94" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="EventSubProcess_1_di" bpmnElement="EventSubProcess_1" isExpanded="true">
|
||||
<dc:Bounds x="539" y="370" width="193" height="120" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="StartEvent_3_di" bpmnElement="StartEvent_3">
|
||||
<dc:Bounds x="553" y="411" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="526" y="447" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
||||
|
|
|
@ -523,6 +523,46 @@ describe('features/popup-menu', function() {
|
|||
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
||||
}));
|
||||
|
||||
|
||||
it('should not retain the loop characteristics morphing to an event sub process',
|
||||
inject(function(popupMenu, bpmnReplace, elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction');
|
||||
|
||||
modeling.updateProperties(transaction, { loopCharacteristics: { isparallel: true } });
|
||||
|
||||
openPopup(transaction);
|
||||
|
||||
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
||||
|
||||
// when
|
||||
// replacing the transaction with an event sub process
|
||||
var subProcess = popupMenu.trigger(Events.create(entry, { x: 0, y: 0 }));
|
||||
|
||||
// then
|
||||
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
||||
}));
|
||||
|
||||
|
||||
it('should retain the expanded property morphing to an event sub processes',
|
||||
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction');
|
||||
|
||||
openPopup(transaction);
|
||||
|
||||
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
||||
|
||||
// when
|
||||
// replacing the transaction with an expanded sub process
|
||||
var eventSubProcess = popupMenu.trigger(Events.create(entry, { x: 0, y: 0 }));
|
||||
|
||||
// then
|
||||
expect(isExpanded(eventSubProcess)).to.equal(isExpanded(transaction));
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
describe('replace menu', function() {
|
||||
|
@ -541,8 +581,8 @@ describe('features/popup-menu', function() {
|
|||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
||||
|
||||
// then
|
||||
expect(entriesContainer.childNodes.length).to.equal(6);
|
||||
expect(queryEntry(popupMenu, 'replace-with-none-start')).to.be.null;
|
||||
expect(entriesContainer.childNodes.length).to.equal(6);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -558,8 +598,8 @@ describe('features/popup-menu', function() {
|
|||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
||||
|
||||
// then
|
||||
expect(entriesContainer.childNodes.length).to.equal(12);
|
||||
expect(queryEntry(popupMenu, 'replace-with-none-intermediate-throw')).to.be.null;
|
||||
expect(entriesContainer.childNodes.length).to.equal(12);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -575,8 +615,50 @@ describe('features/popup-menu', function() {
|
|||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
||||
|
||||
// then
|
||||
expect(entriesContainer.childNodes.length).to.equal(9);
|
||||
expect(queryEntry(popupMenu, 'replace-with-none-end')).to.be.null;
|
||||
expect(entriesContainer.childNodes.length).to.equal(9);
|
||||
}));
|
||||
|
||||
|
||||
it('should contain all start events inside event sub process except the current one',
|
||||
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_3');
|
||||
|
||||
// when
|
||||
openPopup(startEvent);
|
||||
|
||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
||||
|
||||
// then
|
||||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-start')).to.be.defined;
|
||||
expect(queryEntry(popupMenu, 'replace-with-message-start')).to.be.null;
|
||||
expect(entriesContainer.childNodes.length).to.equal(11);
|
||||
}));
|
||||
|
||||
|
||||
it('should contain all non interrupting start events inside event sub process except the current one',
|
||||
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_3');
|
||||
|
||||
var newElement = bpmnReplace.replaceElement(startEvent, {
|
||||
type: 'bpmn:StartEvent',
|
||||
eventDefinition: 'bpmn:ConditionalEventDefinition',
|
||||
isInterrupting: false
|
||||
});
|
||||
|
||||
// when
|
||||
openPopup(newElement);
|
||||
|
||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
||||
|
||||
// then
|
||||
expect(queryEntry(popupMenu, 'replace-with-conditional-start')).to.be.defined;
|
||||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-conditional-start')).to.be.null;
|
||||
expect(entriesContainer.childNodes.length).to.equal(11);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -592,8 +674,8 @@ describe('features/popup-menu', function() {
|
|||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
||||
|
||||
// then
|
||||
expect(queryEntry(popupMenu, 'replace-with-conditional-intermediate-catch')).to.be.null;
|
||||
expect(entriesContainer.childNodes.length).to.equal(10);
|
||||
expect(queryEntry(popupMenu, 'replace-with-message-intermediate-catch')).to.be.null;
|
||||
}));
|
||||
|
||||
|
||||
|
@ -609,8 +691,8 @@ describe('features/popup-menu', function() {
|
|||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
||||
|
||||
// then
|
||||
expect(entriesContainer.childNodes.length).to.equal(10);
|
||||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-intermediate-catch')).to.be.null;
|
||||
expect(entriesContainer.childNodes.length).to.equal(10);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -8,7 +8,8 @@ var modelingModule = require('../../../../lib/features/modeling'),
|
|||
replaceModule = require('../../../../lib/features/replace'),
|
||||
coreModule = require('../../../../lib/core'),
|
||||
is = require('../../../../lib/util/ModelUtil').is,
|
||||
isExpanded = require('../../../../lib/util/DiUtil').isExpanded;
|
||||
isExpanded = require('../../../../lib/util/DiUtil').isExpanded,
|
||||
isEventSubProcess = require('../../../../lib/util/DiUtil').isEventSubProcess;
|
||||
|
||||
|
||||
describe('features/replace', function() {
|
||||
|
@ -99,6 +100,25 @@ describe('features/replace', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('event sub process', inject(function(elementRegistry, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var transaction = elementRegistry.get('SubProcess_1'),
|
||||
newElementData = {
|
||||
type: 'bpmn:SubProcess',
|
||||
triggeredByEvent: true
|
||||
};
|
||||
|
||||
// when
|
||||
var newElement = bpmnReplace.replaceElement(transaction, newElementData);
|
||||
|
||||
// then
|
||||
expect(newElement).to.be.defined;
|
||||
expect(isEventSubProcess(newElement)).to.be.true;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
it('non interrupting boundary event by interrupting boundary event',
|
||||
inject(function(elementRegistry, modeling, bpmnReplace, canvas) {
|
||||
|
||||
|
@ -357,6 +377,27 @@ describe('features/replace', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should remove connections for event sub processes',
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1');
|
||||
var newElementData = {
|
||||
type: 'bpmn:SubProcess',
|
||||
triggeredByEvent: true
|
||||
};
|
||||
|
||||
// when
|
||||
var newElement = bpmnReplace.replaceElement(transaction, newElementData);
|
||||
|
||||
// then
|
||||
var incoming = newElement.incoming[0],
|
||||
outgoing = newElement.outgoing[0];
|
||||
|
||||
expect(incoming).to.be.undefined;
|
||||
expect(outgoing).to.be.undefined;
|
||||
}));
|
||||
|
||||
describe('undo support', function() {
|
||||
|
||||
it('should reconnect valid connections',
|
||||
|
@ -438,7 +479,7 @@ describe('features/replace', function() {
|
|||
|
||||
expect(incoming).to.be.defined;
|
||||
expect(outgoing).to.be.undefined;
|
||||
expect(source).to.eql(elementRegistry.get('ExclusiveGateway_1'));
|
||||
expect(source).to.eql(elementRegistry.get('Transaction_1'));
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue