* @see org.gwt.mosaic.ui.client.layout.LayoutManager#getPreferredSize(org.gwt.mosaic.ui.client.layout.LayoutPanel)
*/
public Dimension getPreferredSize(LayoutPanel layoutPanel) {
assert layoutPanel != null;
final Dimension result = new Dimension();
if (!init(layoutPanel)) {
return result;
}
int width = marginLeftMeasure.sizeOf(layoutPanel)
+ marginRightMeasure.sizeOf(layoutPanel)
+ borderLeftMeasure.sizeOf(layoutPanel)
+ borderRightMeasure.sizeOf(layoutPanel)
+ paddingLeftMeasure.sizeOf(layoutPanel)
+ paddingRightMeasure.sizeOf(layoutPanel);
int height = marginTopMeasure.sizeOf(layoutPanel)
+ marginBottomMeasure.sizeOf(layoutPanel)
+ borderTopMeasure.sizeOf(layoutPanel)
+ borderBottomMeasure.sizeOf(layoutPanel)
+ paddingTopMeasure.sizeOf(layoutPanel)
+ paddingBottomMeasure.sizeOf(layoutPanel);
final int size = visibleChildList.size();
if (size == 0) {
result.width = width;
result.height = height;
return result;
}
final int spacing = layoutPanel.getWidgetSpacing();
height += ((size - 1) * spacing);
Dimension decPanelFrameSize = null;
int maxWidth = 0;
for (Widget child : visibleChildList) {
if (child instanceof InternalDecoratorPanel) {
child = ((InternalDecoratorPanel) child).getWidget();
}
final Widget parent = child.getParent();
if (parent instanceof InternalDecoratorPanel) {
final InternalDecoratorPanel decPanel = (InternalDecoratorPanel) parent;
final int borderSizes[] = decPanel.getBorderSizes();
decPanelFrameSize = new Dimension(borderSizes[1] + borderSizes[3],
borderSizes[0] + borderSizes[0]);
}
int w = preferredWidthMeasure.sizeOf(child);
height += preferredHeightMeasure.sizeOf(child);