Pager.java
пакет pers.kangxu.datautils.common; import java.io.serializable; import java.util.list;/** * * <b> Общий класс pagination </b> * * @author kangxu * @param <t> *//public page pager wageriod wageriod 4542617637761955078L; / *** Текущая страница текущей страницы*/ private int currentpage = 1; / *** PageSize на размер страницы*/ private int pageSize = 10; / *** Pagetotal Количество страниц*/ private int pagetotal; / *** Записывает количество пьес*/ private int recordtotal = 0; / *** Предыдущая страница предыдущая страница*/ private int предыдущая страница; / *** NextPage Next Page*/ private int nextPage; / *** Первая страница первой страницы*/ private int firstpage = 1; / *** Последняя страница последняя страница*/ private int на последнюю страницу; / *** Содержание контента на каждой странице*/ private list <t> content; // Следующий метод набора требует назначения/ ** * Установить текущую страницу <br> * * @author kangxu * * @param currentpage */ public void setcurrentpage (int currentpage) {this.currentPage = currentPage; } /*** Установите размер каждой страницы, вам также не нужно назначать значения. Размер по умолчанию составляет 10 пунктов <br> * * @author kangxu * * @param pageize */ public void setpagesize (int pagesize) {this.pagesize = pagesize; } / ** * Установите общее количество элементов, по умолчанию 0 <br> * * @author kangxu * * @param recordtotal * / public void setRecordtotal (int recordtotal) {this.recordtotal = recordtotal; Другое atttr (); } / ** * Установите содержимое страницы <br> * * @author kangxu * * @param content * / public void setContent (list <t> content) {this.content = content; } / ** * Установить другие параметры * * @author kangxu * * / public void orethattr () {// Общее количество страниц this.pagetotal = this.recordtotal % this.pagesize> 0? this.recordtotal / this.pagesize + 1: this.recordtotal / this.pagesize; // первая страница this.firstpage = 1; // последняя страница this.lastpage = this.pageTotal; // предыдущая страница if (this.currentpage> 1) {this.previouspage = this.currentpage - 1; } else {this.previouspage = this.firstpage; } // Следующая страница if (this.currentpage <this.lastpage) {this.nextpage = this.currentpage + 1; } else {this.nextPage = this.lastPage; }} // отпустить частные атрибуты public int getCurrentPage () {return CurrentPage; } public int getPageSize () {return PageSize; } public int getPageTotal () {return pagetotal; } public int getRecordTotal () {return recordtotal; } public int getPreviousPage () {return Purpage; } public int getNextPage () {return nextPage; } public int getFirstPage () {return FirstPage; } public int getLastPage () {return Last Page; } public List <T> getContent () {return Content; } @Override public String toString() { return "Pager [currentPage=" + currentPage + ", pageSize=" + pageSize + ", pageTotal=" + pageTotal + ", recordTotal=" + recordTotal + ", previousPage=" + previousPage + ", nextPage=" + nextPage + ", firstPage=" + firstPage + ", lastPage=" + Последняя страница + ", content =" + content + "]"; }}Используя pagertester.java
Package pers.kangxu.datautils.utils; import java.util.arraylist; import java.util.list; import pers.kangxu.datautils.common.pager;/** * Тест данных о странике * <b> * </b> * @author kangxu */public class pagertester {public static as (] arges) agress void void (] arges gauthor kangxu */public class. Pager <string> pager = new Pager <string> (); List <string> content = new ArrayList <string> (); content.add ("str1"); content.add ("str2"); content.add ("str3"); content.add ("str4"); content.add ("str5"); content.add ("str6"); content.add ("str7"); content.add ("str8"); content.add ("str9"); content.add ("str10"); Pager.SetCurrentPage (1); Pager.SetPagesize (10); Pager.SetRecordTotal (62); Pager.setContent (Content); System.out.println (Pager); }}Выше всего содержание этой статьи. Я надеюсь, что содержание этой статьи поможет всем, кто учится или работа. Я также надеюсь поддержать Wulin.com больше!