// ---
int left = paddingLeftMeasure.sizeOf(layoutPanel);
int top = paddingTopMeasure.sizeOf(layoutPanel);
final Dimension box = DOM.getClientSize(layoutPanel.getElement());
final int width = box.width
- (left + paddingRightMeasure.sizeOf(layoutPanel));
final int height = box.height
- (top + paddingBottomMeasure.sizeOf(layoutPanel));
// ---
final int spacing = layoutPanel.getWidgetSpacing();
int right = left + width;
int bottom = top + height;
if (north != null) {
final BorderLayoutData layoutData = getLayoutData(north);
if (layoutData.resizable && !layoutData.collapsed) {
if (northSplitBar == null) {
northSplitBar = new BorderLayoutSplitBar(layoutPanel, north);
northSplitBar.setStyleName("NorthSplitBar");
layoutPanel.add(northSplitBar);
}
} else {
if (northSplitBar != null) {
layoutPanel.removeImpl(northSplitBar);
northSplitBar = null;
}
}
int h = preferredHeightMeasure.sizeOf(north);
layoutData.targetLeft = left;
layoutData.targetTop = top;
layoutData.targetWidth = Math.max(0, right - left);
layoutData.targetHeight = h;
final Widget parent = north.getParent();
if (parent instanceof InternalDecoratorPanel) {
final InternalDecoratorPanel decPanel = (InternalDecoratorPanel) parent;
final int borderSizes[] = decPanel.getBorderSizes();
final Dimension decPanelBorderSize = new Dimension(borderSizes[1]
+ borderSizes[3], borderSizes[0] + borderSizes[0]);
layoutData.targetWidth -= decPanelBorderSize.width;
h += decPanelBorderSize.height;
}
if (layoutPanel.isAnimationEnabled()) {
layoutData.setSourceLeft(layoutData.targetLeft);
layoutData.setSourceTop(layoutData.targetTop);
layoutData.setSourceWidth(north.getOffsetWidth());
layoutData.setSourceHeight(north.getOffsetHeight());
}
// split bar
if (layoutData.resizable && northSplitBar.isAttached()) {
WidgetHelper.setBounds(layoutPanel, northSplitBar, left, top + h,
Math.max(0, right - left), spacing);
}
top += (h + spacing);
}
if (south != null) {
final BorderLayoutData layoutData = getLayoutData(south);
if (layoutData.resizable && !layoutData.collapsed) {
if (southSplitBar == null) {
southSplitBar = new BorderLayoutSplitBar(layoutPanel, south);
southSplitBar.setStyleName("SouthSplitBar");
layoutPanel.add(southSplitBar);
}
} else {
if (southSplitBar != null) {
layoutPanel.removeImpl(southSplitBar);
southSplitBar = null;
}
}
int h = preferredHeightMeasure.sizeOf(south);
layoutData.targetLeft = left;
layoutData.targetTop = Math.max(0, bottom - h);
layoutData.targetWidth = Math.max(0, right - left);
layoutData.targetHeight = h;
final Widget parent = south.getParent();
if (parent instanceof InternalDecoratorPanel) {
final InternalDecoratorPanel decPanel = (InternalDecoratorPanel) parent;
final int borderSizes[] = decPanel.getBorderSizes();
final Dimension decPanelBorderSize = new Dimension(borderSizes[1]
+ borderSizes[3], borderSizes[0] + borderSizes[0]);
layoutData.targetWidth -= decPanelBorderSize.width;
layoutData.targetTop -= decPanelBorderSize.height;
h += decPanelBorderSize.height;
}
if (layoutPanel.isAnimationEnabled()) {
layoutData.setSourceLeft(layoutData.targetLeft);
layoutData.setSourceTop(south.getAbsoluteTop()
- layoutPanel.getAbsoluteTop()
- paddingBottomMeasure.sizeOf(layoutPanel));
layoutData.setSourceWidth(south.getOffsetWidth());
layoutData.setSourceHeight(south.getOffsetHeight());
}
// split bar
if (layoutData.resizable && southSplitBar.isAttached()) {
WidgetHelper.setBounds(layoutPanel, southSplitBar, left, Math.max(0,
bottom - h)
- spacing, Math.max(0, right - left), spacing);
}
bottom -= (h + spacing);
}
if (west != null) {
final BorderLayoutData layoutData = getLayoutData(west);
if (layoutData.resizable && !layoutData.collapsed) {
if (westSplitBar == null) {
westSplitBar = new BorderLayoutSplitBar(layoutPanel, west);
westSplitBar.setStyleName("WestSplitBar");
layoutPanel.add(westSplitBar);
}
} else {
if (westSplitBar != null) {
layoutPanel.removeImpl(westSplitBar);
westSplitBar = null;
}
}
int w = preferredWidthMeasure.sizeOf(west);
layoutData.targetLeft = left;
layoutData.targetTop = top;
layoutData.targetWidth = w;
layoutData.targetHeight = Math.max(0, bottom - top);
final Widget parent = west.getParent();
if (parent instanceof InternalDecoratorPanel) {
final InternalDecoratorPanel decPanel = (InternalDecoratorPanel) parent;
final int borderSizes[] = decPanel.getBorderSizes();
final Dimension decPanelBorderSize = new Dimension(borderSizes[1]
+ borderSizes[3], borderSizes[0] + borderSizes[0]);
layoutData.targetHeight -= decPanelBorderSize.height;
w += decPanelBorderSize.width;
}
if (layoutPanel.isAnimationEnabled()) {
layoutData.setSourceLeft(west.getAbsoluteLeft()
- layoutPanel.getAbsoluteLeft()
- paddingLeftMeasure.sizeOf(layoutPanel));
layoutData.setSourceTop(west.getAbsoluteTop()
- layoutPanel.getAbsoluteTop()
- paddingTopMeasure.sizeOf(layoutPanel));
layoutData.setSourceWidth(west.getOffsetWidth());
layoutData.setSourceHeight(west.getOffsetHeight());
}
// split bar
if (layoutData.resizable && westSplitBar.isAttached()) {
WidgetHelper.setBounds(layoutPanel, westSplitBar, left + w, top,
spacing, Math.max(0, bottom - top));
}
left += (w + spacing);
}
if (east != null) {
final BorderLayoutData layoutData = getLayoutData(east);
if (layoutData.resizable && !layoutData.collapsed) {
if (eastSplitBar == null) {
eastSplitBar = new BorderLayoutSplitBar(layoutPanel, east);
eastSplitBar.setStyleName("EastSplitBar");
layoutPanel.add(eastSplitBar);
}
} else {
if (eastSplitBar != null) {
layoutPanel.removeImpl(eastSplitBar);
eastSplitBar = null;
}
}
int w = preferredWidthMeasure.sizeOf(east);
layoutData.targetLeft = Math.max(0, right - w);
layoutData.targetTop = top;
layoutData.targetWidth = w;
layoutData.targetHeight = Math.max(0, bottom - top);
final Widget parent = east.getParent();
if (parent instanceof InternalDecoratorPanel) {
final InternalDecoratorPanel decPanel = (InternalDecoratorPanel) parent;
final int borderSizes[] = decPanel.getBorderSizes();
final Dimension decPanelBorderSize = new Dimension(borderSizes[1]
+ borderSizes[3], borderSizes[0] + borderSizes[0]);
layoutData.targetLeft -= decPanelBorderSize.width;
layoutData.targetHeight -= decPanelBorderSize.height;
w += decPanelBorderSize.width;
}
if (layoutPanel.isAnimationEnabled()) {
layoutData.setSourceLeft(east.getAbsoluteLeft()
- layoutPanel.getAbsoluteLeft()
- paddingRightMeasure.sizeOf(layoutPanel));
layoutData.setSourceTop(east.getAbsoluteTop()
- layoutPanel.getAbsoluteTop()
- paddingTopMeasure.sizeOf(layoutPanel));
layoutData.setSourceWidth(east.getOffsetWidth());
layoutData.setSourceHeight(east.getOffsetHeight());
}
// split bar
if (layoutData.resizable && eastSplitBar.isAttached()) {
WidgetHelper.setBounds(layoutPanel, eastSplitBar, Math.max(0, right
- w)
- spacing, top, spacing, Math.max(0, bottom - top));
}
right -= (w + spacing);
}
if (center != null) {
BorderLayoutData layoutData = getLayoutData(center);
layoutData.targetLeft = left;
layoutData.targetTop = top;
layoutData.targetWidth = Math.max(1, right - left);
layoutData.targetHeight = Math.max(1, bottom - top);
final Widget parent = center.getParent();
if (parent instanceof InternalDecoratorPanel) {
final InternalDecoratorPanel decPanel = (InternalDecoratorPanel) parent;
final int borderSizes[] = decPanel.getBorderSizes();
final Dimension decPanelBorderSize = new Dimension(borderSizes[1]
+ borderSizes[3], borderSizes[0] + borderSizes[0]);
layoutData.targetWidth -= decPanelBorderSize.width;
layoutData.targetHeight -= decPanelBorderSize.height;
}