Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/bpmn-support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ The default rendering uses `white` as fill color and `black` as stroke color.
|icon:check-circle-o[]
|Icon may be subject to change +

|Inclusive
|icon:check-circle-o[]
|Icon may be subject to change +

|Parallel
|icon:check-circle-o[]
|Icon may be subject to change +
Expand Down
13 changes: 13 additions & 0 deletions src/component/mxgraph/StyleConfigurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,18 @@ export default class StyleConfigurator {

this.putCellStyle(kind, style);
});
// TODO: this is temporary rendering - to be removed with proper rendering implementation
const temporaryStyle = this.cloneDefaultVertexStyle();
temporaryStyle[this.mxConstants.STYLE_SHAPE] = this.mxConstants.SHAPE_RHOMBUS;
temporaryStyle[this.mxConstants.STYLE_PERIMETER] = this.mxPerimeter.RhombusPerimeter;
temporaryStyle[this.mxConstants.STYLE_VERTICAL_ALIGN] = 'top';
temporaryStyle[this.mxConstants.STYLE_STROKECOLOR] = '#f00';
temporaryStyle[this.mxConstants.STYLE_STROKEWIDTH] = 2;
temporaryStyle[this.mxConstants.STYLE_FILLCOLOR] = '#f00';
temporaryStyle[this.mxConstants.STYLE_FILL_OPACITY] = 25;

temporaryStyle[this.mxConstants.STYLE_SPACING_TOP] = 55;
temporaryStyle[this.mxConstants.STYLE_SPACING_RIGHT] = 110;
this.putCellStyle(ShapeBpmnElementKind.GATEWAY_INCLUSIVE, temporaryStyle);
}
}
1 change: 1 addition & 0 deletions src/model/bpmn/shape/ShapeBpmnElementKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export enum ShapeBpmnElementKind {
TASK = 'task',
GATEWAY_PARALLEL = 'parallelGateway',
GATEWAY_EXCLUSIVE = 'exclusiveGateway',
GATEWAY_INCLUSIVE = 'inclusiveGateway',
EVENT_START = 'startEvent',
EVENT_END = 'endEvent',
EVENT_INTERMEDIATE_CATCH = 'intermediateCatchEvent',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/**
* Copyright 2020 Bonitasoft S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ShapeBpmnElementKind } from '../../../../../src/model/bpmn/shape/ShapeBpmnElementKind';
import { parseJsonAndExpectOnlyFlowNodes, verifyShape } from './JsonTestUtils';

describe('parse bpmn as json for inclusive gateway', () => {
it('json containing one process with a single inclusive gateway', () => {
const json = `{
"definitions" : {
"process": {
"inclusiveGateway": {
"id":"inclusiveGateway_id_0",
"name":"inclusiveGateway name"
}
},
"BPMNDiagram": {
"name":"process 0",
"BPMNPlane": {
"BPMNShape": {
"id":"shape_inclusiveGateway_id_0",
"bpmnElement":"inclusiveGateway_id_0",
"Bounds": { "x": 362, "y": 232, "width": 36, "height": 45 }
}
}
}
}
}`;

const model = parseJsonAndExpectOnlyFlowNodes(json, 1);

verifyShape(model.flowNodes[0], {
shapeId: 'shape_inclusiveGateway_id_0',
bpmnElementId: 'inclusiveGateway_id_0',
bpmnElementName: 'inclusiveGateway name',
bpmnElementKind: ShapeBpmnElementKind.GATEWAY_INCLUSIVE,
boundsX: 362,
boundsY: 232,
boundsWidth: 36,
boundsHeight: 45,
});
});

it('json containing one process declared as array with a single inclusive gateway', () => {
const json = `{
"definitions": {
"process": [
{
"inclusiveGateway": {
"id":"inclusiveGateway_id_1",
"name":"inclusiveGateway name"
}
}
],
"BPMNDiagram": {
"name":"process 0",
"BPMNPlane": {
"BPMNShape": {
"id":"shape_inclusiveGateway_id_1",
"bpmnElement":"inclusiveGateway_id_1",
"Bounds": { "x": 362, "y": 232, "width": 36, "height": 45 }
}
}
}
}
}`;

const model = parseJsonAndExpectOnlyFlowNodes(json, 1);

verifyShape(model.flowNodes[0], {
shapeId: 'shape_inclusiveGateway_id_1',
bpmnElementId: 'inclusiveGateway_id_1',
bpmnElementName: 'inclusiveGateway name',
bpmnElementKind: ShapeBpmnElementKind.GATEWAY_INCLUSIVE,
boundsX: 362,
boundsY: 232,
boundsWidth: 36,
boundsHeight: 45,
});
});

it('json containing one process with an array of inclusive gateways with name & without name', () => {
const json = `{
"definitions" : {
"process": {
"inclusiveGateway": [
{
"id":"inclusiveGateway_id_0",
"name":"inclusiveGateway name"
}, {
"id":"inclusiveGateway_id_1"
}
]
},
"BPMNDiagram": {
"name":"process 0",
"BPMNPlane": {
"BPMNShape": [
{
"id":"shape_inclusiveGateway_id_0",
"bpmnElement":"inclusiveGateway_id_0",
"Bounds": { "x": 362, "y": 232, "width": 36, "height": 45 }
}, {
"id":"shape_inclusiveGateway_id_1",
"bpmnElement":"inclusiveGateway_id_1",
"Bounds": { "x": 365, "y": 235, "width": 35, "height": 46 }
}
]
}
}
}
}`;

const model = parseJsonAndExpectOnlyFlowNodes(json, 2);

verifyShape(model.flowNodes[0], {
shapeId: 'shape_inclusiveGateway_id_0',
bpmnElementId: 'inclusiveGateway_id_0',
bpmnElementName: 'inclusiveGateway name',
bpmnElementKind: ShapeBpmnElementKind.GATEWAY_INCLUSIVE,
boundsX: 362,
boundsY: 232,
boundsWidth: 36,
boundsHeight: 45,
});
verifyShape(model.flowNodes[1], {
shapeId: 'shape_inclusiveGateway_id_1',
bpmnElementId: 'inclusiveGateway_id_1',
bpmnElementName: undefined,
bpmnElementKind: ShapeBpmnElementKind.GATEWAY_INCLUSIVE,
boundsX: 365,
boundsY: 235,
boundsWidth: 35,
boundsHeight: 46,
});
});
});