⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fenye.java~41~

📁 Bug管理系统
💻 JAVA~41~
字号:
package tmp;
import yonghu.*;
import xiangmu.*;
import java.util.Iterator;


public class fenye {
    public String tishi1=""; //提示1:第一页
    public String tishi2="";  //提示2:上一页
    public String tishi3="";  //提示3:下一页
    public String tishi4="";  //提示4:末页
    public String tishi5="1/1";  //提示5:页面显示 例如: 1/5
    public int n=0;   //记录第几页
    public int fenyedanwei=6;  //分页单位
    public int nn=1;  //总页数

    public fenye() {
    }

    //为用户列表分页  n1是第几页(n1=0时为第一页) n2是分页单位
    public yonghuliebiao yonghufenye(yonghuliebiao yl,String n1,String n2)throws Exception
    {
        if(!n1.equals(""))
            n=Integer.parseInt(n1);
        if(!n2.equals(""))
            fenyedanwei=Integer.parseInt(n2);

        yonghuliebiao tmpyl=new yonghuliebiao();
        Iterator i1=yl.yonghuitems.iterator();
        int i=0;
        while (i1.hasNext()) {
            yonghu y = (yonghu) i1.next();
            if(i>=n*fenyedanwei && i<(n+1)*fenyedanwei)
            {
                tmpyl.yonghuitems.add(y);
            }
            i++;
        }
        nn=i/fenyedanwei;  //总页数
        if((i%fenyedanwei)!=0)
            nn=nn+1;
        this.chushihua();
        return tmpyl;
    }

    //为项目列表分页  n=0时是第一页
        public xiangmuliebiao xiangmufenye(xiangmuliebiao xl,String n1,String n2)throws Exception
        {

            if(!n1.equals(""))
                n=Integer.parseInt(n1);
            if(!n2.equals(""))
                fenyedanwei=Integer.parseInt(n2);

            xiangmuliebiao tmpxl=new xiangmuliebiao();
            Iterator i1=xl.xiangmuitems.iterator();
            int i=0;
            while (i1.hasNext()) {
                xiangmu y = (xiangmu) i1.next();
                if(i>=n*fenyedanwei && i<(n+1)*fenyedanwei)
                {
                    tmpxl.xiangmuitems.add(y);
                }
                i++;
            }

            nn=i/fenyedanwei;  //总页数
            if((i%fenyedanwei)!=0)
                {
                    nn = nn + 1;
                }

            this.chushihua();
            return tmpxl;
        }

        //为bug列表分页  n=0时是第一页
        public bugliebiao bugfenye(bugliebiao bl,String n1,String n2)throws Exception
        {
System.out.println(n1+"          "+n2+"                    adfasdf");
            if(!n1.equals(""))
                n=Integer.parseInt(n1);
            if(!n2.equals(""))
                fenyedanwei=Integer.parseInt(n2);

System.out.println("11111111111111");
            bugliebiao tmpbl=new bugliebiao();
            Iterator i1=bl.bugitems.iterator();
            int i=0;

System.out.println("22222222222222222");
            while (i1.hasNext()) {
                bug y = (bug) i1.next();
                if(i>=n*fenyedanwei && i<(n+1)*fenyedanwei)
                {
                    tmpbl.bugitems.add(y);
                }
                i++;
            }
System.out.println("3333333333333333333");
            nn=i/fenyedanwei;  //总页数

            if((i%fenyedanwei)!=0)
                nn=nn+1;

            this.chushihua();
            return tmpbl;
        }

        private void chushihua()
        {
            if(n==0 && nn==1)         //只有一页
            {
                tishi1="";
                tishi2="";
                tishi3="";
                tishi4="";
                tishi5="1/1";
            }
            else if(n==0 && (n!=(nn-1)))  //第一页
            {
                tishi1="";
                tishi2="";
                tishi3="下一页";
                tishi4="末页";
                tishi5=(n+1)+"/"+nn;
            }
            else if(n!=0 && n==(nn-1))  //最后一页
            {
                tishi1="第一页";
                tishi2="上一页";
                tishi3="";
                tishi4="";
                tishi5=nn+"/"+nn;
            }
            else //中间页
            {
                tishi1="第一页";
                tishi2="上一页";
                tishi3="下一页";
                tishi4="末页";
                tishi5=(n+1)+"/"+nn;
            }
        }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -