public void displayPage ( final int page , boolean forceRefresh ) { if ( _page == page && ! forceRefresh ) { return ; // NOOP! } // Display the now loading widget, if necessary. configureLoadingNavi ( _controls , 0 , _infoCol ) ; _page = Math . max ( page , 0 ) ; final boolean overQuery = ( _model . getItemCount ( ) < 0 ) ; final int count = _resultsPerPage ; final int start = _resultsPerPage * page ; _model . doFetchRows ( start , overQuery ? ( count + 1 ) : count , new AsyncCallback < List < T > > ( ) { public void onSuccess ( List < T > result ) { if ( overQuery ) { // if we requested 1 item too many, see if we got it if ( result . size ( ) < ( count + 1 ) ) { // no: this is the last batch of items, woohoo _lastItem = start + result . size ( ) ; } else { // yes: strip it before anybody else gets to see it result . remove ( count ) ; _lastItem = - 1 ; } } else { // a valid item count should be available at this point _lastItem = _model . getItemCount ( ) ; } displayResults ( start , count , result ) ; } public void onFailure ( Throwable caught ) { reportFailure ( caught ) ; } } ) ; }
Displays the specified page . Does nothing if we are already displaying that page unless forceRefresh is true .