Ejemplo n.º 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;
  }
Ejemplo n.º 2
0
 public int getWidth() {
   return Math.abs(startVertex.getX() - endVertex.getX());
 }
Ejemplo n.º 3
0
 /* (non-Javadoc)
  * @see com.cosylab.vdct.graphics.objects.VisibleObject#getX()
  */
 public int getX() {
   return Math.min(startVertex.getX(), endVertex.getX());
 }