How to use the diagram-js/lib/command/CommandInterceptor.default.call function in diagram-js

To help you get started, we’ve selected a few diagram-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 bpmn-io / cmmn-js / lib / features / modeling / behavior / PlanItemDefinitionUpdater.js View on Github external
function PlanItemDefinitionUpdater(
    eventBus,
    modeling,
    cmmnReplace,
    itemRegistry
) {

  this._modeling = modeling;
  this._cmmnReplace = cmmnReplace;
  this._itemRegistry = itemRegistry;

  var self = this;

  CommandInterceptor.call(this, eventBus);

  var containment = 'planItemDefinitions';


  // CREATION //////////////////////////////////////////////////////////

  this.postExecuted('shape.create', function(context) {

    var shape = context.shape;

    if (!isItemCapable(shape)) {
      return;
    }

    var item = getBusinessObject(shape),
        definition = getDefinition(item),
github bpmn-io / cmmn-js / lib / features / modeling / CmmnUpdater.js View on Github external
function CmmnUpdater(eventBus, cmmnFactory, itemRegistry, connectionDocking) {

  CommandInterceptor.call(this, eventBus);

  this._cmmnFactory = cmmnFactory;
  this._itemRegistry = itemRegistry;

  var self = this;


  // connection cropping /////////////////

  // crop connection ends during create/update
  function cropConnection(e) {
    var context = e.context,
        connection;

    if (!context.cropped) {
      connection = context.connection;
github bpmn-io / cmmn-js / lib / features / modeling / behavior / SentryUpdater.js View on Github external
function SentryUpdater(eventBus, modeling, itemRegistry, cmmnReplace, cmmnFactory) {

  var self = this;

  CommandInterceptor.call(this, eventBus);

  var containment = 'sentries';


  // CONNECTIONS ////////////////////////////////////////////////////////////

  this.postExecuted('connection.create', function(context) {

    var connection = context.connection;

    if (!isOnPartConnection(connection)) {
      return;
    }

    var onPart = getOnPart(connection),
        criterion = connection.target,
github bpmn-io / cmmn-js / lib / features / modeling / behavior / PlanningTableUpdater.js View on Github external
function PlanningTableUpdater(eventBus, cmmnFactory, modeling, itemRegistry) {

  this._cmmnFactory = cmmnFactory;
  this._modeling = modeling;
  this._itemRegistry = itemRegistry;

  var self = this;

  CommandInterceptor.call(this, eventBus);

  var containment = 'tableItems';

  // CONNECTION /////////////////////////////////////////////


  // delete + reconnectEnd //////////////////////////////////


  this.preExecuted([ 'connection.delete', 'connection.reconnectEnd', 'connection.reconnectStart' ], function(event) {

    var context = event.context,
        isReconnectStart = (event.command === 'connection.reconnectStart'),
        connection = context.connection,
        target = connection.target;
github bpmn-io / cmmn-js / lib / features / modeling / behavior / LabelBehavior.js View on Github external
function LabelBehavior(eventBus, modeling, cmmnFactory) {

  CommandInterceptor.call(this, eventBus);

  // create external labels on shape creation

  this.postExecuted([ 'shape.create', 'connection.create' ], 200, function(e) {
    var context = e.context;

    var element = context.shape || context.connection,
        businessObject = element.businessObject;

    var position;

    if (hasExternalLabel(businessObject)) {
      position = getExternalLabelMid(element);

      modeling.createLabel(element, position, {
        id: businessObject.id + '_label',
github bpmn-io / cmmn-js / lib / features / modeling / behavior / ReplaceElementBehavior.js View on Github external
function ReplaceElementBehavior(
    cmmnReplace,
    cmmnRules,
    elementFactory,
    elementRegistry,
    eventBus,
    modeling,
    selection,
    rules
) {

  CommandInterceptor.call(this, eventBus);

  this._cmmnReplace = cmmnReplace;
  this._cmmnRules = cmmnRules;
  this._elementFactory = elementFactory;
  this._elementRegistry = elementRegistry;
  this._modeling = modeling;
  this._selection = selection;
  this._rules = rules;

  var self = this;


  function canConnect(source, target) {

    return rules.allowed('connection.create', {
      source: source,
github bpmn-io / cmmn-js / lib / features / modeling / behavior / UnclaimIdBehavior.js View on Github external
function UnclaimIdBehavior(eventBus, modeling) {

  CommandInterceptor.call(this, eventBus);

  this.preExecute('elements.delete', function(event) {
    var context = event.context,
        elements = context.elements;

    forEach(elements, function(element) {
      modeling.unclaimId(element.businessObject.id, element.businessObject);
    });

  });
}
github bpmn-io / cmmn-js / lib / features / modeling / behavior / CaseFileItemUpdater.js View on Github external
function CaseFileItemUpdater(
    eventBus,
    itemRegistry,
    cmmnFactory,
    modeling
) {

  this._cmmnFactory = cmmnFactory;
  this._modeling = modeling;

  CommandInterceptor.call(this, eventBus);

  var containment = 'caseFileItems';


  this.preExecuted('shape.create', function(context) {

    var shape = context.shape,
        parent = context.parent,
        parentBusinessObject = getBusinessObject(parent),
        definitions,
        caseFileItemDefinition,
        caseFileModel;


    if (!isCaseFileItem(shape)) {
      return;
github bpmn-io / cmmn-js / lib / features / modeling / behavior / ReplaceConnectionBehavior.js View on Github external
function ReplaceConnectionBehavior(eventBus, modeling, cmmnRules, selection, rules) {

  CommandInterceptor.call(this, eventBus);


  function canConnectPlanItemOnPartConnection(source, target) {
    return cmmnRules.canConnectPlanItemOnPartConnection(source, target);
  }


  function canConnectCaseFileItemOnPartConnection(source, target) {
    return cmmnRules.canConnectCaseFileItemOnPartConnection(source, target);
  }


  function canConnectDiscretionaryConnection(source, target, connection) {
    return cmmnRules.canConnectDiscretionaryConnection(source, target, connection);
  }
github bpmn-io / cmmn-js / lib / features / replace-preview / CmmnReplacePreview.js View on Github external
function CmmnReplacePreview(
    cmmnReplace,
    cmmnRules,
    elementFactory,
    elementRegistry,
    eventBus,
    graphicsFactory
) {

  CommandInterceptor.call(this, eventBus);


  function createShape(element, replacement) {

    var newElement = {
      type: replacement.newElementType,
      x: element.x,
      y: element.y,
      width: element.width,
      height: element.height
    };

    if (isItemCapable(element)) {

      var bo = getBusinessObject(element),
          definition = getDefinition(element),