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

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

Introduction

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

Prototype

public int getFirstLinkedPage() 

Source Link

Document

Return the first 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.
 *///from ww w.j  ava2  s.  c  om
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);
}