Extend from serviceTask with custom extension element


#1

Hello everybody !

I would like to change rendering and add some properties to a serviceTask.
And i just don’t know how to do it correctly.

Case next:

  1. user adds some custom task from palette
  2. this task adds as a serviceTask with custom extension to the diagram
  3. the item should render differently depending on the extension inside it

I’ve already done the rendering. But I think my decision is very naive and simply bad :slight_smile:

I have extended from the BaseRenderer and made my custom logic there.

EtaRenderer.prototype.drawShape = function(parentGfx, element) {
  var type = element.type;
  let label = '';
  if (isCreateTaksExtension(element)) {
    return drawEtaProcess(parentGfx, element.width, element.height, '[Cоздать задачу]')
  }

isCreateTaksExtension - looking for expected extension inside. And if found, return true.
drawEtaProcess - just creates the gfx rect with all needed params.

Rendering works when loading an existing schema …

But i dont know how to add extensions to added from palette task.

I’d like to know. Am I even going the right way ?
And if so, how do I add an extension to an item from the palette ?


#2

Hi,

to add your own entries to palette, you can register your own provider using Palette#registerProvider method. See existing PaletteProvider if you are not sure how to do this.

Best,

Maciej