(1)分页控制类 /* @author nick * Created on 2004-3-18 * file name:PageController.java * * */ package com.tower.util;
/** * @author nick * 2004-3-18 * 用来进行翻页控制 * */ public class PageController { int totalRowsAmount; //总行数 boolean rowsAmountSet; //是否设置过totalRowsAmount int pageSize=2; //每页行数 int currentPage=1; //当前页码 int nextPage; int previousPage; int totalPages; //总页数 boolean hasNext; //是否有下一页 boolean hasPrevious; //是否有前一页 String description; int pageStartRow; int pageEndRow;
public PageController(int totalRows){ setTotalRowsAmount(totalRows); } public PageController(){}
/** * @param i * 设定总行数 */ public void setTotalRowsAmount(int i) { if(!this.rowsAmountSet){ totalRowsAmount = i; totalPages=totalRowsAmount/pageSize+1; setCurrentPage(1); this.rowsAmountSet=true; }