]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merge commit '60aa66a'
authorJuho Nurminen <juho@vaadin.com>
Fri, 28 Mar 2014 09:35:02 +0000 (11:35 +0200)
committerJuho Nurminen <juho@vaadin.com>
Fri, 28 Mar 2014 09:35:02 +0000 (11:35 +0200)
Conflicts:
client/src/com/vaadin/client/ui/VTabsheet.java

Change-Id: I7bda391a0e5678f85c04bd8ff9bfa65ba1c660b9

1  2 
client/src/com/vaadin/client/ui/VTabsheet.java

index b9a70ff66a32436f11999545aeddf12b5352cc2e,172a25e3f3349642c28d520cd410d4d52d08e5f5..4da5e4bfe091db476e7d5e49227b0a689d4e98e1
@@@ -1284,26 -1157,12 +1285,18 @@@ public class VTabsheet extends VTabshee
          // Find the previous visible and enabled tab if any.
          do {
              newTabIndex--;
 -            newTab = tb.getTab(newTabIndex);
 -        } while (newTabIndex >= 0 && !newTab.isSelectable());
 +        } while (newTabIndex >= 0 && !canSelectTab(newTabIndex));
  
          if (newTabIndex >= 0) {
 -            onTabSelected(newTabIndex);
 -            activeTabIndex = newTabIndex;
 +            tb.navigateTab(focusedTabIndex, newTabIndex);
 +            focusedTabIndex = newTabIndex;
 +
 +            // If this TabSheet already has focus, set the new selected tab
 +            // as focused.
 +            if (focusedTab != null) {
 +                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();
-             }
          }
      }
  
          // Find the next visible and enabled tab if any.
          do {
              newTabIndex++;
 -            newTab = tb.getTab(newTabIndex);
 -        } while (newTabIndex < getTabCount() && !newTab.isSelectable());
 +        } while (newTabIndex < getTabCount() && !canSelectTab(newTabIndex));
  
          if (newTabIndex < getTabCount()) {
 -            onTabSelected(newTabIndex);
 -            activeTabIndex = newTabIndex;
 +
 +            tb.navigateTab(focusedTabIndex, newTabIndex);
 +            focusedTabIndex = newTabIndex;
 +
 +            // If this TabSheet already has focus, set the new selected tab
 +            // as focused.
 +            if (focusedTab != null) {
 +                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();
              }
          }