⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pagination.java

📁 羽量级数据持久层开发框架
💻 JAVA
字号:
package org.speedframework.entity;

/**
 * <p>
 * Title: SpeedFrameworkWork
 * </p>
 * <p/>
 * <p>
 * Description: 分页工具类
 * </p>
 * <p/>
 * <p>
 * Copyright: Copyright (c) 2005
 * </p>
 * <p/>
 * <p>
 * Company: SpeedFrameworkWork
 * </p>
 * 
 * @author lizf 13824431576
 * @version 1.1beta
 */
public class Pagination {

	/**
	 * 每页记录的大小
	 */
	private int count = 10;

	/**
	 * 当前页号
	 */
	private int page = 0;

	/**
	 * 总记录数
	 */
	private int totalCount = 0;

	/**
	 * 总页数
	 */
	private int totalPage = 0;

	/**
	 * 是否有上一页
	 */
	private boolean hasPreviousPage = false;

	/**
	 * 是否有下一页
	 */
	private boolean hasNextPage = false;

	/**
	 * @return Returns the count.
	 */
	public int getCount() {
		return count;
	}

	/**
	 * @param count
	 *            The count to set.
	 */
	public void setCount(int count) {
		this.count = count;
	}

	/**
	 * @return Returns the currPage.
	 */
	public int getCurrPage() {
		return page;
	}

	/**
	 * @return Returns the totalPage.
	 */
	public int getTotalPage() {
		totalPage = totalCount / count;

		if (((totalCount % count) > 0) || (totalPage == 0)) {
			totalPage += 1;
		}

		return totalPage;
	}

	/**
	 * @return Returns the page.
	 */
	public int getPage() {
		return this.page;
	}

	/**
	 * @param page
	 *            The page to set.
	 */
	public void setPage(int page) {
		this.page = page;
	}

	/**
	 * @return Returns the totalCount.
	 */
	public int getTotalCount() {
		return totalCount;
	}

	/**
	 * @param totalCount
	 *            The totalCount to set.
	 */
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	/**
	 * @return Returns the hasNextPage.
	 */
	public boolean isHasNextPage() {
		if (getCurrPage() >= getTotalPage()) {
			hasNextPage = false;
		} else {
			hasNextPage = true;
		}

		return hasNextPage;
	}

	/**
	 * @return Returns the hasPreviousPage.
	 */
	public boolean isHasPreviousPage() {
		if ((getCurrPage() - 1) > 0) {
			hasPreviousPage = true;
		} else {
			hasPreviousPage = false;
		}

		return hasPreviousPage;
	}

	/**
	 * 
	 * @return Returns the nextPage.
	 */
	public int getNextPage() {
		return page + 1;
	}

	/**
	 * @return Returns the previousPage.
	 */
	public int getPreviousPage() {
		return page - 1;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -