code: @Override
  	protected void onBeforeRender()
  	{
  		int index = getSelectedTab();
  
  		if ((index == -1) || (getVisiblityCache().isVisible(index) == false))
  		{
  			// find first visible tab
  			index = -1;
  			for (int i = 0; i < tabs.size(); i++)
  			{
  				if (getVisiblityCache().isVisible(i))
  				{
  					index = i;
  					break;
  				}
  			}
  
  			if (index != -1)
  			{
  				// found a visible tab, so select it
  				setSelectedTab(index);
  			}
  		}
  
  		setCurrentTab(index);
  
  		super.onBeforeRender();
  	}
docs: {@inheritDoc}