/**
  * Arranges the contents of the block, within the given constraints, and returns the block size.
  *
  * @param g2 the graphics device.
  * @param constraint the constraint (<code>null</code> not permitted).
  * @return The block size (in Java2D units, never <code>null</code>).
  */
 public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
   RectangleConstraint cc = toContentConstraint(constraint);
   LengthConstraintType w = cc.getWidthConstraintType();
   LengthConstraintType h = cc.getHeightConstraintType();
   Size2D contentSize = null;
   if (w == LengthConstraintType.NONE) {
     if (h == LengthConstraintType.NONE) {
       contentSize = new Size2D(getWidth(), getHeight());
     } else if (h == LengthConstraintType.RANGE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   } else if (w == LengthConstraintType.RANGE) {
     if (h == LengthConstraintType.NONE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.RANGE) {
       contentSize = arrangeRR(g2, cc.getWidthRange(), cc.getHeightRange());
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   } else if (w == LengthConstraintType.FIXED) {
     if (h == LengthConstraintType.NONE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.RANGE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   }
   return new Size2D(
       calculateTotalWidth(contentSize.getWidth()), calculateTotalHeight(contentSize.getHeight()));
 }
 protected Size2D arrangeExtracted(RectangleConstraint constraint, Graphics2D g2)
     throws RuntimeException {
   RectangleConstraint cc = toContentConstraint(constraint);
   LengthConstraintType w = cc.getWidthConstraintType();
   LengthConstraintType h = cc.getHeightConstraintType();
   Size2D contentSize = null;
   if (w == LengthConstraintType.NONE) {
     if (h == LengthConstraintType.NONE) {
       contentSize = arrangeNN(g2);
     } else if (h == LengthConstraintType.RANGE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   } else if (w == LengthConstraintType.RANGE) {
     if (h == LengthConstraintType.NONE) {
       contentSize = arrangeRN(g2, cc.getWidthRange());
     } else if (h == LengthConstraintType.RANGE) {
       contentSize = arrangeRR(g2, cc.getWidthRange(), cc.getHeightRange());
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   } else if (w == LengthConstraintType.FIXED) {
     if (h == LengthConstraintType.NONE) {
       contentSize = arrangeFN(g2, cc.getWidth());
     } else if (h == LengthConstraintType.RANGE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   }
   assert contentSize != null;
   return contentSize;
 }
 /**
  * Arranges the contents of the block, within the given constraints, and returns the block size.
  *
  * @param g2 the graphics device.
  * @param constraint the constraint (<code>null</code> not permitted).
  * @param params the layout parameters (<code>null</code> not permitted).
  * @return The block size (in Java2D units, never <code>null</code>).
  */
 public ArrangeResult arrange(
     Graphics2D g2, RectangleConstraint constraint, ArrangeParams params) {
   RectangleConstraint contentConstraint = toContentConstraint(constraint);
   LengthConstraintType w = contentConstraint.getWidthConstraintType();
   LengthConstraintType h = contentConstraint.getHeightConstraintType();
   ArrangeResult result = null;
   if (w == LengthConstraintType.NONE) {
     if (h == LengthConstraintType.NONE) {
       result = arrangeNN(g2, params);
     } else if (h == LengthConstraintType.RANGE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   } else if (w == LengthConstraintType.RANGE) {
     if (h == LengthConstraintType.NONE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.RANGE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.FIXED) {
       throw new RuntimeException("Not yet implemented.");
     }
   } else if (w == LengthConstraintType.FIXED) {
     if (h == LengthConstraintType.NONE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.RANGE) {
       throw new RuntimeException("Not yet implemented.");
     } else if (h == LengthConstraintType.FIXED) {
       result = arrangeFF(g2, contentConstraint.getWidth(), contentConstraint.getHeight(), params);
     }
   }
   // TODO: review messaging here
   result.setSize(
       calculateTotalWidth(result.getWidth()), calculateTotalHeight(result.getHeight()));
   return result;
 }