I’m a bit confused about the creation of the Signal event because if they are already created, they are not accessible though the elementRegistry and I don’t know the way to add them to the diagram.
I create it this way:
var signalElement = renderer.get('moddle').create('bpmn:Signal', {
id: 'my_signal_id',
name: 'myname'
});
Any suggestion to add to the diagram because they are only accessible via renderer.get(‘canvas’) ?
Based on your previous postings in this forum it seems like there is a misunderstanding about BPMN and/or how the interaction between BPMN and diagram elements in bpmn-js works.
Regarding the interaction there is a few important things to know:
We parse the BPMN 2.0 XML into a object tree.
For each relevant visual element we create graphical shapes and connections on the diagram.
Each graphical element references the underlying BPMN element via element.businessObject.
Invisible elements, i.e without attached DI (diagram interchange) information are not drawn and thus not visible via diagrams elementRegistry.
Regarding bpmn:Signals: Signals are just like that: Invisible and not part of the canvas. They are still important though because they are linked to a SignalEventDefinitions that may be part of a drawn Event.
function createSignalProperty() {
var signalElement = renderer.get('moddle').create('bpmn:Signal', {
id: 'the unique Id',
name: 'the name'
});
var rootElement = renderer.get('canvas').getRootElement().businessObject.$parent.rootElements;
rootElement.push(signalElement);
}
```