📄 pagination.java
字号:
package com.yang.pagination;
public class Pagination {
private int totalRows = 0;
private int totalPages = 0;
private int pageSize = 10;
private int currentPage = 1;
private int previousPage = 0;
private int nextPage = 1;
private boolean hasPervious = false;
private boolean hasNext = false;
public Pagination() {
super();
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public boolean isHasNext() {
if (this.currentPage == this.totalPages) {
return false;
} else {
return true;
}
}
public boolean isHasPervious() {
if (this.currentPage == 1) {
return false;
} else {
return true;
}
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPages() {
int divisor = this.getTotalRows() / this.getPageSize();
int residue = this.getTotalRows() % this.getPageSize();
if (residue == 0) {
return divisor;
} else {
return divisor + 1;
}
}
public int getTotalRows() {
return totalRows;
}
public void setTotalRows(int totalRows) {
this.totalRows = totalRows;
}
public int getNextPage() {
return this.currentPage + 1;
}
public int getPreviousPage() {
return this.currentPage - 1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -