首页 > 其他 > 详细

封装分页

时间:2014-03-14 18:47:18      阅读:277      评论:0      收藏:0      [点我收藏+]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.weilai.swmf.page;
 
public class Page {
       
    private int rowCount;//总行数
       
    private int pagesize = 10;//每页显示的数据记录
       
    private int curPage;//当前页
 
    public int getRowCount() {
        return rowCount;
    }
 
    public void setRowCount(int rowCount) {
        this.rowCount = rowCount;
    }
 
    public int getPagesize() {
        return pagesize;
    }
 
    public void setPagesize(int pagesize) {
        this.pagesize = pagesize;
    }
 
    public int getCurPage() {
        return curPage == 0 ? 1 : curPage;
    }
     
     
    public void setCurPage(int curPage) {
        this.curPage = curPage;
    }
 
    /**
     * 上一页
     * @return
     */
    public int getPrev() {
        return this.getCurPage()>1 ? (this.getCurPage()-1) : 1;
    }
     
    /**
     * 下一页
     * @return
     */
    public int getNext() {
        return this.getCurPage()<this.getPageCount() ? (this.getCurPage()+1) : this.getPageCount();
    }
     
    /**
     * 获取总页数
     * @return
     */
    public int getPageCount() {
        return (this.getRowCount()+this.getPagesize()-1)/this.getPagesize();
    }
     
    /**
     * 是否为最后一页
     * @return
     */
    public boolean isLast(){
        return (this.getCurPage() == this.getPageCount() ? true : false);
    }
     
    /**
     * 是否为第一页
     */
    public boolean isFirst(){
        return (this.getCurPage() == 0 ? true : false);
    }
}

  

封装分页,布布扣,bubuko.com

封装分页

原文:http://www.cnblogs.com/wasd89/p/3598805.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!