81,122
社区成员




/*
* Copyright (C) 2014 China Telecom System Integration Co., Ltd.
* All rights reserved.
*/
package cn.com.ctsi.commons.dao;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The type Page view.
*
* @param <T> the type parameter
*/
public class PageView<T> implements Serializable {
private static final long serialVersionUID = 8191429276493862832L;
/**
* The constant DEFAULT_RECPERPAGE.
*/
public static final Integer DEFAULT_RECPERPAGE = 15;
/**
* The constant DEFAULT_TABLE_HEIGHT.
*/
public static final Integer DEFAULT_TABLE_HEIGHT = 240;
/**
* The Curr page.
*/
protected Integer currPage = 1; // 当前页
/**
* The Rec num.
*/
protected Integer recNum; // 总记录数
/**
* The Rec num per page.
*/
protected Integer recNumPerPage = DEFAULT_RECPERPAGE; // 每页记录数
/**
* The Page num.
*/
protected Integer pageNum = 1; // 总页数
/**
* The Tbl height.
*/
protected Integer tblHeight; //
/**
* The Tbl hide cols.
*/
protected String tblHideCols; //
/**
* The Tbl cols no.
*/
protected String tblColsNo; //
/**
* The Tbl cols width.
*/
protected String tblColsWidth; //
/**
* The Result.
*/
protected List<T> result = new ArrayList<T>();
/**
* Instantiates a new Page view.
*/
public PageView() {
currPage = 1;
recNumPerPage = DEFAULT_RECPERPAGE;
recNum = 0;
}
/**
* Instantiates a new Page view.
*
* @param currPage the curr page
* @param recNum the rec num
* @param recNumPerPage the rec num per page
*/
public PageView(int currPage, int recNum, int recNumPerPage) {
this.currPage = currPage;
this.recNum = recNum;
this.recNumPerPage = recNumPerPage;
}
/**
* Gets curr page.
*
* @return the curr page
*/
public int getCurrPage() {
return currPage;
}
/**
* Sets curr page.
*
* @param currPage the curr page
*/
public void setCurrPage(int currPage) {
this.currPage = currPage;
}
/**
* Gets page num.
*
* @return the page num
*/
public int getPageNum() {
if (recNumPerPage > 0) {
int num = recNum / recNumPerPage;
if (num * recNumPerPage < recNum) {
num++;
}
return num;
}
return 1;
}
/**
* Gets rec num.
*
* @return the rec num
*/
public int getRecNum() {
return recNum;
}
/**
* Sets rec num.
*
* @param recNum the rec num
*/
public void setRecNum(int recNum) {
this.recNum = recNum;
}
/**
* Gets rec num per page.
*
* @return the rec num per page
*/
public int getRecNumPerPage() {
return recNumPerPage;
}
/**
* Sets rec num per page.
*
* @param recNumPerPage the rec num per page
*/
public void setRecNumPerPage(int recNumPerPage) {
this.recNumPerPage = recNumPerPage;
}
/**
* Gets result.
*
* @return the result
*/
public List<T> getResult() {
return result;
}
/**
* Sets result.
*
* @param result the result
*/
public void setResult(List<T> result) {
this.result = result;
}
/**
* Gets tbl height.
*
* @return the tbl height
*/
public Integer getTblHeight() {
return tblHeight;
}
/**
* Sets tbl height.
*
* @param tblHeight the tbl height
*/
public void setTblHeight(Integer tblHeight) {
this.tblHeight = tblHeight;
}
/**
* Gets tbl hide cols.
*
* @return the tbl hide cols
*/
public String getTblHideCols() {
return tblHideCols;
}
/**
* Sets tbl hide cols.
*
* @param tblHideCols the tbl hide cols
*/
public void setTblHideCols(String tblHideCols) {
this.tblHideCols = tblHideCols;
}
/**
* Gets tbl cols no.
*
* @return the tbl cols no
*/
public String getTblColsNo() {
return tblColsNo;
}
/**
* Sets tbl cols no.
*
* @param tblColsNo the tbl cols no
*/
public void setTblColsNo(String tblColsNo) {
this.tblColsNo = tblColsNo;
}
/**
* Gets tbl cols width.
*
* @return the tbl cols width
*/
public String getTblColsWidth() {
return tblColsWidth;
}
/**
* Sets tbl cols width.
*
* @param tblColsWidth the tbl cols width
*/
public void setTblColsWidth(String tblColsWidth) {
this.tblColsWidth = tblColsWidth;
}
}