Example usage for org.springframework.beans.support PagedListHolder getLastLinkedPage

List of usage examples for org.springframework.beans.support PagedListHolder getLastLinkedPage

Introduction

In this page you can find the example usage for org.springframework.beans.support PagedListHolder getLastLinkedPage.

Prototype

public int getLastLinkedPage() 

Source Link

Document

Return the last page to which create a link around the current page.

Usage

From source file:de.iteratec.iteraplan.presentation.dialog.GuiSearchController.java

/**
 * Calculates the new page to show in the PagedListHolder, after a navigation action (like goto next, first, previous, last, sorting...) has been performed.
 *///  w  w  w.  j a v  a 2s .c  o m
private void choosePageToShow(T searchDialogMemory, PagedListHolder<?> results) {

    int pageNumber = searchDialogMemory.getCurrentPageNumber();

    if (!StringUtils.isEmpty(searchDialogMemory.getNextPage())
            && "next".equals(searchDialogMemory.getNextPage())) {
        results.setPage(pageNumber);
        results.nextPage();
        searchDialogMemory.setNextPage("");
    } else if (!StringUtils.isEmpty(searchDialogMemory.getPreviousPage())
            && "previous".equals(searchDialogMemory.getPreviousPage())) {
        results.setPage(pageNumber);
        results.previousPage();
        searchDialogMemory.setPreviousPage("");
    } else if (!StringUtils.isEmpty(searchDialogMemory.getNextPage())
            && "last".equals(searchDialogMemory.getNextPage())) {
        results.setPage(results.getLastLinkedPage());
    } else if (!StringUtils.isEmpty(searchDialogMemory.getPreviousPage())
            && "first".equals(searchDialogMemory.getPreviousPage())) {
        results.setPage(results.getFirstLinkedPage());
    }

    searchDialogMemory.setCurrentPageNumber(results.getPage());
    searchDialogMemory.setNextPageToShow(Boolean.FALSE);
}