// apply the style to the new tab.
final Widget tabBarItemPanel = tabBarPanel.getWidget(index + 1);
tabBarItemPanel.addStyleName(selectedStyle);
// tell the deckPanel to select a new sub-widget.
contentPanel.showWidget(index);
final TabSelectEvent selectedEvent = new TabSelectEvent();
selectedEvent.setPreviouslySelected(previouslySelectedTabItem);
selectedEvent.setCurrentSelection(newlySelectedItem);