bpmn-js 8.8.2 → 9.0.0-subprocesses.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/assets/bpmn-js.css +79 -0
  3. package/dist/assets/diagram-js.css +82 -78
  4. package/dist/bpmn-modeler.development.js +929 -502
  5. package/dist/bpmn-modeler.production.min.js +7 -6
  6. package/dist/bpmn-navigated-viewer.development.js +20574 -19973
  7. package/dist/bpmn-navigated-viewer.production.min.js +22 -20
  8. package/dist/bpmn-viewer.development.js +19775 -19174
  9. package/dist/bpmn-viewer.production.min.js +22 -20
  10. package/lib/BaseViewer.js +0 -13
  11. package/lib/Viewer.js +3 -1
  12. package/lib/draw/BpmnRenderUtil.js +6 -4
  13. package/lib/features/context-pad/ContextPadProvider.js +1 -1
  14. package/lib/features/copy-paste/BpmnCopyPaste.js +13 -13
  15. package/lib/features/di-ordering/BpmnDiOrdering.js +2 -3
  16. package/lib/features/drilldown/DrilldownCentering.js +41 -0
  17. package/lib/features/drilldown/DrilldownOverlays.js +110 -0
  18. package/lib/features/drilldown/SubprocessCompatibility.js +193 -0
  19. package/lib/features/drilldown/index.js +14 -0
  20. package/lib/features/label-editing/LabelEditingPreview.js +3 -3
  21. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -1
  22. package/lib/features/modeling/BpmnFactory.js +8 -8
  23. package/lib/features/modeling/BpmnUpdater.js +35 -27
  24. package/lib/features/modeling/ElementFactory.js +60 -37
  25. package/lib/features/modeling/behavior/DataStoreBehavior.js +3 -1
  26. package/lib/features/modeling/behavior/IsHorizontalFix.js +7 -4
  27. package/lib/features/modeling/behavior/LabelBehavior.js +8 -7
  28. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
  29. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +8 -6
  30. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
  31. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
  32. package/lib/features/palette/PaletteProvider.js +3 -1
  33. package/lib/features/popup-menu/ReplaceMenuProvider.js +5 -5
  34. package/lib/features/popup-menu/util/TypeUtil.js +1 -1
  35. package/lib/features/replace/BpmnReplace.js +29 -29
  36. package/lib/import/BpmnImporter.js +27 -22
  37. package/lib/import/BpmnTreeWalker.js +19 -17
  38. package/lib/import/Importer.js +17 -6
  39. package/lib/util/CompatibilityUtil.js +21 -1
  40. package/lib/util/DiUtil.js +10 -3
  41. package/lib/util/LabelUtil.js +2 -3
  42. package/lib/util/ModelUtil.js +11 -0
  43. package/package.json +2 -2
  44. package/test/matchers/BoundsMatchers.js +10 -10
  45. package/test/matchers/ConnectionMatchers.js +5 -5
