Pager.java
Paket pers.kangxu.datautils.common; import Java.io.serializable; 4542617637761955078L; / *** CurrentPage Current Sage*/ private int currentPage = 1; / *** pageSize pro Seitengröße*/ private int pageSize = 10; / *** pagetotale Anzahl von Seiten*/ privat int pagetotal; / *** recordTotale Anzahl von Teilen*/ privat int recordTotal = 0; / *** vorherige Seite vorherige Seite*/ private int vorher; / *** NEXTPAGE Nächste Seite*/ private int NextPage; / *** FirstPage First Page*/ private int Firstpage = 1; / *** LastPage Last Page*/ private int lastPage; / *** Inhaltsinhalt jeder Seite*/ private Liste <T> Inhalt; // Die folgende festgelegte Methode erfordert Zuweisung/ ** * Setzen Sie die aktuelle Seite <br> * * @author Kangxu * * @param currentPage */ public void setCurrentPage (int currentPage) {this.currentPage = currentPage; } /*** Stellen Sie die Größe jeder Seite fest, Sie müssen auch keine Werte zuweisen. Die Standardgröße beträgt 10 Elemente <br> * * @author Kangxu * * @param pageSize */ public void setPageSize (int pageSize) {this.pageSize = pageSize; } / ** * Setzen Sie die Gesamtzahl der Elemente, der Standard ist 0 <br> * * @author Kangxu * * @param recordTotal * / public void setRecordTotal (int recordTotal) {this.RecordTotal = recordTotal; andereAttr (); } / ** * Setzen Sie den Seiteninhalt <br> * * @author Kangxu * * @param Inhalt * / public void setContent (Liste <T> Inhalt) {this.content = content; } / ** * andere Parameter einstellen * * @Author Kangxu * * / public void otherAttr () {// Gesamtzahl der Seiten this.pagetotal = this.recordTotal % this.pageSize> 0? this.recordTotal / this.PageSize + 1: this.recordTotal / this.pageSize; // erste Seite this.firstpage = 1; // letzte Seite this.lastpage = this.pagetotal; // vorherige Seite if (this.currentPage> 1) {this.PreviousPage = this.currentPage - 1; } else {this.previousPage = this.firstpage; } // nächste Seite if (this.currentPage <this.lastpage) {this.nextPage = this.currentPage + 1; } else {this.nextPage = this.lastpage; }} // lassen Sie die privaten Attribute public int getCurrentPage () {Return CurrentPage; } public int getPageSize () {return pageSize; } public int getPagetotal () {return pagetotal; } public int getRecordTotal () {return recordTotal; } public int getPreviousPage () {Zurück voreingenommen; } public int getNextPage () {return NextPage; } public int getfirstpage () {return firstpage; } public int getLastPage () {return lastPage; } public List <T> getContent () {Inhalt zurückgeben; } @Override public String toString() { return "Pager [currentPage=" + currentPage + ", pageSize=" + pageSize + ", pageTotal=" + pageTotal + ", recordTotal=" + recordTotal + ", previousPage=" + previousPage + ", nextPage=" + nextPage + ", firstPage=" + firstPage + ", lastPage=" + LastPage + ", content =" + content + "]"; }}Mit pagertester.java
Paket Perl. Pager <string> pager = new pager <string> (); Liste <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 (Inhalt); System.out.println (Pager); }}Das obige ist der gesamte Inhalt dieses Artikels. Ich hoffe, dass der Inhalt dieses Artikels für das Studium oder die Arbeit eines jeden hilfreich sein wird. Ich hoffe auch, Wulin.com mehr zu unterstützen!