@ Override public void selectTab ( final String text ) { for ( int i = 0 ; i < tabs . size ( ) ; i ++ ) { if ( text . equals ( tabs . get ( i ) . getText ( ) ) ) { selectTab ( i ) ; return ; } } // not found in visible tabs, should be in off-page for ( OffPageText opt : offPageContainer . getTexts ( ) ) { if ( text . equals ( opt . getText ( ) ) ) { if ( opt . getIndex ( ) == 0 ) { // the first off-page needs special treatment offPageContainer . selectDeck ( opt . getIndex ( ) ) ; if ( getSelectedIndex ( ) == PAGE_LIMIT - 1 ) { SelectionEvent . fire ( this , PAGE_LIMIT - 1 ) ; } tabs . lastTab ( ) . setText ( opt . getText ( ) ) ; selectTab ( PAGE_LIMIT - 1 ) ; } else { selectTab ( PAGE_LIMIT - 1 + opt . getIndex ( ) ) ; } } } }
Selects the tab with the specified text . If there s no tab with the specified text the selected tab remains unchanged . If there s more than one tab with the specified text the first one will be selected .