package cn.pdsu; /** * ��ʼҳ������ҳ��װ * * @author ���ߣ�user * @version ����ʱ�䣺2011-7-19 ����03:08:25 */ public class PageIndex { /** * ����ҳ */ private int endIndex; /** * ��ʼҳ */ private int startIndex; /** * ���㿪ʼҳ�ͽ���ҳ * * @param viewpagecount * ҳ����Ҫ��ʾ��ҳ����� * @param currentPage * ��ǰҳ * @param totalpage * ��ҳ���� * @return PageIndex ��¼��ʼҳ��startindex���ͽ���ҳ��endindex�� */ public static PageIndex getPageIndex(int viewpagecount, int currentPage, int totalpage) { int startpage = currentPage - (viewpagecount % 2 == 0 ? viewpagecount / 2 - 1 : viewpagecount / 2); int endpage = currentPage + viewpagecount / 2; if (startpage < 1) { startpage = 1; if (totalpage >= viewpagecount) endpage = viewpagecount; else endpage = totalpage; } if (endpage > totalpage) { endpage = totalpage; if ((endpage - viewpagecount) > 0) startpage = endpage - viewpagecount + 1; else startpage = 1; } return new PageIndex(startpage, endpage); } public PageIndex(int startIndex, int endIndex) { this.startIndex = startIndex; this.endIndex = endIndex; } public int getEndIndex() { return endIndex; } public void setEndIndex(int endIndex) { this.endIndex = endIndex; } public int getStartIndex() { return startIndex; } public void setStartIndex(int startIndex) { this.startIndex = startIndex; } }

taoshen95 LV16
2024年12月16日
asddwh LV13
2023年12月29日
wuge123 LV8
2023年6月12日
1719863922 LV11
2022年6月17日
刚刚vv谭v LV4
2022年1月4日
微信网友_5768552477921280 LV6
2022年1月2日
17771013609 LV4
2021年12月31日
fesdfs LV1
2021年12月20日
3089559272 LV11
2021年12月17日
龙门客栈 LV9
2021年12月16日

taoshen95 LV16
2024年12月16日
时光海 LV2
2024年7月1日
liyan54188 LV2
2024年6月25日
sdaijdiafafon
2024年6月23日
暂无贡献等级
沈从文 LV3
2023年12月31日
asddwh LV13
2023年12月25日
wodewode LV1
2023年12月23日
微信网友_6786215447367680 LV5
2023年12月23日
好哇好哇还是
2023年12月20日
暂无贡献等级
颜菜菜 LV2
2023年12月19日