final double[] w = new double[5];
final double[] h = new double[5];
w[0] = constraint.getWidth();
if (this.topBlock != null) {
final RectangleConstraint c1 = new RectangleConstraint(w[0], null,
LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint
.getHeight()), LengthConstraintType.RANGE);
final Size2D size = this.topBlock.arrange(g2, c1);
h[0] = size.height;
}
w[1] = w[0];
if (this.bottomBlock != null) {
final RectangleConstraint c2 = new RectangleConstraint(w[0], null,
LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint
.getHeight()
- h[0]), LengthConstraintType.RANGE);
final Size2D size = this.bottomBlock.arrange(g2, c2);
h[1] = size.height;
}
h[2] = constraint.getHeight() - h[1] - h[0];
if (this.leftBlock != null) {
final RectangleConstraint c3 = new RectangleConstraint(0.0,
new Range(0.0, constraint.getWidth()),
LengthConstraintType.RANGE, h[2], null,
LengthConstraintType.FIXED);
final Size2D size = this.leftBlock.arrange(g2, c3);
w[2] = size.width;
}
h[3] = h[2];
if (this.rightBlock != null) {
final RectangleConstraint c4 = new RectangleConstraint(
0.0,
new Range(0.0, Math.max(constraint.getWidth() - w[2], 0.0)),
LengthConstraintType.RANGE, h[2], null,
LengthConstraintType.FIXED);
final Size2D size = this.rightBlock.arrange(g2, c4);
w[3] = size.width;
}