mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-28 09:44:49 +00:00
d3449ca87c
* use ES6 import / export * UTILS: export individual utilities * TESTS: localize TestHelper includes BREAKING CHANGE: * all utilities export independent functions * library sources got ported to ES6. You must now use a ES module bundler such as Browserify + babelify or Webpack to consume this library (or parts of it).
40 lines
938 B
JavaScript
40 lines
938 B
JavaScript
'use strict';
|
|
|
|
import inherits from 'inherits';
|
|
|
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
|
|
import { is } from '../../../util/ModelUtil';
|
|
|
|
|
|
/**
|
|
* BPMN specific create data object behavior
|
|
*/
|
|
export default function CreateDataObjectBehavior(eventBus, bpmnFactory, moddle) {
|
|
|
|
CommandInterceptor.call(this, eventBus);
|
|
|
|
this.preExecute('shape.create', function(event) {
|
|
|
|
var context = event.context,
|
|
shape = context.shape;
|
|
|
|
if (is(shape, 'bpmn:DataObjectReference') && shape.type !== 'label') {
|
|
|
|
// create a DataObject every time a DataObjectReference is created
|
|
var dataObject = bpmnFactory.create('bpmn:DataObject');
|
|
|
|
// set the reference to the DataObject
|
|
shape.businessObject.dataObjectRef = dataObject;
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
CreateDataObjectBehavior.$inject = [
|
|
'eventBus',
|
|
'bpmnFactory',
|
|
'moddle'
|
|
];
|
|
|
|
inherits(CreateDataObjectBehavior, CommandInterceptor); |