@ Override public void createPagingControls ( final AbstractOrderedLayout content , final String name , final String pageId , final Long size , final int pageNr , final int resultPerPage ) { final HorizontalLayout pagingControls = new HorizontalLayout ( ) ; pagingControls . setSpacing ( true ) ; pagingControls . setMargin ( true ) ; final long maxPages = ( size + resultPerPage - 1 ) / resultPerPage ; final StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( PAGE_HEADER ) . append ( pageNr ) . append ( PAGE_SEPARATOR ) . append ( maxPages ) . append ( PAGES_TOTAL_RESULTS ) . append ( size ) . append ( RESULTS_PER_PAGE ) . append ( resultPerPage ) . append ( SHOW ) ; final Label pageInfo = new Label ( stringBuilder . toString ( ) ) ; pagingControls . addComponent ( pageInfo ) ; pagingControls . setExpandRatio ( pageInfo , ContentRatio . SMALL ) ; if ( pageNr > PAGE_ONE ) { addPagingLink ( PREVIOUS_PAGE , name , pageId , pageNr - 1L , pagingControls ) ; } if ( maxPages > PAGE_ONE && pageNr < maxPages ) { addPagingLink ( NEXT_PAGE , name , pageId , pageNr + 1L , pagingControls ) ; } if ( maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr > PAGE_ONE ) { addPagingLink ( FIRST_PAGE , name , pageId , 1 , pagingControls ) ; } if ( maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr < maxPages ) { addPagingLink ( LAST_PAGE , name , pageId , maxPages , pagingControls ) ; } content . addComponent ( pagingControls ) ; content . setExpandRatio ( pagingControls , ContentRatio . SMALL2 ) ; }
Creates the paging controls .