Package de.fu_berlin.inf.dpp.whiteboard.gef.model

Examples of de.fu_berlin.inf.dpp.whiteboard.gef.model.LayoutElementRecord


    cmd.setPointList(pointList);
    cmd.execute();

    assertTrue(document.getRoot().getVisibleChildElements().size() == 1);

    LayoutElementRecord polyLine = (LayoutElementRecord) document.getRoot()
        .getVisibleChildElements().get(0);

    assertTrue(polyLine.getVisibleAttributes().size() == 1);

    origPointsAttribute = polyLine
        .getAttributeValue(SVGConstants.SVG_POINTS_ATTRIBUTE);

    assertNotNull(origPointsAttribute);

    // }
    //
    // @Test
    // public void testConflictingSetRecords() {

    Point locOrig = polyLine.getLocation();
    Point loc1 = new Point(10, 10);
    Rectangle rect1 = new Rectangle(loc1, polyLine.getSize());

    ElementRecordChangeLayoutCommand cmd1 = new ElementRecordChangeLayoutCommand();
    cmd1.setModel(polyLine);
    cmd1.setConstraint(rect1);
    cmd1.execute();

    assertTrue(polyLine.getLocation().equals(loc1));

    Point loc2 = new Point(20, 20);
    Rectangle rect2 = new Rectangle(loc2, polyLine.getSize());

    ElementRecordChangeLayoutCommand cmd2 = new ElementRecordChangeLayoutCommand();
    cmd2.setModel(polyLine);
    cmd2.setConstraint(rect2);
    ConflictingSXECommand conflict2 = new ConflictingSXECommand(cmd2);
    conflict2.execute();

    assertTrue(polyLine.getLocation().equals(locOrig));

  }
View Full Code Here


    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();
View Full Code Here

        + request.getSize());

    if (request.getType() == REQ_CREATE
        && getHost() instanceof ElementRecordPart) {

      LayoutElementRecord parent = (LayoutElementRecord) getHost()
          .getModel();
      Rectangle constraint = (Rectangle) getConstraintFor(request);

      // TODO fix point list figure that is wrong positioned on non-root
      /*
 
View Full Code Here

    if (request.getType() == REQ_CREATE_POINTLIST
        && getHost() instanceof ElementRecordPart) {
      try {

        LayoutElementRecord parent = (LayoutElementRecord) getHost()
            .getModel();
        PointList points = getPointListFor(request);

        // pencil on root only
        parent = LayoutUtils.translateToAndGetRoot(points, parent);
View Full Code Here

    while (it.hasNext()) {
      o = it.next();
      if (!(o instanceof EditPart))
        continue;
      EditPart ep = (EditPart) o;
      LayoutElementRecord node = (LayoutElementRecord) ep.getModel();
      if (!cmd.isCopyableNode(node)) // TODO only copy others?
        return null;
      cmd.addElement(node);
    }
    return cmd;
View Full Code Here

    return documentRecord;
  }

  @Override
  protected boolean canUndoSXECommand() {
    LayoutElementRecord parent;

    if (recordSet.getRootRecords().isEmpty())
      return false;

    try {
      for (ElementRecord e : recordSet.getRootRecords()) {
        parent = (LayoutElementRecord) e.getParent();
        if (!parent.isPartOfVisibleDocument())
          return false;
        if (!parent.isComposite())
          return false;
        /*
         * also if existent, let's just set it visible again. Will be
         * ignored by the controller then.
         */
 
View Full Code Here

   *         descendants
   */
  protected List<IRecord> createCopyRecords(LayoutElementRecord toCopy) {
    Rectangle layout = toCopy.getLayout();
    // add copies to root only
    LayoutElementRecord parent = (LayoutElementRecord) toCopy.getParent();
    parent = LayoutUtils.translateToAndGetRoot(layout, parent);

    // shift layout
    layout.translate(shiftCount * SHIFT_FOR_COPY, shiftCount
        * SHIFT_FOR_COPY);

    // copy
    LayoutElementRecord copy = (LayoutElementRecord) toCopy.getCopy();
    copy.setParent(parent);

    List<IRecord> records = new LinkedList<IRecord>();

    List<IRecord> layoutAttributes = toCopy.createLayoutRecords(layout,
        true);
View Full Code Here

TOP

Related Classes of de.fu_berlin.inf.dpp.whiteboard.gef.model.LayoutElementRecord

Copyright © 2018 www.massapicom. 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.