summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2008-12-30 14:44:59 +0000
committerArtur Signell <artur.signell@itmill.com>2008-12-30 14:44:59 +0000
commitaa69e979147c95481f79a5570005f619bfcb3b59 (patch)
tree2dfd073fabe6e1901c102bd1f7db4523c6fe4d93
parent01c44a6fa013793b5a4c4c2ddc80f5bb601ae954 (diff)
downloadvaadin-framework-aa69e979147c95481f79a5570005f619bfcb3b59.tar.gz
vaadin-framework-aa69e979147c95481f79a5570005f619bfcb3b59.zip
Test case and fix for #2411 - OrderedLayout extra pixel distribution
svn changeset:6369/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java14
-rw-r--r--src/com/itmill/toolkit/tests/tickets/Ticket2411.java28
2 files changed, 37 insertions, 5 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java
index a628c3f8b1..a9282e3bc9 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java
@@ -241,10 +241,13 @@ public class IOrderedLayout extends CellBasedLayout {
if (remaining > 0) {
// Some left-over pixels due to rounding errors
- // Add extra pixels to first container
- ChildComponentContainer firstChildContainer = getFirstChildComponentContainer();
- if (firstChildContainer != null) {
- firstChildContainer.expandExtra(orientation, remaining);
+ // Add one pixel to each container until there are no pixels left
+
+ Iterator<Widget> widgetIterator = iterator();
+ while (widgetIterator.hasNext() && remaining-- > 0) {
+ ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
+ .next();
+ childComponentContainer.expandExtra(orientation, 1);
}
}
@@ -783,7 +786,8 @@ public class IOrderedLayout extends CellBasedLayout {
* If the height changes as a consequence of this we must inform the
* parent also
*/
- if (isDynamicHeight() && sizeBefore.getHeight() != activeLayoutSize.getHeight()) {
+ if (isDynamicHeight()
+ && sizeBefore.getHeight() != activeLayoutSize.getHeight()) {
Util.notifyParentOfSizeChange(this, false);
}
diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket2411.java b/src/com/itmill/toolkit/tests/tickets/Ticket2411.java
new file mode 100644
index 0000000000..edf4ee0798
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/tickets/Ticket2411.java
@@ -0,0 +1,28 @@
+package com.itmill.toolkit.tests.tickets;
+
+import com.itmill.toolkit.Application;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.GridLayout;
+import com.itmill.toolkit.ui.Window;
+
+public class Ticket2411 extends Application {
+
+ @Override
+ public void init() {
+ Window w = new Window(getClass().getSimpleName());
+ setMainWindow(w);
+
+// VerticalLayout l = new VerticalLayout();
+ GridLayout l = new GridLayout();
+ w.setLayout(l);
+
+ l.setHeight("504px");
+
+ for (int i=1; i <= 5; i++) {
+ Button b = new Button("Button "+i+" should be 100px or 101px high");
+ b.setHeight("100%");
+ l.addComponent(b);
+ }
+ }
+
+}