diff options
author | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-03-28 10:24:19 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-03-28 10:24:19 +0000 |
commit | 8bf852a4fa84169eae44d96da083224d0d72b6c1 (patch) | |
tree | 878633b48b64c0d44ac98c0a6af3b4dbad8d89d2 /client | |
parent | 505e20331ae714bab98dbdd3a004f5ac83b58c50 (diff) | |
parent | 62c4c3f9738627ada3f76a7c197749681e29da0e (diff) | |
download | vaadin-framework-8bf852a4fa84169eae44d96da083224d0d72b6c1.tar.gz vaadin-framework-8bf852a4fa84169eae44d96da083224d0d72b6c1.zip |
Merge "Merge commit '60aa66a'"
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VTabsheet.java | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index b9a70ff66a..4da5e4bfe0 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -283,6 +283,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, } public void focus() { + getTabsheet().scrollIntoView(this); focusImpl.focus(td); } @@ -1296,14 +1297,6 @@ public class VTabsheet extends VTabsheetBase implements Focusable, focusedTab = tb.getTab(focusedTabIndex); focusedTab.focus(); } - - if (isScrolledTabs()) { - // Scroll until the new focused tab is visible - while (!tb.getTab(focusedTabIndex).isVisible()) { - scrollerIndex = tb.scrollLeft(scrollerIndex); - } - updateTabScroller(); - } } } @@ -1325,15 +1318,20 @@ public class VTabsheet extends VTabsheetBase implements Focusable, focusedTab = tb.getTab(focusedTabIndex); focusedTab.focus(); } + } + } - if (isClippedTabs()) { - // Scroll until the new active tab is completely visible - int newScrollerIndex = scrollerIndex; - while (isClipped(tb.getTab(focusedTabIndex)) - && newScrollerIndex != -1) { - newScrollerIndex = tb.scrollRight(newScrollerIndex); + private void scrollIntoView(Tab tab) { + if (!tab.isHiddenOnServer()) { + if (isClipped(tab)) { + while (isClipped(tab) && scrollerIndex != -1) { + scrollerIndex = tb.scrollRight(scrollerIndex); + } + updateTabScroller(); + } else if (!tab.isVisible()) { + while (!tab.isVisible()) { + scrollerIndex = tb.scrollLeft(scrollerIndex); } - scrollerIndex = newScrollerIndex; updateTabScroller(); } } |