How to use the bpmn-js/lib/features/rules/BpmnRules.prototype 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 / features / rules / ChoreoRules.js View on Github external
ChoreoRules.prototype.canConnect = function(source, target, connection) {
  if (!is(connection, 'bpmn:DataAssociation')) {
    if (is(source, 'bpmn:EventBasedGateway') && is(target, 'bpmn:ChoreographyTask')) {
      // event-based gateways can connect to choreography tasks
      return { type: 'bpmn:SequenceFlow' };
    }
  }
  return BpmnRules.prototype.canConnect.call(this, source, target, connection);
};
github bptlab / chor-js / lib / features / rules / ChoreoRules.js View on Github external
ChoreoRules.prototype.canResize = function(shape, newBounds) {
  if (is(shape, 'bpmn:ChoreographyActivity')) {
    // choreography activities can be resized
    return true;
  } else if (shape.type === 'bpmn:Participant') {
    // participants (= participant bands) can not be resized
    return false;
  }
  return BpmnRules.prototype.canResize.call(this, shape, newBounds);
};
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
ChoreoRules.prototype.canMove = function(shapes, target) {
  // participant bands and messages are not movable
  let isNotMovable = function(shape) {
    return is(shape, 'bpmn:Participant') || is(shape, 'bpmn:Message');
  };
  if (shapes.some(isNotMovable)) {
    return false;
  }
  return BpmnRules.prototype.canMove.call(this, shapes, target);
};
github bptlab / chor-js / lib / features / rules / ChoreoRules.js View on Github external
ChoreoRules.prototype.canConnectSequenceFlow = function(source, target) {
  if (is(source, 'bpmn:EventBasedGateway') && is(target, 'bpmn:ChoreographyActivity')) {
    return true;
  }
  return BpmnRules.prototype.canConnectSequenceFlow.call(this, source, target);
};