// 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();
}
}