Beispiel #1
0
  public Flexible copyToGroup(String group) {

    String newName;
    if (group.equals(nullString)) newName = Group.substractObjectName(getName());
    else newName = group + Constants.GROUP_SEPARATOR + Group.substractObjectName(getName());

    // object with new name already exists, add suffix ///!!!
    while (Group.getRoot().findObject(newName, true) != null)
      newName = StringUtils.incrementName(newName, Constants.COPY_SUFFIX);

    Box grBox =
        new Box(
            newName,
            null,
            startVertex.getX(),
            startVertex.getY(),
            endVertex.getX(),
            endVertex.getY());
    grBox.setColor(getColor());
    Group.getRoot().addSubObject(newName, grBox, true);

    // ViewState view = ViewState.getInstance();
    // grBox.move(20 - view.getRx(), 20 - view.getRy());

    unconditionalValidation();
    return grBox;
  }
Beispiel #2
0
 public int getHeight() {
   return Math.abs(startVertex.getY() - endVertex.getY());
 }
Beispiel #3
0
 /* (non-Javadoc)
  * @see com.cosylab.vdct.graphics.objects.VisibleObject#getY()
  */
 public int getY() {
   return Math.min(startVertex.getY(), endVertex.getY());
 }