From 1b8095a44291ff16263d710d94a92c45bd0483d8 Mon Sep 17 00:00:00 2001 From: jdotzki Date: Fri, 4 Apr 2014 12:01:42 +0200 Subject: [PATCH] feat(bpmnrenderer): add support for DataCollectionObject --- lib/draw/BpmnRenderer.js | 22 +++ test/fixtures/bpmn/data-objects.bpmn | 108 --------------- test/fixtures/bpmn/render/data-objects.bpmn | 126 ++++++++++++++++++ .../bpmn/{simple => render}/events.bpmn | 0 test/fixtures/bpmn/simple/activities.bpmn | 69 ---------- test/fixtures/bpmn/simple/data-items.bpmn | 41 ------ test/fixtures/bpmn/simple/gateways.bpmn | 41 ------ 7 files changed, 148 insertions(+), 259 deletions(-) delete mode 100644 test/fixtures/bpmn/data-objects.bpmn create mode 100644 test/fixtures/bpmn/render/data-objects.bpmn rename test/fixtures/bpmn/{simple => render}/events.bpmn (100%) delete mode 100644 test/fixtures/bpmn/simple/activities.bpmn delete mode 100644 test/fixtures/bpmn/simple/data-items.bpmn delete mode 100644 test/fixtures/bpmn/simple/gateways.bpmn diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js index e0e3c871..b7167d41 100644 --- a/lib/draw/BpmnRenderer.js +++ b/lib/draw/BpmnRenderer.js @@ -299,6 +299,13 @@ function BpmnRenderer(events, styles, bpmnRegistry) { ' 0 0 9.8363 9.8036 0'; var dataObject = drawPath(p, DATA_OBJECT_PATH); + if(getObjectRef(data.id, 'isCollection') === true) { + var COLLECTION_PATH = 'M 0 0 l 0 15 l 1 0 l 0 -15 z' + + 'M 6 0 l 0 15 l 1 0 l 0 -15 z' + + 'M 12 0 l 0 15 l 1 0 l 0 -15 z'; + var collectionIcon = drawPath(p, COLLECTION_PATH); + collectionIcon.transform('translate(17.8,42.0)'); + } return dataObject; }, @@ -380,6 +387,21 @@ function BpmnRenderer(events, styles, bpmnRegistry) { } } + /** + * + * @return {Object} returns a specified objectRef + */ + function getObjectRef(id, refName) { + var semantic = bpmnRegistry.getSemantic(id); + + if(!semantic || !semantic.dataObjectRef) { + return false; + } + + return semantic.dataObjectRef[refName]; + } + + // hook onto canvas init event to initialize // connection start/end markers on paper events.on('canvas.init', function(event) { diff --git a/test/fixtures/bpmn/data-objects.bpmn b/test/fixtures/bpmn/data-objects.bpmn deleted file mode 100644 index 0cc9625e..00000000 --- a/test/fixtures/bpmn/data-objects.bpmn +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - DataObjectReference_1 - - - _DataStoreReference_2 - - - DataOutput_1 - - - DataObjectReference_1 - - - - - - - - - - - _DataStoreReference_2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/fixtures/bpmn/render/data-objects.bpmn b/test/fixtures/bpmn/render/data-objects.bpmn new file mode 100644 index 00000000..973e5646 --- /dev/null +++ b/test/fixtures/bpmn/render/data-objects.bpmn @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + DataObjectReference_1 + + + _DataStoreReference_2 + + + DataOutput_1 + + + DataObjectReference_1 + + + + + + + + + + + + _DataStoreReference_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/fixtures/bpmn/simple/events.bpmn b/test/fixtures/bpmn/render/events.bpmn similarity index 100% rename from test/fixtures/bpmn/simple/events.bpmn rename to test/fixtures/bpmn/render/events.bpmn diff --git a/test/fixtures/bpmn/simple/activities.bpmn b/test/fixtures/bpmn/simple/activities.bpmn deleted file mode 100644 index f51828b1..00000000 --- a/test/fixtures/bpmn/simple/activities.bpmn +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/fixtures/bpmn/simple/data-items.bpmn b/test/fixtures/bpmn/simple/data-items.bpmn deleted file mode 100644 index 4c9f5619..00000000 --- a/test/fixtures/bpmn/simple/data-items.bpmn +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/fixtures/bpmn/simple/gateways.bpmn b/test/fixtures/bpmn/simple/gateways.bpmn deleted file mode 100644 index 379577bb..00000000 --- a/test/fixtures/bpmn/simple/gateways.bpmn +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file