Change-Id: Ia8c1b98e4e2c021b570e74f3527f58f15a469a17tags/7.4.0.beta1
@@ -48,6 +48,7 @@ import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.UIObject; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.client.DeferredWorker; | |||
import com.vaadin.client.Profiler; | |||
import com.vaadin.client.Util; | |||
import com.vaadin.client.ui.grid.Escalator.JsniUtil.TouchHandlerBundle; | |||
@@ -248,7 +249,7 @@ abstract class JsniWorkaround { | |||
* @since | |||
* @author Vaadin Ltd | |||
*/ | |||
public class Escalator extends Widget { | |||
public class Escalator extends Widget implements DeferredWorker { | |||
// todo comments legend | |||
/* | |||
@@ -2099,6 +2100,8 @@ public class Escalator extends Widget { | |||
if (!domWasSorted) { | |||
animationHandle = AnimationScheduler.get() | |||
.requestAnimationFrame(this); | |||
} else { | |||
waiting = false; | |||
} | |||
} | |||
}; | |||
@@ -2107,7 +2110,11 @@ public class Escalator extends Widget { | |||
private double startTime; | |||
private AnimationHandle animationHandle; | |||
/** <code>true</code> if a sort is scheduled */ | |||
public boolean waiting = false; | |||
public void reschedule() { | |||
waiting = true; | |||
resetConditions(); | |||
animationHandle = AnimationScheduler.get() | |||
.requestAnimationFrame(frameCounter); | |||
@@ -4693,4 +4700,9 @@ public class Escalator extends Widget { | |||
public HandlerRegistration addScrollHandler(ScrollHandler handler) { | |||
return addHandler(handler, ScrollEvent.TYPE); | |||
} | |||
@Override | |||
public boolean isWorkPending() { | |||
return body.domSorter.waiting; | |||
} | |||
} |
@@ -44,6 +44,7 @@ import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.HasVisibility; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.client.DeferredWorker; | |||
import com.vaadin.client.Util; | |||
import com.vaadin.client.data.DataChangeHandler; | |||
import com.vaadin.client.data.DataSource; | |||
@@ -121,7 +122,7 @@ import com.vaadin.shared.ui.grid.SortEventOriginator; | |||
* @author Vaadin Ltd | |||
*/ | |||
public class Grid<T> extends Composite implements | |||
HasSelectionChangeHandlers<T>, SubPartAware { | |||
HasSelectionChangeHandlers<T>, SubPartAware, DeferredWorker { | |||
public static abstract class AbstractGridKeyEvent<HANDLER extends AbstractGridKeyEventHandler> | |||
extends KeyCodeEvent<HANDLER> { | |||
@@ -764,6 +765,8 @@ public class Grid<T> extends Composite implements | |||
private final EditorRow<T> editorRow = GWT.create(EditorRow.class); | |||
private boolean dataIsBeingFetched = false; | |||
/** | |||
* Enumeration for easy setting of selection mode. | |||
*/ | |||
@@ -1345,6 +1348,7 @@ public class Grid<T> extends Composite implements | |||
public void onRowVisibilityChange( | |||
RowVisibilityChangeEvent event) { | |||
if (dataSource != null) { | |||
dataIsBeingFetched = true; | |||
dataSource.ensureAvailability( | |||
event.getFirstVisibleRow(), | |||
event.getVisibleRowCount()); | |||
@@ -1378,6 +1382,13 @@ public class Grid<T> extends Composite implements | |||
sorter.sort(event.getActiveCell(), event.isShiftKeyDown()); | |||
} | |||
}); | |||
addDataAvailableHandler(new DataAvailableHandler() { | |||
@Override | |||
public void onDataAvailable(DataAvailableEvent event) { | |||
dataIsBeingFetched = false; | |||
} | |||
}); | |||
} | |||
@Override | |||
@@ -2874,4 +2885,9 @@ public class Grid<T> extends Composite implements | |||
public HandlerRegistration addScrollHandler(ScrollHandler handler) { | |||
return addHandler(handler, ScrollEvent.TYPE); | |||
} | |||
@Override | |||
public boolean isWorkPending() { | |||
return escalator.isWorkPending() || dataIsBeingFetched; | |||
} | |||
} |
@@ -118,6 +118,8 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
@Test | |||
public void rowsWithDataHasStyleName() throws Exception { | |||
testBench().disableWaitForVaadin(); | |||
// Simulate network latency with 2000ms | |||
latency = 2000; | |||
@@ -143,6 +145,8 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
@Test | |||
public void complexRendererSetVisibleContent() throws Exception { | |||
testBench().disableWaitForVaadin(); | |||
DesiredCapabilities desiredCapabilities = getDesiredCapabilities(); | |||
// Simulate network latency with 2000ms | |||
@@ -163,6 +167,12 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
openTestURL(); | |||
/* | |||
* because there's no wait for vaadin, we need to wait for a little | |||
* while. | |||
*/ | |||
sleep(200); | |||
// Test initial renderering with contentVisible = False | |||
TestBenchElement cell = getGrid().getCell(51, 1); | |||
String backgroundColor = cell.getCssValue("backgroundColor"); |