// find the previously selected tab. and unselect it.
final int previousIndex = contentPanel.getVisibleWidget();
TabItem previouslySelectedTabItem = null;
if (-1 != previousIndex) {
final Widget tab = tabBarPanel.getWidget(previousIndex + 1);
tab.removeStyleName(selectedStyle);
previouslySelectedTabItem = this.get(previousIndex);
}
// apply the style to the new tab.
final Widget tabBarItemPanel = tabBarPanel.getWidget(index + 1);