diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-09-29 09:43:45 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-09-29 09:43:45 +0000 |
commit | 68e20d0c8d61d1e77729a07d9bde0aba3dd7de0a (patch) | |
tree | 564c38e1ac8ee4ac7123a16219b61e3f0fe76e22 /src/com | |
parent | e7ed0bddbb75c1c8ffb6684915de721f7ab3f889 (diff) | |
download | vaadin-framework-68e20d0c8d61d1e77729a07d9bde0aba3dd7de0a.tar.gz vaadin-framework-68e20d0c8d61d1e77729a07d9bde0aba3dd7de0a.zip |
#6698 Scrolling with the mouse is aborted when data is received from the server
svn changeset:21434/svn branch:6.6
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index e2d776649b..04a59889af 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -419,6 +419,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, private int tabIndex; private TouchScrollDelegate touchScrollDelegate; + private int lastRenderedHeight; + public VScrollTable() { scrollBodyPanel.setStyleName(CLASSNAME + "-body-wrapper"); scrollBodyPanel.addFocusHandler(this); @@ -820,7 +822,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, paintableId = uidl.getStringAttribute("id"); immediate = uidl.getBooleanAttribute("immediate"); final int newTotalRows = uidl.getIntAttribute("totalrows"); - if (newTotalRows != totalRows) { + boolean totalRowsChanged = newTotalRows != totalRows; + if (totalRowsChanged) { if (scrollBody != null) { if (totalRows == 0) { tHead.clear(); @@ -996,10 +999,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, uidl.getIntAttribute("rows")); if (headerChangedDuringUpdate) { lazyAdjustColumnWidths.schedule(1); - } else { + } else if (!isScrollPositionVisible() || totalRowsChanged + || lastRenderedHeight != scrollBody.getOffsetHeight()) { // webkits may still bug with their disturbing scrollbar bug, // See #3457 // run overflow fix for scrollable area + // #6698 - If there's a scroll going on, don't abort it by + // changing overflows as the length of the contents *shouldn't* + // have changed (unless the number of rows or the height of the + // widget has also changed) Scheduler.get().scheduleDeferred(new Command() { public void execute() { Util.runWebkitOverflowAutoFix(scrollBodyPanel @@ -1083,6 +1091,10 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, tHead.resizeCaptionContainer(oldSortedHeader); } + // Remember this to detect situations where overflow hack might be + // needed during scrolling + lastRenderedHeight = scrollBody.getOffsetHeight(); + rendering = false; headerChangedDuringUpdate = false; @@ -1844,6 +1856,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } } + private boolean isScrollPositionVisible() { + return scrollPositionElement != null + && !scrollPositionElement.getStyle().getDisplay() + .equals(Display.NONE.toString()); + } + private class RowRequestHandler extends Timer { private int reqFirstRow = 0; |