\r
private boolean isRendering = false;\r
\r
+ private String width = null;\r
+\r
@Override\r
public void setStyleName(String styleName) {\r
super.setStyleName(styleName);\r
\r
public IOrderedLayout() {\r
setStyleName(CLASSNAME);\r
+ // DOM.setStyleAttribute(getElement(), "overflow", "hidden");\r
}\r
\r
@Override\r
\r
// w.mark("Widget sizes updated");\r
\r
+ /*\r
+ * Components with relative size in main direction may affect the layout\r
+ * size in the other direction\r
+ */\r
+ if ((isHorizontal() && isDynamicHeight())\r
+ || (isVertical() && isDynamicWidth())) {\r
+ calculateLayoutDimensions();\r
+ }\r
+ // w.mark("Layout dimensions updated");\r
+\r
/* Update component spacing */\r
updateContainerMargins();\r
\r
for (ChildComponentContainer childComponentContainer : widgetToComponentContainer\r
.values()) {\r
\r
+ int widgetHeight = 0;\r
+ int widgetWidth = 0;\r
if (childComponentContainer.isComponentRelativeSized(orientation)) {\r
- continue;\r
- }\r
-\r
- Size s = childComponentContainer.getWidgetSize();\r
- int widgetWidth = s.getWidth()\r
- + childComponentContainer.getCaptionWidthAfterComponent();\r
-\r
- /*\r
- * If the component does not have a specified size in the main\r
- * direction the caption may determine the space used by the\r
- * component\r
- */\r
- if (!childComponentContainer.widgetHasSizeSpecified(orientation)) {\r
- int captionWidth = childComponentContainer.getCaptionWidth();\r
- if (captionWidth > widgetWidth) {\r
- widgetWidth = captionWidth;\r
+ if (orientation == ORIENTATION_HORIZONTAL) {\r
+ widgetHeight = getWidgetHeight(childComponentContainer);\r
+ } else {\r
+ widgetWidth = getWidgetWidth(childComponentContainer);\r
}\r
+ } else {\r
+ widgetWidth = getWidgetWidth(childComponentContainer);\r
+ widgetHeight = getWidgetHeight(childComponentContainer);\r
}\r
\r
- int widgetHeight = s.getHeight()\r
- + childComponentContainer.getCaptionHeightAboveComponent();\r
-\r
- // ApplicationConnection.getConsole().log(\r
- // "Container width: " + widgetWidth);\r
-\r
summedWidgetWidth += widgetWidth;\r
summedWidgetHeight += widgetHeight;\r
\r
return remainingSpace;\r
}\r
\r
+ private int getWidgetHeight(ChildComponentContainer childComponentContainer) {\r
+ Size s = childComponentContainer.getWidgetSize();\r
+ return s.getHeight()\r
+ + childComponentContainer.getCaptionHeightAboveComponent();\r
+ }\r
+\r
+ private int getWidgetWidth(ChildComponentContainer childComponentContainer) {\r
+ Size s = childComponentContainer.getWidgetSize();\r
+ int widgetWidth = s.getWidth()\r
+ + childComponentContainer.getCaptionWidthAfterComponent();\r
+\r
+ /*\r
+ * If the component does not have a specified size in the main direction\r
+ * the caption may determine the space used by the component\r
+ */\r
+ if (!childComponentContainer.widgetHasSizeSpecified(orientation)) {\r
+ int captionWidth = childComponentContainer.getCaptionWidth();\r
+ if (captionWidth > widgetWidth) {\r
+ widgetWidth = captionWidth;\r
+ }\r
+ }\r
+\r
+ return widgetWidth;\r
+ }\r
+\r
private void calculateAlignments() {\r
int w = 0;\r
int h = 0;\r
int totalComponentHeight, int maxComponentWidth,\r
int maxComponentHeight) {\r
\r
+ /* Only need to calculate dynamic dimensions */\r
+ if (!isDynamicHeight() && !isDynamicWidth()) {\r
+ return activeLayoutSize;\r
+ }\r
+\r
int activeLayoutWidth = 0;\r
int activeLayoutHeight = 0;\r
\r
// Horizontal\r
if (isDynamicWidth()) {\r
activeLayoutWidth = totalComponentWidth;\r
- setOuterLayoutWidth(activeLayoutWidth);\r
- } else {\r
- activeLayoutWidth = getOffsetWidth()\r
- - activeMargins.getHorizontal();\r
}\r
\r
if (isDynamicHeight()) {\r
activeLayoutHeight = maxComponentHeight;\r
- setOuterLayoutHeight(maxComponentHeight);\r
- } else {\r
- activeLayoutHeight = getOffsetHeight()\r
- - activeMargins.getVertical();\r
-\r
}\r
\r
} else {\r
// Vertical\r
if (isDynamicWidth()) {\r
activeLayoutWidth = maxComponentWidth;\r
- setOuterLayoutWidth(maxComponentWidth);\r
- } else {\r
- activeLayoutWidth = getOffsetWidth()\r
- - activeMargins.getHorizontal();\r
}\r
\r
if (isDynamicHeight()) {\r
activeLayoutHeight = totalComponentHeight;\r
- setOuterLayoutHeight(totalComponentHeight);\r
- } else {\r
- activeLayoutHeight = getOffsetHeight()\r
- - activeMargins.getVertical();\r
}\r
}\r
\r
- activeLayoutSize.setWidth(activeLayoutWidth);\r
- activeLayoutSize.setHeight(activeLayoutHeight);\r
+ if (isDynamicWidth()) {\r
+ setOuterLayoutWidth(activeLayoutWidth);\r
+ activeLayoutSize.setWidth(activeLayoutWidth);\r
+ }\r
+\r
+ if (isDynamicHeight()) {\r
+ activeLayoutSize.setHeight(activeLayoutHeight);\r
+ setOuterLayoutHeight(activeLayoutHeight);\r
+ }\r
\r
return activeLayoutSize;\r
}\r
public void setHeight(String height) {\r
super.setHeight(height);\r
\r
+ activeLayoutSize.setHeight(getOffsetHeight()\r
+ - activeMargins.getVertical());\r
+\r
if (!isRendering) {\r
if (recalculateLayoutAndComponentSizes()) {\r
/* Must inform child components about possible size updates */\r
@Override\r
public void setWidth(String width) {\r
super.setWidth(width);\r
+ this.width = width;\r
+\r
+ activeLayoutSize.setWidth(getOffsetWidth()\r
+ - activeMargins.getHorizontal());\r
\r
if (!isRendering) {\r
if (recalculateLayoutAndComponentSizes()) {\r