feature(contextpad): add catch events to pad for event based gateways
close #206
This commit is contained in:
parent
e665895448
commit
6aceab9dbf
|
@ -96,10 +96,11 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
|
||||
|
||||
|
||||
function appendAction(type, className) {
|
||||
function appendAction(type, className, options) {
|
||||
|
||||
function appendListener(event, element) {
|
||||
var shape = elementFactory.createShape({ type: type });
|
||||
|
||||
var shape = elementFactory.createShape(assign({ type: type }, options));
|
||||
create.start(event, shape, element);
|
||||
}
|
||||
|
||||
|
@ -139,6 +140,18 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
|
||||
assign(actions, {
|
||||
'append.receive-task': appendAction('bpmn:ReceiveTask', 'icon-receive-task'),
|
||||
'append.message-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'icon-02-message-intermediate-event',
|
||||
{ _eventDefinitionType: 'bpmn:MessageEventDefinition'}),
|
||||
'append.timer-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'icon-03-timer-intermediate-event',
|
||||
{ _eventDefinitionType: 'bpmn:TimerEventDefinition'}),
|
||||
'append.condtion-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'icon-05-conditional-intermediate-event',
|
||||
{ _eventDefinitionType: 'bpmn:ConditionalEventDefinition'}),
|
||||
'append.signal-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'icon-10-signal-intermediate-event',
|
||||
{ _eventDefinitionType: 'bpmn:SignalEventDefinition'}),
|
||||
'connect': {
|
||||
group: 'connect',
|
||||
className: 'icon-connection',
|
||||
|
|
|
@ -9,15 +9,16 @@ var BaseElementFactory = require('diagram-js/lib/core/ElementFactory'),
|
|||
/**
|
||||
* A bpmn-aware factory for diagram-js shapes
|
||||
*/
|
||||
function ElementFactory(bpmnFactory) {
|
||||
function ElementFactory(bpmnFactory, moddle) {
|
||||
BaseElementFactory.call(this);
|
||||
|
||||
this._bpmnFactory = bpmnFactory;
|
||||
this._moddle = moddle;
|
||||
}
|
||||
|
||||
ElementFactory.prototype = Object.create(BaseElementFactory.prototype);
|
||||
|
||||
ElementFactory.$inject = [ 'bpmnFactory' ];
|
||||
ElementFactory.$inject = [ 'bpmnFactory', 'moddle' ];
|
||||
|
||||
module.exports = ElementFactory;
|
||||
|
||||
|
@ -65,6 +66,14 @@ ElementFactory.prototype.create = function(elementType, attrs) {
|
|||
businessObject.di.isMarkerVisible = true;
|
||||
}
|
||||
|
||||
if (attrs._eventDefinitionType) {
|
||||
var eventDefinitions = businessObject.get('eventDefinitions') || [],
|
||||
newEventDefinition = this._moddle.create(attrs._eventDefinitionType);
|
||||
|
||||
eventDefinitions.push(newEventDefinition);
|
||||
businessObject.eventDefinitions = eventDefinitions;
|
||||
}
|
||||
|
||||
size = this._getDefaultSize(businessObject);
|
||||
|
||||
attrs = assign({
|
||||
|
|
Loading…
Reference in New Issue