How to use the bpmn-js/lib/util/ModelUtil.is 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 FlowzPlatform / workflow / client / static / bpmn / bpmn-js-properties-panel / lib / provider / camunda / parts / SequenceFlowProps.js View on Github external
module.exports = function(group, element, bpmnFactory, translate) {
  var bo;

  if (is(element, 'bpmn:SequenceFlow')) {
    bo = getBusinessObject(element);
  }

  if (!bo) {
    return;
  }

  if (!isConditionalSource(element.source)) {
    return;
  }

  // group.entries.push({
  //   id: 'condition',
  //   label: translate('Condition'),
  //   html: '<div class="bpp-row">' +
  //             '<label for="cam-condition-type">'+translate('Condition Type')+'</label>' +</div>
github bptlab / chor-js / lib / features / rules / ChoreoRules.js View on Github external
ChoreoRules.prototype.canCreate = function(shape, target, source, position) {
  if (is(target, 'bpmn:Choreography')) {
    // elements can be created within a choreography
    return true;
  } else if (is(target, 'bpmn:SubChoreography') && target.collapsed) {
    // elements can not be placed on collapsed sub-choreographies
    return false;
  }
  return BpmnRules.prototype.canCreate.call(this, shape, target, source, position);
};
github bptlab / chor-js / lib / features / rules / ChoreoRules.js View on Github external
this.addRule('element.paste', function(context) {
    var parent = context.parent,
        element = context.element,
        position = context.position,
        source = context.source,
        target = context.target;


    // Check if is either participant or message from choreo
    // Todo: more fine grained implementation based on target, e.g should't be possible to paste only band
    if (is(parent, 'bpmn:ChoreographyActivity') || (is(parent, 'bpmn:Participant') && is(element, 'bpmn:Message'))) {
      return true;
    }

    if (source || target) {
      return self.canConnect(source, target);
    }
    // attach checks for boundary events? canCreate will allways fail for bpmn:Participant
    return self.canAttach([ element ], parent, null, position) || self.canCreate(element, parent, null, position);
  });
github bptlab / chor-js / lib / features / label-editing / ChoreoLabelEditingProvider.js View on Github external
ChoreoLabelEditingProvider.prototype.getEditingBBox = function(element) {
  const boundsAndStyle = LabelEditingProvider.prototype.getEditingBBox.call(this, element);

  if (is(element, 'bpmn:ChoreographyActivity')) {
    const elementBounds = this._canvas.getAbsoluteBBox(element);
    const maxHeight = elementBounds.height - heightOfTopBands(element) - heightOfBottomBands(element);
    let height = maxHeight;
    if (
      (element.businessObject.loopType !== 'None' || !element.businessObject.loopType) ||
      is(element, 'bpmn:CallChoreography') ||
      (is(element, 'bpmn:SubChoreography') &amp;&amp; element.collapsed)) {
      height -= 21; // leave space for the marker to be shown
    }
    if (is(element, 'bpmn:SubChoreography') &amp;&amp; !element.collapsed) {
      height = maxHeight &lt; 20? maxHeight: 20; // Reduce height to one line
    }
    const activityBounds = {
      x: elementBounds.x,
      y: elementBounds.y + heightOfTopBands(element),
      width: elementBounds.width,
      height: height
    };
    boundsAndStyle.bounds = activityBounds;
  }
  return boundsAndStyle;
};
github WPS / domain-story-modeler / app / domain-story-modeler / domain-story / label-editing / DSLabelUtil.js View on Github external
function getLabelAttr(semantic) {
  if (is(semantic, 'domainStory:actorPerson') ||
    is(semantic, 'domainStory:actorGroup') ||
    is(semantic, 'domainStory:actorSystem') ||
    is(semantic, 'domainStory:workObject') ||
    is(semantic, 'domainStory:workObjectFolder') ||
    is(semantic, 'domainStory:workObjectCall') ||
    is(semantic, 'domainStory:workObjectEmail') ||
    is(semantic, 'domainStory:workObjectBubble') ||
    is(semantic, 'domainStory:activity') ||
    is(semantic, 'domainStory:group') ||
    is(semantic, 'domainStory:workObjectInfo')) {

    return 'name';
  }

  if (is(semantic, 'domainStory:textAnnotation')) {
    return 'text';
  }
}
github bpmn-io / bpmn-js-properties-panel / lib / provider / camunda / CamundaPropertiesProvider.js View on Github external
var getInputOutputParameterLabel = function(param, translate) {

  if (is(param, 'camunda:InputParameter')) {
    return translate('Input Parameter');
  }

  if (is(param, 'camunda:OutputParameter')) {
    return translate('Output Parameter');
  }

  return '';
};
github bptlab / scylla / app / app / panelExtension / ScyllaGeneralProperties.js View on Github external
function isActivity(element) {
  return is(element, 'bpmn:SubProcess') || is(element, 'bpmn:Task');
}
github bptlab / chor-js / lib / features / modeling / ChoreoUpdater.js View on Github external
ChoreoUpdater.prototype.updateParent = function(element, oldParent) {
  if (!is(element, 'bpmn:Participant') && !is(element, 'bpmn:Message')) {
    BpmnUpdater.prototype.updateParent.call(this, element, oldParent);
  }
};
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')
        );
      }
    });
  }