Java class for paging functionality

Source: Internet
Author: User

 PackageSmn.util; Public classPager {Private intPagenow; Private intPagesize=4; Private intTotalpage;//How many pages are there?    Private intTotalSize;//number of records    Private BooleanHasfirst;//do you have a home page    Private BooleanHaspre;//whether there is a previous page    Private BooleanHasnext;//do you have the next page ?    Private BooleanHaslast;//do you have the last page     PublicPager (intPagenow,inttotalsize) {         This. pagenow=Pagenow;  This. totalsize=totalsize; }     Public intGetpagenow () {returnPagenow; }     Public voidSetpagenow (intPagenow) {         This. Pagenow =Pagenow; }     Public intgetpagesize () {returnpageSize; }     Public voidSetPageSize (intpageSize) {         This. pageSize =pageSize; }     Public intGettotalpage () {//page AlgorithmTotalpage=gettotalsize ()/getpagesize (); if(totalsize%pagesize!=0) {Totalpage++; }        returnTotalpage; }     Public voidSettotalpage (inttotalpage) {         This. Totalpage =Totalpage; }     Public intgettotalsize () {returntotalsize; }     Public voidSettotalsize (inttotalsize) {         This. TotalSize =totalsize; }     Public BooleanIshasfirst () {//if the current number of pages is the first page there is no homepage        if(pagenow==1){            return false; }Else{            return true; }    }     Public voidSethasfirst (BooleanHasfirst) {         This. Hasfirst =Hasfirst; }     Public BooleanIshaspre () {//If there is a homepage there is a previous page        if( This. Ishasfirst ()) {            return true; }Else{            return false; }    }     Public voidSethaspre (Booleanhaspre) {         This. Haspre =Haspre; }     Public BooleanIshasnext () {//If there's a last page, there's the next one .        if( This. Ishaslast ()) {            return true; }Else{            return false; }    }     Public voidSethasnext (BooleanHasnext) {         This. Hasnext =Hasnext; }     Public BooleanIshaslast () {//if it's not the last page, there 's the last.        if(pagenow== This. Gettotalpage ()) {            return false; }Else{            return true; }    }     Public voidSethaslast (Booleanhaslast) {         This. Haslast =Haslast; }        }

Java class for paging functionality

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.