亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? abstractpager.java

?? Document will be uploaded soon
?? JAVA
字號:
package com.component.pagination;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Vector;

/**
 * Abstract class implementing some common methods in Pager.
 * 
 * Note : Ideas for implementing 2-level pager. 
 * 
 * 1) Abstract pager should contain second-level pager, this pager is
 *    always a Numeric Pager. 
 * 
 * 2) User/Programmer doesn't have any control over the 2-level pager.
 * 
 * 3) PageElementIndex needs to be changed to contain one more index 
 *    apart from the two existing now.
 *    a) PageIndex
 *    b) SubPage Index
 *    c) Index in SubPage // Needs more thought on this.
 * 
 * 4) PageSelectionModel also needs to be changed accordingly(especially BitSet-related things)
 *    PageSelectionEvent, PageSelectionListener needs to be updated.
 * 
 * 5) The method signature of the methods in Pager interface will change slightly, esplacially 
 *    getPage() and similar methods.  
 * 
 * 6) JPagination will contain one more JPageBar for sub page bar, need to add action listener for this.
 * 
 * 7) The currentPage pointer in the PaginationModel(in turn in Pager) needs to take into account now 
 *    the 2-level pager's existence. 
 * 
 * @author chetan_bh
 * 
 */
public abstract class AbstractPager implements Pager {
		
	/*
	 * This pageMap datastructure needs to be modified a little.
	 * Right now it is a Map of String->Vector<PageElement>.
	 * 
	 * But after the Second level pagination it will be
	 * Map of String->Map<Map> value Map is from String->Vector<PageElement>
	 * 
	 * Key set in the outer map are page indices of first level paging of full user data, 
	 * Key set in the inner maps are page indices of the second level paging of first level page.
	 * 
	 */
	//Map<String,Vector> pageMap;
	
	Map<String, Map<String,Vector<PageElement>>> pageMap;
	
	// TODO A vector of pageIndices is needed because the pageMap keyset is not ordered,
	// but page Indices is a ordered list.
	Vector<String> pageIndices; // A vector of Strings which are key to pageMap.
	
	int numberOfElements;
	
	Vector<PageElement> rawData;
	
	// TODO this is a configurable parameter.
	/**
	 * Elements per page attribute means different for different pagers,
	 * 
	 * For numeric pager it is a very impoertant parameter, all pages except the last page
	 * should mandatorily have exaclty the number of specified number of elements per page.
	 * 
	 * For non-numeric pager this rule applies only for pages which have more than specified 
	 * number of elements per page, i.e for secondary pagination.
	 * 
	 * So getter setter methods and property change handler code, for this attribute should 
	 * go to respective pagers.
	 */
	int elementsPerPage;
	
	int numberOfPages;
	
	int currentPageIndex = -1;
	
	PageIndex currPageIndex;
	
	String currentPageIndexStr = "";
	
	public AbstractPager(PageElement[] elements)
	{
		this(convertToVector(elements));
	}
	
	public AbstractPager(Vector<PageElement> data)
	{
		this(data, PaginationConstants.DEFAULT_ELEMENTS_PER_PAGE);
	}
	
	public AbstractPager(Vector<PageElement> data, int elementsPerPage)
	{
		this.rawData = data;  // Added on 28/11/06 this is needed for setElementsPerPAge setter method,
		                      // otherwise this method has no access to rawData;
		this.elementsPerPage = elementsPerPage;
		numberOfElements = data.size();
		//System.out.println("number of elements "+numberOfElements);
		numberOfPages = (int)Math.ceil(numberOfElements / (double)elementsPerPage);
		//System.out.println("number Of Pages needed ==>> "+numberOfPages);
		pageIndices = new Vector<String>();
		pageMap = page(data);
		
		//System.out.println("pageMap.keySet() "+pageMap.keySet());
	}
	
