if (remaining > 0) {\r
// Some left-over pixels due to rounding errors\r
\r
- // Add extra pixels to first container\r
- ChildComponentContainer firstChildContainer = getFirstChildComponentContainer();\r
- if (firstChildContainer != null) {\r
- firstChildContainer.expandExtra(orientation, remaining);\r
+ // Add one pixel to each container until there are no pixels left\r
+\r
+ Iterator<Widget> widgetIterator = iterator();\r
+ while (widgetIterator.hasNext() && remaining-- > 0) {\r
+ ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator\r
+ .next();\r
+ childComponentContainer.expandExtra(orientation, 1);\r
}\r
}\r
\r
* If the height changes as a consequence of this we must inform the\r
* parent also\r
*/\r
- if (isDynamicHeight() && sizeBefore.getHeight() != activeLayoutSize.getHeight()) {\r
+ if (isDynamicHeight()\r
+ && sizeBefore.getHeight() != activeLayoutSize.getHeight()) {\r
Util.notifyParentOfSizeChange(this, false);\r
}\r
\r
--- /dev/null
+package com.itmill.toolkit.tests.tickets;\r
+\r
+import com.itmill.toolkit.Application;\r
+import com.itmill.toolkit.ui.Button;\r
+import com.itmill.toolkit.ui.GridLayout;\r
+import com.itmill.toolkit.ui.Window;\r
+\r
+public class Ticket2411 extends Application {\r
+\r
+ @Override\r
+ public void init() {\r
+ Window w = new Window(getClass().getSimpleName());\r
+ setMainWindow(w);\r
+ \r
+// VerticalLayout l = new VerticalLayout();\r
+ GridLayout l = new GridLayout();\r
+ w.setLayout(l);\r
+ \r
+ l.setHeight("504px");\r
+ \r
+ for (int i=1; i <= 5; i++) {\r
+ Button b = new Button("Button "+i+" should be 100px or 101px high");\r
+ b.setHeight("100%");\r
+ l.addComponent(b);\r
+ }\r
+ }\r
+\r
+}\r