diff options
-rw-r--r-- | client/src/com/vaadin/client/ui/grid/Grid.java | 28 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthServerTest.java | 11 |
2 files changed, 25 insertions, 14 deletions
diff --git a/client/src/com/vaadin/client/ui/grid/Grid.java b/client/src/com/vaadin/client/ui/grid/Grid.java index b9b9c3a623..ef804fbe1d 100644 --- a/client/src/com/vaadin/client/ui/grid/Grid.java +++ b/client/src/com/vaadin/client/ui/grid/Grid.java @@ -2009,6 +2009,7 @@ public class Grid<T> extends ResizeComposite implements private class AutoColumnWidthsRecalculator { private final ScheduledCommand calculateCommand = new ScheduledCommand() { + @Override public void execute() { if (!isScheduled) { @@ -2016,14 +2017,34 @@ public class Grid<T> extends ResizeComposite implements return; } - if (!dataIsBeingFetched) { - calculate(); - } else { + if (header.markAsDirty || footer.markAsDirty) { + if (rescheduleCount < 10) { + /* + * Headers and footers are rendered as finally, this way + * we re-schedule this loop as finally, at the end of + * the queue, so that the headers have a chance to + * render themselves. + */ + Scheduler.get().scheduleFinally(this); + rescheduleCount++; + } else { + /* + * We've tried too many times reschedule finally. Seems + * like something is being deferred. Let the queue + * execute and retry again. + */ + rescheduleCount = 0; + Scheduler.get().scheduleDeferred(this); + } + } else if (dataIsBeingFetched) { Scheduler.get().scheduleDeferred(this); + } else { + calculate(); } } }; + private int rescheduleCount = 0; private boolean isScheduled; /** @@ -2049,6 +2070,7 @@ public class Grid<T> extends ResizeComposite implements private void calculate() { isScheduled = false; + rescheduleCount = 0; assert !dataIsBeingFetched : "Trying to calculate column widths even though data is still being fetched."; /* diff --git a/uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthServerTest.java b/uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthServerTest.java index a6ff31fae3..2f42b89eb1 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthServerTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthServerTest.java @@ -15,9 +15,6 @@ */ package com.vaadin.tests.components.grid; -import org.junit.Ignore; -import org.junit.Test; - import com.vaadin.tests.annotations.TestCategory; @TestCategory("grid") @@ -27,12 +24,4 @@ public class GridColumnAutoWidthServerTest extends protected Class<?> getUIClass() { return GridColumnAutoWidth.class; } - - @Override - @Test - @Ignore - public void testWideHeaderNarrowBody() { - // TODO this test is temporarily broken, it will be fixed Very Soon TM. - super.testWideHeaderNarrowBody(); - } }
\ No newline at end of file |