	//TODO page index starts from 1 unlike standard JAVA indexing which starts from 0.
	/*
	 * This is a default Numeric Pager for the pagination component.
	 * 
	 * Since this a Numeric Pager, no need to call the subPage() method at any cost.
	 * But this method now needs to take care of modified pagemap datastructure.
	 * 
	 * For NumericPager the pageMap DS will be like this
	 * pageMap given Numeric Index returns a Map which again contains the same 
	 * Numeric Index to get Vector<PageElement> Vector.
	 * 
	 */
	protected Map<String, Map<String,Vector<PageElement>>> page(Vector<PageElement> data)
	{
		Map<String,Map<String, Vector<PageElement>>> returner = new HashMap<String, Map<String,Vector<PageElement>>>();
		Iterator<PageElement> elementsIter = data.iterator();
		
		int pageCounter = 1;
		int elementsCounter = 0;
		String currentPage = "";
		Vector<PageElement> page = new Vector<PageElement>();
		
		while(elementsIter.hasNext())
		{
			PageElement pageElement = elementsIter.next();
			if(elementsCounter == elementsPerPage)
			{
				currentPage = ""+pageCounter;
				pageIndices.add(currentPage);
				Map<String, Vector<PageElement>> subPageMap = new HashMap<String, Vector<PageElement>>();
				subPageMap.put(currentPage, page);
				returner.put(currentPage, subPageMap);
				page = new Vector<PageElement>();
				elementsCounter = 0;
				pageCounter++;
			}
			page.add(pageElement);
			elementsCounter++;
		}
		currentPage = ""+pageCounter;
		pageIndices.add(currentPage);     // again page indices need to be broken by numeric pager.
		Map<String, Vector<PageElement>> subPageMap = new HashMap<String, Vector<PageElement>>();
		subPageMap.put(currentPage, page);
		returner.put(currentPage, subPageMap);  // TODO last page added to the pageMap.
		
		//System.out.println("pageIndices "+pageIndices);
		
		return returner;
	}
	
	/**
	 * A utility method to convert array of page element to Vector of page element. 
	 * @param elements
	 * @return
	 */
	private static Vector<PageElement> convertToVector(PageElement[] elements)
	{
		Vector<PageElement> returner = new Vector<PageElement>();
		for(int i = 0; i < elements.length; i++)
		{
			returner.add(elements[i]);
		}
		return returner;
	}
	
	/**
	 * Returns a page.
	 */
	public Vector<PageElement> getPage(PageIndex pageIndex)
	{
		
		String firstKey = pageIndex.getMainPageIndex();
		String secondKey = pageIndex.getSubPageIndex();
		
		Map<String, Vector<PageElement>> subPageMap = pageMap.get(firstKey);
		
		Vector<PageElement> page = subPageMap.get(secondKey);
		int requestedPageIndex = -1;
		try{
			requestedPageIndex = Integer.parseInt(index);
		}catch(NumberFormatException nfe)
		{
			requestedPageIndex = pageIndices.indexOf(index);
			requestedPageIndex++;
		}
		currentPageIndexStr = index;
		currentPageIndex = --requestedPageIndex;
		
		return page;
	}
	
	
	/**
	 * Returns true if there a pages next to current page, else false.
	 */
	public boolean hasNextPage()
	{
		if(currentPageIndex < (pageIndices.size()-1))
			return true;
		return false;
	}
	
	/**
	 * returns true if there are pages back to current page, else false.
	 */
	public boolean hasPreviousPage()
	{
		if(currentPageIndex > 0)
			return true;
		return false;
	}
	
	/**
	 * Returns the first page in the current pagination.
	 */
	/*
	 * Return first main page's first sub page.
	 */
	public Vector<PageElement> firstPage()
	{
		//System.out.println("firstPage requested");
		currentPageIndex = 0;
		currentPageIndexStr = pageIndices.get(currentPageIndex);
		//currentPageIndexStr = "1"; // TODO A bug was threr related to this hardcoding.
		String index = pageIndices.get(currentPageIndex);
		return pageMap.get(index);
	}
	
	/**
	 * Returns the page next to the current page.
	 */
	public Vector<PageElement> nextPage()
	{
		//System.out.println("nextPage :: currentPageIndex "+currentPageIndex);
		currentPageIndex++;
		//System.out.println("after "+currentPageIndex);
		String index = pageIndices.get(currentPageIndex);
		currentPageIndexStr = index;
		Vector<PageElement> nextPage = pageMap.get(index);
		
		return nextPage;
	}
	
	/**
	 * Returns the page previous to the current page. 
	 */
	public Vector<PageElement> previousPage()
	{
		//System.out.println("previousPage :: currentPageIndex "+currentPageIndex);
		currentPageIndex--;
		//System.out.println("after "+currentPageIndex);
		String index = pageIndices.get(currentPageIndex);
		currentPageIndexStr = index;
		Vector<PageElement> previousPage = pageMap.get(index);

		return previousPage;
	}
	
//	/**
//	 * This method should be deleted here, and moved to PageBarModel
//	 */
//	public Vector nextPageIndices() {
//		return pageIndices;
//	}

//	public Vector previousPageIndices() {
//		// This should actually return one part of Page Indices.
//		return pageIndices;
//	}
	
