/**
* @version 1.0
* @author: fwjia
*/
import java.util.List;
public class PageModel {
/***
* 当前页
*/
private int page = 1;
/***
* 总页数
*/
public int totalPages = 0;
/***
* 每页数据条数
*/
private int pageRecorders;
/***
* 总页数
*/
private int totalRows = 0;
/***
* 每页的起始数
*/
private int pageStartRow = 0;
/***
* 每页显示数据的终止数
*/
private int pageEndRow = 0;
/***
* 是否有下一页
*/
private boolean hasNextPage = false;
/***
* 是否有前一页
*/
private boolean hasPreviousPage = false;
/***
* 数据集合
*/
private List list;
public PageModel(List list, int pageRecorders) {
// 通过对象集,记录总数划分
init(list, pageRecorders);
}
/** *//**
* 初始化list,并告之该list每页的记录数
* @param list 数据几个
* @param pageRecorders 一页显示多少数据
*/
public void init(List list, int pageRecorders) {
this.pageRecorders = pageRecorders;
this.list = list;
totalRows = list.size();
hasPreviousPage = false;
if ((totalRows % pageRecorders) == 0) {
totalPages = totalRows / pageRecorders;