Ejemplo n.º 1
0
 public void moveChild(ShapePart childPart, int newIndex) {
   ModelElementList<IModelElement> list = this.modelElement.read(this.modelProperty);
   int oldIndex = list.indexOf(childPart.getLocalModelElement());
   this.modelElement.detach(this.shapePropertyListener, this.propertyName);
   if (oldIndex < newIndex) {
     for (int i = oldIndex; i < newIndex; i++) {
       list.moveDown(childPart.getLocalModelElement());
     }
   } else {
     for (int i = newIndex; i < oldIndex; i++) {
       list.moveUp(childPart.getLocalModelElement());
     }
   }
   this.modelElement.attach(this.shapePropertyListener, this.propertyName);
   this.children.remove(childPart);
   this.children.add(newIndex, childPart);
   broadcast(new ShapeReorderEvent(this));
 }