Custom element, what is the best approach?


#1

I’m making a simplified version of the modeler for a particular project that need very little functionality. In order to simplify modelling for the users I wanna be able to create normal parallel gateways and also parallel gateways with the exclusive gateway graphics.

I have a custom palette and a custom json model working fine and I will perform some logic depending on the type of gateway using execution delegates. But I don’t know how to change the graphics of the second type of gateways.

Should I create a custom element or is it enough to change the graphics in the createAction functions invoked in the palette? This models should run in camunda later.

Thanks in advance,
Gonzalo


#2

hi @gcalvo,

do I understand you correctly:

You want to create subset of available bpmn elements with 2 elements, the parallel gateway and another gateway with the behaviour of the parallel and the look of the exclusive gateway?


#3

Yes, that is exactly what I want.

As far as I understand I can define custom elements or simply add properties to existing elements by declaring them in a json model. This is how my especial paralllel gateway looks like:

{
  "name": "SpecialParallelGateway",
  "extends": [
    "bpmn:ParallelGateway"
  ],
  "properties": [
    {
	"name": "operation",
	"type": "String",
	"isAttr": true
    }
  ]
}

And in the Custom Palette I fill the operation field with the code of the operation it has to be performed by the execution listener.


#4

You need to change the renderer if you want certain elements to be rendered in a specific way. Have you tried this yet?


#5

Can I change the renderer by adding a CustomRenderer module like in this example?

If I define a custom element will it be processed in camunda like a parallel gateway?

Do I have to create CustomFactoryElement, CustomRules and all the others as well?