diff options
author | Juuso Valli <juuso@vaadin.com> | 2014-04-29 11:02:17 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2014-05-09 06:41:44 +0000 |
commit | 2ecdf7e517dffb17e90432b9d7bd7d42ad826c63 (patch) | |
tree | a0cc784b96a4fbb7aeabc55ecd4b89ca28542e33 /client | |
parent | 9b3df561fe930f1d4903eeec525c663dc8288a33 (diff) | |
download | vaadin-framework-2ecdf7e517dffb17e90432b9d7bd7d42ad826c63.tar.gz vaadin-framework-2ecdf7e517dffb17e90432b9d7bd7d42ad826c63.zip |
Fix table focusing when scrolled from the server (#10522)
Change-Id: Ib18a60ae7e41af8c6c119e5b2e12e4fd5bf1069c
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VScrollTable.java | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 180d0d771b..4a7fc1de0a 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -1081,19 +1081,18 @@ public class VScrollTable extends FlowPanel implements HasWidgets, selected = true; keyboardSelectionOverRowFetchInProgress = true; } + if (selected) { + if (focusedRow == null + || !selectedRowKeys.contains(focusedRow + .getKey())) { + // The focus is no longer on a selected row, + // move focus to first selected row + setRowFocus(row); + } + } if (selected != row.isSelected()) { row.toggleSelection(); - if (selected) { - if (focusedRow == null - || !selectedRowKeys.contains(focusedRow - .getKey())) { - // The focus is no longer on a selected row, - // move focus to first selected row - setRowFocus(row); - } - } - if (!isSingleSelectMode() && !selected) { // Update selection range in case a row is // unselected from the middle of a range - #8076 @@ -1101,6 +1100,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } } } + } } unSyncedselectionsBeforeRowFetch = null; @@ -5301,17 +5301,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ public boolean isInViewPort() { int absoluteTop = getAbsoluteTop(); - int scrollPosition = scrollBodyPanel.getAbsoluteTop() - + scrollBodyPanel.getScrollPosition(); - if (absoluteTop < scrollPosition) { - return false; - } - int maxVisible = scrollPosition - + scrollBodyPanel.getOffsetHeight() - getOffsetHeight(); - if (absoluteTop > maxVisible) { - return false; - } - return true; + int absoluteBottom = absoluteTop + getOffsetHeight(); + int viewPortTop = scrollBodyPanel.getAbsoluteTop(); + int viewPortBottom = viewPortTop + + scrollBodyPanel.getOffsetHeight(); + return absoluteBottom > viewPortTop + && absoluteTop < viewPortBottom; } /** |