How to use the bpmn-js/lib/import/Util.elementToString function in bpmn-js

To help you get started, we’ve selected a few bpmn-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bptlab / chor-js / lib / import / visitors / InitialRenderVisitor.js View on Github external
InitialRenderVisitor.prototype.visit = function(element, parentShape) {
  // avoid multiple rendering of elements
  if (element.gfx) {
    throw new Error('already rendered ' + elementToString(element));
  }
  return this._add(element, parentShape);
};
github bptlab / chor-js / lib / import / visitors / InitialRenderVisitor.js View on Github external
// love to model such as cross participant / sub process
        // associations
        parentShape = null;
      }

      // insert sequence flows behind other flow nodes (cf. #727)
      let parentIndex;
      if (is(semantic, 'bpmn:SequenceFlow')) {
        parentIndex = 0;
      }

      this._canvas.addConnection(element, parentShape, parentIndex);

    } else {
      throw new Error(this._translate('unknown di {di} for element {semantic}', {
        di: elementToString(di),
        semantic: elementToString(semantic)
      }));
    }
    // (optional) external LABEL
    if (isLabelExternal(semantic) && semantic.name) {
      this._addLabel(semantic, element);
    }
  } else {
    if (isMessageFlow) {
      /*
       * Messages are attached to a participant band. They are separate shapes
       * but move with the band. They do not have an underlying DI element.
       * If no message is attached to the message flow, we first have to create one.
       */
      const choreo = this._canvas.getRootElement().businessObject;
      const definitions = choreo.$parent;
github bptlab / chor-js / lib / import / visitors / InitialRenderVisitor.js View on Github external
// associations
        parentShape = null;
      }

      // insert sequence flows behind other flow nodes (cf. #727)
      let parentIndex;
      if (is(semantic, 'bpmn:SequenceFlow')) {
        parentIndex = 0;
      }

      this._canvas.addConnection(element, parentShape, parentIndex);

    } else {
      throw new Error(this._translate('unknown di {di} for element {semantic}', {
        di: elementToString(di),
        semantic: elementToString(semantic)
      }));
    }
    // (optional) external LABEL
    if (isLabelExternal(semantic) && semantic.name) {
      this._addLabel(semantic, element);
    }
  } else {
    if (isMessageFlow) {
      /*
       * Messages are attached to a participant band. They are separate shapes
       * but move with the band. They do not have an underlying DI element.
       * If no message is attached to the message flow, we first have to create one.
       */
      const choreo = this._canvas.getRootElement().businessObject;
      const definitions = choreo.$parent;
      let message = semantic.messageRef;
github bptlab / chor-js / lib / import / visitors / InitialRenderVisitor.js View on Github external
function notYetDrawn(translate, semantic, refSemantic, property) {
  return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {
    element: elementToString(refSemantic),
    referenced: elementToString(semantic),
    property: property
  }));
}
github bptlab / chor-js / lib / import / ChoreoTreeWalker.js View on Github external
flowElements.forEach(flowElement => {
      if (is(flowElement, 'bpmn:SequenceFlow')) {
        self._deferred.push(function() {
          self.handleSequenceFlow(flowElement, parentShape);
        });
      } else if (is(flowElement, 'bpmn:BoundaryEvent')) {
        self._deferred.unshift(function() {
          self.handleBoundaryEvent(flowElement, parentShape);
        });
      } else if (is(flowElement, 'bpmn:FlowNode')) {
        self.handleFlowNode(flowElement, parentShape);
      } else {
        throw new Error(
          'unrecognized flowElement ' +
          elementToString(flowElement) + ' in context ' +
          (parentShape ? elementToString(parentShape.businessObject) : 'null')
        );
      }
    });
  }
github bptlab / chor-js / lib / import / visitors / InitialRenderVisitor.js View on Github external
function notYetDrawn(translate, semantic, refSemantic, property) {
  return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {
    element: elementToString(refSemantic),
    referenced: elementToString(semantic),
    property: property
  }));
}
github bptlab / chor-js / lib / import / ChoreoTreeWalker.js View on Github external
flowElements.forEach(flowElement => {
      if (is(flowElement, 'bpmn:SequenceFlow')) {
        self._deferred.push(function() {
          self.handleSequenceFlow(flowElement, parentShape);
        });
      } else if (is(flowElement, 'bpmn:BoundaryEvent')) {
        self._deferred.unshift(function() {
          self.handleBoundaryEvent(flowElement, parentShape);
        });
      } else if (is(flowElement, 'bpmn:FlowNode')) {
        self.handleFlowNode(flowElement, parentShape);
      } else {
        throw new Error(
          'unrecognized flowElement ' +
          elementToString(flowElement) + ' in context ' +
          (parentShape ? elementToString(parentShape.businessObject) : 'null')
        );
      }
    });
  }