function OrderingProvider(eventBus) {

  CommandInterceptor.call(this, eventBus);


  var self = this;

  this.preExecute([ 'shape.create', 'connection.create' ], function(event) {

    var context = event.context,
        element = context.shape || context.connection,
        parent = context.parent;

    var ordering = self.getOrdering(element, parent);

    if (ordering) {

      if (ordering.parent !== undefined) {
        context.parent = ordering.parent;
      }

      context.parentIndex = ordering.index;
    }
  });

  this.preExecute([ 'shape.move', 'connection.move' ], function(event) {

    var context = event.context,
        element = context.shape || context.connection,
        parent = context.newParent || element.parent;

    var ordering = self.getOrdering(element, parent);

    if (ordering) {

      if (ordering.parent !== undefined) {
        context.newParent = ordering.parent;
      }

      context.newParentIndex = ordering.index;
    }
  });
}
An abstract provider that allows modelers to implement a custom
ordering of diagram elements on the canvas.

It makes sure that the order is always preserved during element
creation and move operations.

In order to use this behavior, inherit from it and override
the method {@link OrderingProvider#getOrdering}.

@example

```javascript
function CustomOrderingProvider(eventBus) {
  OrderingProvider.call(this, eventBus);

  this.getOrdering = function(element, newParent) {
    // always insert elements at the front
    // when moving
    return {
      index: 0,
      parent: newParent
    };
  };
}
```

@param {EventBus} eventBus