欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

pagebean Safari 

程序员文章站 2022-07-09 10:25:41
...
import java.util.List;

public class PageBean {
    private List list;
    private int allRow;
    private int currentPage;
    private int totalPage;
    private int pageSize;

    public List getList() {
        return list;
    }
    public void setList(List list) {
        this.list = list;
    }
    public int getAllRow() {
        return allRow;
    }
    public void setAllRow(int allRow) {
        this.allRow = allRow;
    }
    public int getCurrentPage() {
        return currentPage;
    }
    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }
    public int getTotalPage() {
        return totalPage;
    }
    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public static int countTotalPage(int pageSize, int allRow) {
        int totalPage = allRow % pageSize == 0 ? allRow / pageSize : allRow
                / pageSize + 1;
        return totalPage;
    }

    public static int countOffset(int pageSize, int currentPage) {
        final int offset = pageSize * (currentPage - 1);
        return offset;
    }

    public static int countCurrentPage(int page) {
        int curPage = (page == 0 ? 1 : page);
        return curPage;
    }

}
相关标签: Safari

上一篇: Lucene-高亮显示

下一篇: Lucene字段