	/**
	 * Returns a collection of page indices.
	 */
	public Vector<String> getAllPageIndices()
	{
		return pageIndices;
	}
	
	public Set<String> getAllSubPageIndices(String mainPageIndex)
	{
		return (pageMap.get(mainPageIndex).keySet());
	}
	
	public String toString()
	{
		return pageMap.toString();
	}
	
//	/**
//	 * This method is needed for PageBarModel to decide on the next and previous
//	 * pageIndices in needed or not, to update fresh set of page indices.
//	 */
//	public String getCurrentPageIndex()
//	{
//		return currentPageIndexStr;
//	}
	
	public PageIndex getCurrentPageIndex()
	{
		return currPageIndex;
	}
	
	/**
	 * Returns the page element in a particular page, else null..
	 */
	public PageElement getPageElement(PageElementIndex pageElemIndex)
	{
		PageElement returner = null;
		
		//String pageIndex = pageElemIndex.getPageIndex();
		String mainPageIndex = pageElemIndex.getMainPageIndex(); // new
		String subPageIndex = pageElemIndex.getSubPageIndex();   // new
		int indexInPage = pageElemIndex.getIndexInPage();
		
		Map<String, Vector<PageElement>> subPageMap = pageMap.get(mainPageIndex); //pageMap.get(pageIndex);
		Vector page = subPageMap.get(subPageIndex);
		// TODO this is work around for BitSet not having same lenght as the page size
		// TODO handle null in the calling function.
		if(indexInPage < page.size())
			returner = (PageElement)page.get(indexInPage);
		else
			returner = null;
		
		
		return returner;
	}
	
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品中文字幕在线一区| 亚洲在线一区二区三区| 日本一区二区三级电影在线观看| 国产精品白丝在线| 爽好多水快深点欧美视频| 国产乱码一区二区三区| 精品视频999| 国产精品国产三级国产有无不卡 | 日韩精品一二三四| 成人免费看片app下载| 7777精品久久久大香线蕉| 亚洲欧美自拍偷拍色图| 国产一区二区精品久久91| 欧美日韩一本到| 亚洲手机成人高清视频| 国产乱人伦偷精品视频免下载| 欧美三级韩国三级日本一级| 欧美极品另类videosde| 麻豆精品一区二区三区| 欧美日韩精品三区| 亚洲青青青在线视频| 不卡av电影在线播放| 国产日韩欧美一区二区三区综合| 老司机精品视频一区二区三区| 91久久香蕉国产日韩欧美9色| 国产精品久久久久三级| 国产91精品一区二区麻豆亚洲| 日韩免费电影网站| 麻豆国产91在线播放| 日韩一区二区在线观看视频播放| 亚洲成人资源网| 欧美视频一区在线观看| 一区二区欧美精品| 欧日韩精品视频| 亚洲高清免费在线| 欧美色爱综合网| 亚洲国产裸拍裸体视频在线观看乱了 | 欧美亚洲国产一区在线观看网站| 日韩美女视频19| 91色婷婷久久久久合中文| 国产精品久久久久久福利一牛影视| 国内精品久久久久影院薰衣草| 精品国产一区二区三区四区四| 久久国产综合精品| 精品久久久久久久久久久久久久久久久 | 一区二区高清在线| 色欧美88888久久久久久影院| 国产精品嫩草影院com| www.av精品| 亚洲亚洲精品在线观看| 91麻豆精品国产自产在线观看一区| 免费的成人av| 国产色爱av资源综合区| 99免费精品视频| 亚洲一区二区偷拍精品| 欧美日韩国产大片| 白白色亚洲国产精品| 国产精品久久久久7777按摩| 色噜噜狠狠成人网p站| 日韩精品亚洲一区二区三区免费| 日韩久久免费av| a在线欧美一区| 亚洲成av人片在线观看无码| 2024国产精品视频| 99久久99久久免费精品蜜臀| 亚洲成人在线免费| 久久久久久99久久久精品网站| 成人看片黄a免费看在线| 一区二区三区四区av| 欧美一级片在线观看| 丁香另类激情小说| 夜夜爽夜夜爽精品视频| 欧美电影免费观看高清完整版在线观看 | 久久99在线观看| 亚洲欧洲精品天堂一级| 欧美日韩不卡一区| 国内精品久久久久影院色| 亚洲精选视频免费看| www国产成人| 欧美在线啊v一区| 国产成人免费视频网站| 亚洲国产精品一区二区久久| 国产午夜精品一区二区三区视频| 欧美系列日韩一区| 国产精品一卡二| 婷婷久久综合九色综合伊人色| 国产精品欧美综合在线| 日韩欧美综合在线| 欧美在线观看一二区| 国产成a人亚洲| 美女网站视频久久| 亚洲一区在线看| 国产精品久久午夜| 久久久久国产精品厨房| 欧美一区二区三区在线| 在线一区二区视频| 成人av午夜电影| 国产一区中文字幕| 七七婷婷婷婷精品国产| 亚洲国产一区二区在线播放| 亚洲国产高清在线| 精品国产免费视频| 欧美一区二区三区在线观看视频| 成人av在线播放网址| 国产剧情av麻豆香蕉精品| 日本免费新一区视频| 午夜精品久久久久久久99水蜜桃| 亚洲欧美日韩一区| 亚洲人快播电影网| 国产精品国产a| 中国av一区二区三区| 国产欧美一区二区在线观看| 欧美精品一区二区三区久久久 | 亚洲精品福利视频网站| 国产精品萝li| 亚洲色图19p| 中文字幕佐山爱一区二区免费| 中文字幕一区二区视频| 国产精品国产三级国产普通话三级| 国产精品无圣光一区二区| 国产日韩欧美一区二区三区乱码 | 色哟哟欧美精品| 91网站在线观看视频| 色婷婷亚洲一区二区三区| 在线观看国产一区二区| 欧美性猛交xxxx黑人交| 91精品国产一区二区三区| 日韩一区二区高清| 久久久天堂av| 国产精品久久久久久久午夜片 | 波多野结衣欧美| 91亚洲国产成人精品一区二三| 99国产精品久| 欧美精品v日韩精品v韩国精品v| 91精品一区二区三区在线观看| 日韩一级大片在线| 久久久蜜桃精品| 最新不卡av在线| 丝袜美腿高跟呻吟高潮一区| 国产呦萝稀缺另类资源| 91首页免费视频| 日韩一区国产二区欧美三区| 久久久亚洲精品一区二区三区| 综合中文字幕亚洲| 丝瓜av网站精品一区二区| 国产精品一区不卡| 欧美性猛交一区二区三区精品| 日韩欧美成人午夜| 亚洲欧洲av一区二区三区久久| 香蕉成人啪国产精品视频综合网| 九九视频精品免费| 972aa.com艺术欧美| 欧美高清一级片在线| 国产农村妇女精品| 亚洲福利视频一区二区| 97国产精品videossex| 欧美一区二区三区在线视频| 亚洲国产激情av| 日产国产欧美视频一区精品| 成人av电影在线| 777xxx欧美| 亚洲综合在线电影| 国产一区二区不卡老阿姨| 欧美天堂一区二区三区| 国产网站一区二区| 日日噜噜夜夜狠狠视频欧美人| 国产成人8x视频一区二区 | 亚洲观看高清完整版在线观看| 国内精品在线播放| 欧美唯美清纯偷拍| 中文字幕一区二区三区精华液| 美女一区二区三区| 91久久精品网| 国产日韩精品一区二区三区在线| 视频一区中文字幕| 一本久久精品一区二区| 国产欧美日本一区二区三区| 免费高清在线视频一区·| 欧美性生交片4| 国产精品久久久久久久久晋中| 国产一区视频网站| 欧美精品日韩综合在线| 樱花草国产18久久久久| 成人av网址在线| 精品理论电影在线观看| 青青草原综合久久大伊人精品优势| 欧美主播一区二区三区美女| 国产精品久久久久毛片软件| 国产成人午夜视频| 久久麻豆一区二区| 国产乱子伦一区二区三区国色天香| 日韩亚洲欧美成人一区| 日本伊人色综合网| 欧美日韩一二区| 五月天精品一区二区三区| 欧美视频三区在线播放| 亚洲综合男人的天堂| 色94色欧美sute亚洲线路一久| 中文字幕一区二区不卡| 99国产精品视频免费观看|