Examples of ElementRecordAddCommand


Examples of de.fu_berlin.inf.dpp.whiteboard.gef.commands.ElementRecordAddCommand

  /*
   * Paraphrase: change (or rather "add to another") parent command
   */
  @Override
  protected Command createAddCommand(EditPart child, Object constraint) {
    ElementRecordAddCommand command = null;

    log.trace("Create Add Command " + child);

    if (child instanceof ElementRecordPart) {
      LayoutElementRecord parent = (LayoutElementRecord) getHost()
          .getModel();

      if (child.getModel() instanceof SVGPolylineRecord) {
        parent = LayoutUtils.translateToAndGetRoot(
            (Translatable) constraint, parent);
      } else {
        parent = LayoutUtils.translateAndGetParent(
            (Translatable) constraint, parent);
      }

      // if parent is same than just change the layout
      if (parent.equals(((ElementRecordPart) child).getElementRecord()
          .getParent())) {
        return createChangeConstraintCommand(child, constraint);
      }

      command = new ElementRecordAddCommand();
      command.setElementModel(child.getModel());
      command.setParent(parent);
      command.setLayout((Rectangle) constraint);
    }

    return command;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.