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; }
public int getHeight() { return Math.abs(startVertex.getY() - endVertex.getY()); }
/* (non-Javadoc) * @see com.cosylab.vdct.graphics.objects.VisibleObject#getY() */ public int getY() { return Math.min(startVertex.getY(), endVertex.getY()); }