145 lines
3.8 KiB
Java
145 lines
3.8 KiB
Java
package wenrgise.common.vo;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
|
|
public class BaseDetailVO extends BaseVO implements Serializable {
|
|
private int recordsPerPage = 0;
|
|
|
|
private int maxPage = 0;
|
|
|
|
private long currentPage = 0L;
|
|
|
|
private long currentSlot = 0L;
|
|
|
|
private long totalDetailRecord = 0L;
|
|
|
|
private ArrayList oThisPageData = null;
|
|
|
|
private ArrayList oAllPageData = null;
|
|
|
|
int rowAdded = 0;
|
|
|
|
int rowDeleted = 0;
|
|
|
|
public BaseDetailVO() {
|
|
this.oThisPageData = new ArrayList();
|
|
this.oAllPageData = new ArrayList();
|
|
this.currentSlot = 0L;
|
|
}
|
|
|
|
public void reset() {
|
|
this.currentPage = 0L;
|
|
this.currentSlot = 0L;
|
|
this.oThisPageData = new ArrayList();
|
|
this.oAllPageData = new ArrayList();
|
|
}
|
|
|
|
public ArrayList getOAllPageData() {
|
|
return this.oAllPageData;
|
|
}
|
|
|
|
public void setOAllPageData(ArrayList newOAllPageData) {
|
|
this.oAllPageData = newOAllPageData;
|
|
}
|
|
|
|
public ArrayList getOThisPageData() {
|
|
return this.oThisPageData;
|
|
}
|
|
|
|
public void setOThisPageData(ArrayList newOThisPageData) {
|
|
this.oThisPageData = newOThisPageData;
|
|
}
|
|
|
|
public long getTotalDetailRecord() {
|
|
return this.totalDetailRecord;
|
|
}
|
|
|
|
public void setTotalDetailRecord(long newTotalDetailRecord) {
|
|
this.totalDetailRecord = newTotalDetailRecord;
|
|
}
|
|
|
|
public int getRowAdded() {
|
|
return this.rowAdded;
|
|
}
|
|
|
|
public void setRowAdded(int newRowAdded) {
|
|
this.rowAdded = newRowAdded;
|
|
}
|
|
|
|
public int getRowDeleted() {
|
|
return this.rowDeleted;
|
|
}
|
|
|
|
public void setRowDeleted(int newRowDeleted) {
|
|
this.rowDeleted = newRowDeleted;
|
|
}
|
|
|
|
public long getCurrentPage() {
|
|
return this.currentPage;
|
|
}
|
|
|
|
public void setCurrentPage(long newCurrentPage) {
|
|
this.currentPage = newCurrentPage;
|
|
}
|
|
|
|
public long getCurrentSlot() {
|
|
return this.currentSlot;
|
|
}
|
|
|
|
public void setCurrentSlot(long newCurrentSlot) {
|
|
this.currentSlot = newCurrentSlot;
|
|
}
|
|
|
|
public int getMaxPage() {
|
|
return this.maxPage;
|
|
}
|
|
|
|
public void setMaxPage(int newMaxPage) {
|
|
this.maxPage = newMaxPage;
|
|
}
|
|
|
|
public int getRecordsPerPage() {
|
|
return this.recordsPerPage;
|
|
}
|
|
|
|
public void setRecordsPerPage(int newRecordsPerPage) {
|
|
this.recordsPerPage = newRecordsPerPage;
|
|
}
|
|
|
|
public long getSlot(long lPageRequested) {
|
|
return (lPageRequested % this.maxPage != 0L) ? (lPageRequested / this.maxPage + 1L) : (lPageRequested / this.maxPage);
|
|
}
|
|
|
|
public int getRelativeStart(long lPageRequested) {
|
|
long lAbsoluteIndex = (lPageRequested - 1L) * this.recordsPerPage + 1L;
|
|
return (int)(lAbsoluteIndex % (this.recordsPerPage * this.maxPage)) - 1;
|
|
}
|
|
|
|
public int getRelativeEnd(long lPageRequested) {
|
|
long lAbsoluteIndexStart = (lPageRequested - 1L) * this.recordsPerPage;
|
|
long lAbsoluteEnd = (lAbsoluteIndexStart + this.recordsPerPage < this.totalDetailRecord) ? (lAbsoluteIndexStart + this.recordsPerPage) : this.totalDetailRecord;
|
|
int iMod = (int)(lAbsoluteEnd % (this.recordsPerPage * this.maxPage));
|
|
if (iMod != 0)
|
|
return iMod - 1;
|
|
return this.recordsPerPage * this.maxPage - 1;
|
|
}
|
|
|
|
public long getAbsoluteStart(long lPageRequested) {
|
|
return (lPageRequested - 1L) * this.recordsPerPage + 1L;
|
|
}
|
|
|
|
public long getAbsoluteEnd(long lPageRequested) {
|
|
long lStart = (lPageRequested - 1L) * this.recordsPerPage;
|
|
return (lStart + (this.recordsPerPage * this.maxPage) < this.totalDetailRecord) ? (lStart + (this.recordsPerPage * this.maxPage)) : this.totalDetailRecord;
|
|
}
|
|
|
|
public long getSlotStartPosition() {
|
|
return (this.currentSlot - 1L) * this.recordsPerPage * this.maxPage + 1L;
|
|
}
|
|
|
|
public long getSlotLastPosition() {
|
|
return (this.currentSlot * this.recordsPerPage * this.maxPage < this.totalDetailRecord) ? (this.currentSlot * this.recordsPerPage * this.maxPage) : this.totalDetailRecord;
|
|
}
|
|
}
|