@@ -16,6 +16,7 @@ import {
16
16
 
17
17
  import {
18
18
  getBusinessObject,
19
+ getDi,
19
20
  is
20
21
  } from '../../util/ModelUtil';
21
22
 
@@ -307,8 +308,9 @@ BpmnUpdater.prototype.updateParent = function(element, oldParent) {
307
308
  var parentShape = element.parent;
308
309
 
309
310
  var businessObject = element.businessObject,
311
+ di = getDi(element),
310
312
  parentBusinessObject = parentShape && parentShape.businessObject,
311
- parentDi = parentBusinessObject && parentBusinessObject.di;
313
+ parentDi = getDi(parentShape);
312
314
 
313
315
  if (is(element, 'bpmn:FlowNode')) {
314
316
  this.updateFlowNodeRefs(businessObject, parentBusinessObject, oldParent && oldParent.businessObject);
@@ -336,13 +338,13 @@ BpmnUpdater.prototype.updateParent = function(element, oldParent) {
336
338
  this.updateSemanticParent(businessObject.dataObjectRef, parentBusinessObject);
337
339
  }
338
340
 
339
- this.updateDiParent(businessObject.di, parentDi);
341
+ this.updateDiParent(di, parentDi);
340
342
  };
341
343
 
342
344
 
343
345
  BpmnUpdater.prototype.updateBounds = function(shape) {
344
346
 
345
- var di = shape.businessObject.di;
347
+ var di = getDi(shape);
346
348
 
347
349
  var target = (shape instanceof Label) ? this._getLabel(di) : di;
348
350
 
@@ -382,14 +384,17 @@ BpmnUpdater.prototype.updateFlowNodeRefs = function(businessObject, newContainme
382
384
 
383
385
 
384
386
  // update existing sourceElement and targetElement di information
385
- BpmnUpdater.prototype.updateDiConnection = function(di, newSource, newTarget) {
387
+ BpmnUpdater.prototype.updateDiConnection = function(connection, newSource, newTarget) {
388
+ var connectionDi = getDi(connection),
389
+ newSourceDi = getDi(newSource),
390
+ newTargetDi = getDi(newTarget);
386
391
 
387
- if (di.sourceElement && di.sourceElement.bpmnElement !== newSource) {
388
- di.sourceElement = newSource && newSource.di;
392
+ if (connectionDi.sourceElement && connectionDi.sourceElement.bpmnElement !== getBusinessObject(newSource)) {
393
+ connectionDi.sourceElement = newSource && newSourceDi;
389
394
  }
390
395
 
391
- if (di.targetElement && di.targetElement.bpmnElement !== newTarget) {
392
- di.targetElement = newTarget && newTarget.di;
396
+ if (connectionDi.targetElement && connectionDi.targetElement.bpmnElement !== getBusinessObject(newTarget)) {
397
+ connectionDi.targetElement = newTarget && newTargetDi;
393
398
  }
394
399
 
395
400
  };
@@ -614,69 +619,72 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
614
619
 
615
620
 
616
621
  BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {
617
- connection.businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
622
+ var di = getDi(connection);
623
+
624
+ di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
618
625
  };
619
626
 
620
627
 
621
628
  BpmnUpdater.prototype.updateConnection = function(context) {
622
-
623
629
  var connection = context.connection,
624
630
  businessObject = getBusinessObject(connection),
625
- newSource = getBusinessObject(connection.source),
626
- newTarget = getBusinessObject(connection.target),
631
+ newSource = connection.source,
632
+ newSourceBo = getBusinessObject(newSource),
633
+ newTarget = connection.target,
634
+ newTargetBo = getBusinessObject(connection.target),
627
635
  visualParent;
628
636
 
629
637
  if (!is(businessObject, 'bpmn:DataAssociation')) {
630
638
 
631
639
  var inverseSet = is(businessObject, 'bpmn:SequenceFlow');
632
640
 
633
- if (businessObject.sourceRef !== newSource) {
641
+ if (businessObject.sourceRef !== newSourceBo) {
634
642
  if (inverseSet) {
635
643
  collectionRemove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
636
644
 
637
- if (newSource && newSource.get('outgoing')) {
638
- newSource.get('outgoing').push(businessObject);
645
+ if (newSourceBo && newSourceBo.get('outgoing')) {
646
+ newSourceBo.get('outgoing').push(businessObject);
639
647
  }
640
648
  }
641
649
 
642
- businessObject.sourceRef = newSource;
650
+ businessObject.sourceRef = newSourceBo;
643
651
  }
644
652
 
645
- if (businessObject.targetRef !== newTarget) {
653
+ if (businessObject.targetRef !== newTargetBo) {
646
654
  if (inverseSet) {
647
655
  collectionRemove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
648
656
 
649
- if (newTarget && newTarget.get('incoming')) {
650
- newTarget.get('incoming').push(businessObject);
657
+ if (newTargetBo && newTargetBo.get('incoming')) {
658
+ newTargetBo.get('incoming').push(businessObject);
651
659
  }
652
660
  }
653
661
 
654
- businessObject.targetRef = newTarget;
662
+ businessObject.targetRef = newTargetBo;
655
663
  }
656
664
  } else
657
665
 
658
666
  if (is(businessObject, 'bpmn:DataInputAssociation')) {
659
667
 
660
668
  // handle obnoxious isMsome sourceRef
661
- businessObject.get('sourceRef')[0] = newSource;
669
+ businessObject.get('sourceRef')[0] = newSourceBo;
662
670
 
663
- visualParent = context.parent || context.newParent || newTarget;
671
+ visualParent = context.parent || context.newParent || newTargetBo;
664
672
 
665
- this.updateSemanticParent(businessObject, newTarget, visualParent);
673
+ this.updateSemanticParent(businessObject, newTargetBo, visualParent);
666
674
  } else
667
675
 
668
676
  if (is(businessObject, 'bpmn:DataOutputAssociation')) {
669
- visualParent = context.parent || context.newParent || newSource;
677
+ visualParent = context.parent || context.newParent || newSourceBo;
670
678
 
671
- this.updateSemanticParent(businessObject, newSource, visualParent);
679
+ this.updateSemanticParent(businessObject, newSourceBo, visualParent);
672
680
 
673
681
  // targetRef = new target
674
- businessObject.targetRef = newTarget;
682
+ businessObject.targetRef = newTargetBo;
675
683
  }
676
684
 
677
685
  this.updateConnectionWaypoints(connection);
678
686
 
679
- this.updateDiConnection(businessObject.di, newSource, newTarget);
687
+ this.updateDiConnection(connection, newSource, newTarget);
680
688
  };
681
689
 
682
690
 
@@ -6,7 +6,15 @@ import {
6
6
 
7
7
  import inherits from 'inherits';
8
8
 
9
- import { is } from '../../util/ModelUtil';
9
+ import {
10
+ getBusinessObject,
11
+ getDi,
12
+ is
13
+ } from '../../util/ModelUtil';
14
+
15
+ import {
16
+ isAny
17
+ } from '../modeling/util/ModelingUtil';
10
18
 
11
19
  import {
12
20
  isExpanded
@@ -18,6 +26,10 @@ import {
18
26
  DEFAULT_LABEL_SIZE
19
27
  } from '../../util/LabelUtil';
20
28
 
29
+ import {
30
+ ensureCompatDiRef
31
+ } from '../../util/CompatibilityUtil';
32
+
21
33
 
22
34
  /**
23
35
  * A bpmn-aware factory for diagram-js shapes
@@ -46,7 +58,8 @@ ElementFactory.prototype.create = function(elementType, attrs) {
46
58
  // we assume their businessObjects have already been created
47
59
  // and wired via attrs
48
60
  if (elementType === 'label') {
49
- return this.baseCreate(elementType, assign({ type: 'label' }, DEFAULT_LABEL_SIZE, attrs));
61
+ var di = attrs.di || this._bpmnFactory.createDiLabel();
62
+ return this.baseCreate(elementType, assign({ type: 'label', di: di }, DEFAULT_LABEL_SIZE, attrs));
50
63
  }
51
64
 
52
65
  return this.createBpmnElement(elementType, attrs);
@@ -58,7 +71,8 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
58
71
 
59
72
  attrs = attrs || {};
60
73
 
61
- var businessObject = attrs.businessObject;
74
+ var businessObject = attrs.businessObject,
75
+ di = attrs.di;
62
76
 
63
77
  if (!businessObject) {
64
78
  if (!attrs.type) {
@@ -66,22 +80,23 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
66
80
  }
67
81
 
68
82
  businessObject = this._bpmnFactory.create(attrs.type);
83
+
84
+ ensureCompatDiRef(businessObject);
69
85
  }
70
86
 
71
- if (!businessObject.di) {
87
+ if (!isModdleDi(di)) {
88
+ var diAttrs = assign(
89
+ di || {},
90
+ { id: businessObject.id + '_di' }
91
+ );
92
+
72
93
  if (elementType === 'root') {
73
- businessObject.di = this._bpmnFactory.createDiPlane(businessObject, [], {
74
- id: businessObject.id + '_di'
75
- });
94
+ di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
76
95
  } else
77
96
  if (elementType === 'connection') {
78
- businessObject.di = this._bpmnFactory.createDiEdge(businessObject, [], {
79
- id: businessObject.id + '_di'
80
- });
97
+ di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
81
98
  } else {
82
- businessObject.di = this._bpmnFactory.createDiShape(businessObject, {}, {
83
- id: businessObject.id + '_di'
84
- });
99
+ di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
85
100
  }
86
101
  }
87
102
 
@@ -91,12 +106,6 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
91
106
  }, attrs);
92
107
  }
93
108
 
94
- if (attrs.di) {
95
- assign(businessObject.di, attrs.di);
96
-
97
- delete attrs.di;
98
- }
99
-
100
109
  applyAttributes(businessObject, attrs, [
101
110
  'processRef',
102
111
  'isInterrupting',
@@ -105,11 +114,11 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
105
114
  ]);
106
115
 
107
116
  if (attrs.isExpanded) {
108
- applyAttribute(businessObject.di, attrs, 'isExpanded');
117
+ applyAttribute(di, attrs, 'isExpanded');
109
118
  }
110
119
 
111
120
  if (is(businessObject, 'bpmn:ExclusiveGateway')) {
112
- businessObject.di.isMarkerVisible = true;
121
+ di.isMarkerVisible = true;
113
122
  }
114
123
 
115
124
  var eventDefinitions,
@@ -131,65 +140,69 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
131
140
  delete attrs.eventDefinitionType;
132
141
  }
133
142
 
134
- size = this._getDefaultSize(businessObject);
143
+ size = this.getDefaultSize(businessObject, di);
135
144
 
136
145
  attrs = assign({
137
- businessObject: businessObject,
138
146
  id: businessObject.id
139
- }, size, attrs);
147
+ }, size, attrs, {
148
+ businessObject: businessObject,
149
+ di: di
150
+ });
140
151
 
141
152
  return this.baseCreate(elementType, attrs);
142
153
  };
143
154
 
144
155
 
145
- ElementFactory.prototype._getDefaultSize = function(semantic) {
156
+ ElementFactory.prototype.getDefaultSize = function(element, di) {
146
157
 
147
- if (is(semantic, 'bpmn:SubProcess')) {
158
+ var bo = getBusinessObject(element);
159
+ di = di || getDi(element);
148
160
 
149
- if (isExpanded(semantic)) {
161
+ if (is(bo, 'bpmn:SubProcess')) {
162
+ if (isExpanded(bo, di)) {
150
163
  return { width: 350, height: 200 };
151
164
  } else {
152
165
  return { width: 100, height: 80 };
153
166
  }
154
167
  }
155
168
 
156
- if (is(semantic, 'bpmn:Task')) {
169
+ if (is(bo, 'bpmn:Task')) {
157
170
  return { width: 100, height: 80 };
158
171
  }
159
172
 
160
- if (is(semantic, 'bpmn:Gateway')) {
173
+ if (is(bo, 'bpmn:Gateway')) {
161
174
  return { width: 50, height: 50 };
162
175
  }
163
176
 
164
- if (is(semantic, 'bpmn:Event')) {
177
+ if (is(bo, 'bpmn:Event')) {
165
178
  return { width: 36, height: 36 };
166
179
  }
167
180
 
168
- if (is(semantic, 'bpmn:Participant')) {
169
- if (isExpanded(semantic)) {
181
+ if (is(bo, 'bpmn:Participant')) {
182
+ if (isExpanded(bo, di)) {
170
183
  return { width: 600, height: 250 };
171
184
  } else {
172
185
  return { width: 400, height: 60 };
173
186
  }
174
187
  }
175
188
 
176
- if (is(semantic, 'bpmn:Lane')) {
189
+ if (is(bo, 'bpmn:Lane')) {
177
190
  return { width: 400, height: 100 };
178
191
  }
179
192
 
180
- if (is(semantic, 'bpmn:DataObjectReference')) {
193
+ if (is(bo, 'bpmn:DataObjectReference')) {
181
194
  return { width: 36, height: 50 };
182
195
  }
183
196
 
184
- if (is(semantic, 'bpmn:DataStoreReference')) {
197
+ if (is(bo, 'bpmn:DataStoreReference')) {
185
198
  return { width: 50, height: 50 };
186
199
  }
187
200
 
188
- if (is(semantic, 'bpmn:TextAnnotation')) {
201
+ if (is(bo, 'bpmn:TextAnnotation')) {
189
202
  return { width: 100, height: 30 };
190
203
  }
191
204
 
192
- if (is(semantic, 'bpmn:Group')) {
205
+ if (is(bo, 'bpmn:Group')) {
193
206
  return { width: 300, height: 300 };
194
207
  }
195
208
 
@@ -252,4 +265,14 @@ function applyAttribute(element, attrs, attributeName) {
252
265
  element[attributeName] = attrs[attributeName];
253
266
 
254
267
  delete attrs[attributeName];
268
+ }
269
+
270
+
271
+ function isModdleDi(element) {
272
+ return isAny(element, [
273
+ 'bpmndi:BPMNShape',
274
+ 'bpmndi:BPMNEdge',
275
+ 'bpmndi:BPMNDiagram',
276
+ 'bpmndi:BPMNPlane',
277
+ ]);
255
278
  }
@@ -4,6 +4,7 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
4
 
5
5
  import {
6
6
  getBusinessObject,
7
+ getDi,
7
8
  is
8
9
  } from '../../../util/ModelUtil';
9
10
 
@@ -45,8 +46,9 @@ export default function DataStoreBehavior(
45
46
 
46
47
  commandStack.execute('dataStore.updateContainment', {
47
48
  dataStoreBo: dataStoreBo,
49
+ dataStoreDi: getDi(dataStore),
48
50
  newSemanticParent: newDataStoreParentBo.processRef || newDataStoreParentBo,
49
- newDiParent: newDataStoreParentBo.di
51
+ newDiParent: getDi(newDataStoreParent)
50
52
  });
51
53
  }
52
54
  }
@@ -3,7 +3,8 @@ import inherits from 'inherits';
3
3
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
4
 
5
5
  import {
6
- getBusinessObject
6
+ getBusinessObject,
7
+ getDi
7
8
  } from '../../../util/ModelUtil';
8
9
 
9
10
  import {
@@ -26,12 +27,14 @@ export default function IsHorizontalFix(eventBus) {
26
27
  ];
27
28
 
28
29
  this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], function(event) {
29
- var bo = getBusinessObject(event.context.shape);
30
+ var shape = event.context.shape,
31
+ bo = getBusinessObject(shape),
32
+ di = getDi(shape);
30
33
 
31
- if (isAny(bo, elementTypesToUpdate) && !bo.di.get('isHorizontal')) {
34
+ if (isAny(bo, elementTypesToUpdate) && !di.get('isHorizontal')) {
32
35
 
33
36
  // set attribute directly to avoid modeling#updateProperty side effects
34
- bo.di.set('isHorizontal', true);
37
+ di.set('isHorizontal', true);
35
38
  }
36
39
  });
37
40
 
@@ -6,7 +6,8 @@ import inherits from 'inherits';
6
6
 
7
7
  import {
8
8
  is,
9
- getBusinessObject
9
+ getBusinessObject,
10
+ getDi
10
11
  } from '../../../util/ModelUtil';
11
12
 
12
13
  import {
@@ -153,27 +154,27 @@ export default function LabelBehavior(
153
154
 
154
155
  var context = event.context,
155
156
  element = context.shape,
156
- businessObject,
157
+ labelTarget = context.labelTarget,
157
158
  di;
158
159
 
159
160
  // we want to trigger on real labels only
160
- if (!element.labelTarget) {
161
+ if (!labelTarget) {
161
162
  return;
162
163
  }
163
164
 
164
165
  // we want to trigger on BPMN elements only
165
- if (!is(element.labelTarget || element, 'bpmn:BaseElement')) {
166
+ if (!is(labelTarget, 'bpmn:BaseElement')) {
166
167
  return;
167
168
  }
168
169
 
169
- businessObject = element.businessObject,
170
- di = businessObject.di;
171
-
170
+ di = getDi(labelTarget);
172
171
 
173
172
  if (!di.label) {
174
173
  di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
175
174
  bounds: bpmnFactory.create('dc:Bounds')
176
175
  });
176
+
177
+ element.di = di;
177
178
  }
178
179
 
179
180
  assign(di.label.bounds, {
@@ -3,7 +3,7 @@ import inherits from 'inherits';
3
3
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
4
 
5
5
  import {
6
- getBusinessObject,
6
+ getDi,
7
7
  is
8
8
  } from '../../../util/ModelUtil';
9
9
 
@@ -85,11 +85,11 @@ export default function ToggleElementCollapseBehaviour(
85
85
  hideEmptyLabels(shape.children);
86
86
 
87
87
  // remove collapsed marker
88
- getBusinessObject(shape).di.isExpanded = true;
88
+ getDi(shape).isExpanded = true;
89
89
  } else {
90
90
 
91
91
  // place collapsed marker
92
- getBusinessObject(shape).di.isExpanded = false;
92
+ getDi(shape).isExpanded = false;
93
93
  }
94
94
  });
95
95
 
@@ -101,16 +101,16 @@ export default function ToggleElementCollapseBehaviour(
101
101
 
102
102
  // revert removing/placing collapsed marker
103
103
  if (!shape.collapsed) {
104
- getBusinessObject(shape).di.isExpanded = true;
104
+ getDi(shape).isExpanded = true;
105
105
 
106
106
  } else {
107
- getBusinessObject(shape).di.isExpanded = false;
107
+ getDi(shape).isExpanded = false;
108
108
  }
109
109
  });
110
110
 
111
111
  this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY, function(e) {
112
112
  var shape = e.context.shape,
113
- defaultSize = elementFactory._getDefaultSize(shape),
113
+ defaultSize = elementFactory.getDefaultSize(shape),
114
114
  newBounds;
115
115
 
116
116
  if (shape.collapsed) {
@@ -3,6 +3,8 @@ import {
3
3
  remove as collectionRemove
4
4
  } from 'diagram-js/lib/util/Collections';
5
5
 
6
+ import { getDi } from '../../../util/ModelUtil';
7
+
6
8
 
7
9
  export default function UpdateCanvasRootHandler(canvas, modeling) {
8
10
  this._canvas = canvas;
@@ -24,7 +26,7 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
24
26
  oldRoot = canvas.getRootElement(),
25
27
  oldRootBusinessObject = oldRoot.businessObject,
26
28
  bpmnDefinitions = oldRootBusinessObject.$parent,
27
- diPlane = oldRootBusinessObject.di;
29
+ diPlane = getDi(oldRoot);
28
30
 
29
31
  // (1) replace process old <> new root
30
32
  canvas.setRootElement(newRoot, true);
@@ -37,10 +39,10 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
37
39
  oldRootBusinessObject.$parent = null;
38
40
 
39
41
  // (3) wire di
40
- oldRootBusinessObject.di = null;
42
+ oldRoot.di = null;
41
43
 
42
44
  diPlane.bpmnElement = newRootBusinessObject;
43
- newRootBusinessObject.di = diPlane;
45
+ newRoot.di = diPlane;
44
46
 
45
47
  context.oldRoot = oldRoot;
46
48
 
@@ -58,7 +60,7 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
58
60
  oldRoot = context.oldRoot,
59
61
  oldRootBusinessObject = oldRoot.businessObject,
60
62
  bpmnDefinitions = newRootBusinessObject.$parent,
61
- diPlane = newRootBusinessObject.di;
63
+ diPlane = getDi(newRoot);
62
64
 
63
65
  // (1) replace process old <> new root
64
66
  canvas.setRootElement(oldRoot, true);
@@ -71,10 +73,10 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
71
73
  oldRootBusinessObject.$parent = bpmnDefinitions;
72
74
 
73
75
  // (3) wire di
74
- newRootBusinessObject.di = null;
76
+ newRoot.di = null;
75
77
 
76
78
  diPlane.bpmnElement = oldRootBusinessObject;
77
- oldRootBusinessObject.di = diPlane;
79
+ oldRoot.di = diPlane;
78
80
 
79
81
  // TODO(nikku): return changed elements?
80
82
  // return [ newRoot, oldRoot ];
@@ -6,7 +6,8 @@ import {
6
6
  } from 'min-dash';
7
7
 
8
8
  import {
9
- getBusinessObject
9
+ getBusinessObject,
10
+ getDi
10
11
  } from '../../../util/ModelUtil';
11
12
 
12
13
  var DEFAULT_FLOW = 'default',
@@ -74,7 +75,7 @@ UpdatePropertiesHandler.prototype.execute = function(context) {
74
75
 
75
76
  var businessObject = element.businessObject,
76
77
  properties = unwrapBusinessObjects(context.properties),
77
- oldProperties = context.oldProperties || getProperties(businessObject, properties);
78
+ oldProperties = context.oldProperties || getProperties(element, properties);
78
79
 
79
80
  if (isIdChange(properties, businessObject)) {
80
81
  ids.unclaim(businessObject[ID]);
@@ -97,7 +98,7 @@ UpdatePropertiesHandler.prototype.execute = function(context) {
97
98
  }
98
99
 
99
100
  // update properties
100
- setProperties(businessObject, properties);
101
+ setProperties(element, properties);
101
102
 
102
103
  // store old values
103
104
  context.oldProperties = oldProperties;
@@ -142,7 +143,7 @@ UpdatePropertiesHandler.prototype.revert = function(context) {
142
143
  ids = this._moddle.ids;
143
144
 
144
145
  // update properties
145
- setProperties(businessObject, oldProperties);
146
+ setProperties(element, oldProperties);
146
147
 
147
148
  if (isIdChange(properties, businessObject)) {
148
149
  ids.unclaim(properties[ID]);
@@ -161,16 +162,19 @@ function isIdChange(properties, businessObject) {
161
162
  }
162
163
 
163
164
 
164
- function getProperties(businessObject, properties) {
165
- var propertyNames = keys(properties);
165
+ function getProperties(element, properties) {
166
+ var propertyNames = keys(properties),
167
+ businessObject = element.businessObject,
168
+ di = getDi(element);
166
169
 
167
170
  return reduce(propertyNames, function(result, key) {
168
171
 
169
172
  // handle DI separately
170
173
  if (key !== DI) {
171
174
  result[key] = businessObject.get(key);
175
+
172
176
  } else {
173
- result[key] = getDiProperties(businessObject.di, keys(properties.di));
177
+ result[key] = getDiProperties(di, keys(properties.di));
174
178
  }
175
179
 
176
180
  return result;
@@ -180,23 +184,26 @@ function getProperties(businessObject, properties) {
180
184
 
181
185
  function getDiProperties(di, propertyNames) {
182
186
  return reduce(propertyNames, function(result, key) {
183
- result[key] = di.get(key);
187
+ result[key] = di && di.get(key);
184
188
 
185
189
  return result;
186
190
  }, {});
187
191
  }
188
192
 
189
193
 
190
- function setProperties(businessObject, properties) {
194
+ function setProperties(element, properties) {
195
+ var businessObject = element.businessObject,
196
+ di = getDi(element);
197
+
191
198
  forEach(properties, function(value, key) {
192
199
 
193
200
  if (key !== DI) {
194
201
  businessObject.set(key, value);
195
202
  } else {
196
203
 
197
- // only update, if businessObject.di exists
198
- if (businessObject.di) {
199
- setDiProperties(businessObject.di, value);
204
+ // only update, if di exists
205
+ if (di) {
206
+ setDiProperties(di, value);
200
207
  }
201
208
  }
202
209
  });
@@ -7,21 +7,23 @@ UpdateSemanticParentHandler.$inject = [ 'bpmnUpdater' ];
7
7
 
8
8
  UpdateSemanticParentHandler.prototype.execute = function(context) {
9
9
  var dataStoreBo = context.dataStoreBo,
10
+ dataStoreDi = context.dataStoreDi,
10
11
  newSemanticParent = context.newSemanticParent,
11
12
  newDiParent = context.newDiParent;
12
13
 
13
14
  context.oldSemanticParent = dataStoreBo.$parent;
14
- context.oldDiParent = dataStoreBo.di.$parent;
15
+ context.oldDiParent = dataStoreDi.$parent;
15
16
 
16
17
  // update semantic parent
17
18
  this._bpmnUpdater.updateSemanticParent(dataStoreBo, newSemanticParent);
18
19
 
19
20
  // update DI parent
20
- this._bpmnUpdater.updateDiParent(dataStoreBo.di, newDiParent);
21
+ this._bpmnUpdater.updateDiParent(dataStoreDi, newDiParent);
21
22
  };
22
23
 
23
24
  UpdateSemanticParentHandler.prototype.revert = function(context) {
24
25
  var dataStoreBo = context.dataStoreBo,
26
+ dataStoreDi = context.dataStoreDi,
25
27
  oldSemanticParent = context.oldSemanticParent,
26
28
  oldDiParent = context.oldDiParent;
27
29
 
@@ -29,6 +31,6 @@ UpdateSemanticParentHandler.prototype.revert = function(context) {
29
31
  this._bpmnUpdater.updateSemanticParent(dataStoreBo, oldSemanticParent);
30
32
 
31
33
  // update DI parent
32
- this._bpmnUpdater.updateDiParent(dataStoreBo.di, oldDiParent);
34
+ this._bpmnUpdater.updateDiParent(dataStoreDi, oldDiParent);
33
35
  };
34
36
 
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  assign
3
3
  } from 'min-dash';
4
+ import { getDi } from '../../util/ModelUtil';
4
5
 
5
6
 
6
7
  /**
@@ -52,7 +53,8 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
52
53
  var shape = elementFactory.createShape(assign({ type: type }, options));
53
54
 
54
55
  if (options) {
55
- shape.businessObject.di.isExpanded = options.isExpanded;
56
+ var di = getDi(shape);
57
+ di.isExpanded = options.isExpanded;
56
58
  }
57
59
 
58
60
  create.start(event, shape);