pager.java

来自「Document will be uploaded soon」· Java 代码 · 共 114 行

JAVA
114
字号
package com.component.pagination;

import java.util.Set;
import java.util.Vector;

/**
 * An interface to different types of pager.
 * All Pagers should implement this interface, thus abstracting the
 * paging details from the <code>PaginationModel</code>.
 * 
 * @author chetan_bh
 */
public interface Pager {
	
	/**
	 * Returns a page given a page index.
	 * A page is a <code>Collection</code> of <code>PageElement</code>s.
	 * 
	 * @param index in the page indices collection.
	 * @return a page.
	 */
	public Vector<PageElement> getPage(PageIndex pageIndex);
	
	/**
	 * Returns the current page index.
	 * @return current page index.
	 */
	public PageIndex getCurrentPageIndex();
	
	/**
	 * Returns true if the pager has more elements, after the current page index, else false.
	 * @return true, if more pages are available.
	 */
	public boolean hasNextMainPage();
	
	/**
	 * Returns true if the pager has more elements, before the current page index, else false.
	 * @return true if more pages are available.
	 */
	public boolean hasPreviousMainPage();
	
	/**
	 * Returns the first page in the paged collection in the pager. 
	 * @return
	 */
	public Vector<PageElement> firstMainPage();
	
	/**
	 * Returns the next page to the current page index in the pager.
	 * @return next page.
	 */
	public Vector<PageElement> nextMainPage();
	
	/**
	 * Returns the previous page to the current page index in the pager.
	 * @return previous page.
	 */
	public Vector<PageElement> previousMainPage();
	
	//public Vector nextPageIndices();
	
	//public Vector previousPageIndices();
	
	
	/**
	 * Returns the page indices needed to access the pages.
	 * @return page indices.
	 */
	public Vector<String> getAllPageIndices();
	
	public Set<String> getAllSubPageIndices(String mainPageIndex);
	
	/**
	 * Returns elements per page parameter.
	 * @return
	 */
	public int getElementsPerPage();
	
	/**
	 * Sets the elements per page parameter.
	 * @param elementsPerPage
	 */
	public void setElementsPerPage(int elementsPerPage);
	
	/**
	 * Returns the page element given an page element index.
	 * @param pageEleIndex
	 * @return
	 */
	public PageElement getPageElement(PageElementIndex pageEleIndex);
	
	/**
	 * Returns pager name.
	 * @return
	 */
	public String getPagerName();
	
	
	/*
	 * Not sure now whether mainPageIndex parameter needs to be passes to all
	 * of the below methods.
	 */
	public Vector<PageElement> firstSubPage(String mainPageIndex);
	
	public Vector<PageElement> nextSubPage(String mainPageIndex);
	
	public Vector<PageElement> previousSubPage(String mainPageIndex);
	
	public boolean hasNextSubPage(String mainPageIndex);
	
	public boolean hasPreviousSubPage(String mainPageIndex);
	
}

⌨️ 快捷键说明

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