* @return The size of the arrangement.
*/
protected Size2D arrangeRR(BlockContainer container, Graphics2D g2,
RectangleConstraint constraint) {
Size2D size1 = arrange(container, g2, RectangleConstraint.NONE);
if (constraint.getWidthRange().contains(size1.getWidth())) {
if (constraint.getHeightRange().contains(size1.getHeight())) {
return size1;
}
else {
// width is OK, but height must be constrained
double h = constraint.getHeightRange().constrain(
size1.getHeight());
RectangleConstraint cc = new RectangleConstraint(
size1.getWidth(), h);
return arrangeFF(container, g2, cc);
}
}
else {
if (constraint.getHeightRange().contains(size1.getHeight())) {
// height is OK, but width must be constrained
double w = constraint.getWidthRange().constrain(
size1.getWidth());
RectangleConstraint cc = new RectangleConstraint(w,
size1.getHeight());
return arrangeFF(container, g2, cc);
}
else {
double w = constraint.getWidthRange().constrain(
size1.getWidth());
double h = constraint.getHeightRange().constrain(
size1.getHeight());
RectangleConstraint cc = new RectangleConstraint(w, h);
return arrangeFF(container, g2, cc);
}
}
}