/**
* @see Manager#sublayout(int, int)
*/
protected void sublayout(final int width, final int height) {
Field firstField;
Field secondField;
if (_giveTopFieldPriority) {
firstField = _topField;
secondField = _bottomField;
} else {
firstField = _bottomField;
secondField = _topField;
}
int maxWidth = 0;
final int firstFieldLeftMargin = firstField.getMarginLeft();
final int firstFieldRightMargin = firstField.getMarginRight();
final int secondFieldLeftMargin = secondField.getMarginLeft();
final int secondFieldRightMargin = secondField.getMarginRight();
final int bottomFieldMarginBottom = _bottomField.getMarginBottom();
final int topFieldMarginTop = _topField.getMarginTop();
int availableHeight = height;
availableHeight -= topFieldMarginTop;
availableHeight -=
Math.max(_topField.getMarginBottom(), _bottomField
.getMarginTop());
availableHeight -= bottomFieldMarginBottom;
layoutChild(firstField, width - firstFieldLeftMargin
- firstFieldRightMargin, availableHeight);
maxWidth =
Math.max(maxWidth, firstFieldLeftMargin + firstField.getWidth()
+ firstFieldRightMargin);
availableHeight -= firstField.getHeight();
layoutChild(secondField, width - secondFieldLeftMargin
- secondFieldRightMargin, availableHeight);
maxWidth =
Math.max(maxWidth, secondFieldLeftMargin
+ secondField.getWidth() + secondFieldRightMargin);
availableHeight -= secondField.getHeight();
setPositionChild(_topField, 0, topFieldMarginTop);
setPositionChild(_bottomField, 0, height - _bottomField.getHeight()
- bottomFieldMarginBottom);