aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2014-12-12 16:46:38 +0200
committerHenrik Paul <henrik@vaadin.com>2014-12-12 15:17:26 +0000
commit84f7ff29b56316628f5f48e45d98326d3341baff (patch)
tree597e86447667769d870c9198ef9acd52aec571f8
parentfe0954a97d9f826f5beda38ba6c46d1c224d1f22 (diff)
downloadvaadin-framework-84f7ff29b56316628f5f48e45d98326d3341baff.tar.gz
vaadin-framework-84f7ff29b56316628f5f48e45d98326d3341baff.zip
Fixes a bug in Grid expand logic (#13334)
Change-Id: I0ec1ccc0bc88c9fac63abc67cf50f8b12013d984
-rw-r--r--client/src/com/vaadin/client/ui/grid/Grid.java28
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthServerTest.java11
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