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

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

?? pagedlistholder.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.beans.support;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.util.Assert;

/**
 * PagedListHolder is a simple state holder for handling lists of objects,
 * separating them into pages. Page numbering starts with 0.
 *
 * <p>This is mainly targetted at usage in web UIs. Typically, an instance will be
 * instantiated with a list of beans, put into the session, and exported as model.
 * The properties can all be set/get programmatically, but the most common way will
 * be data binding, i.e. populating the bean from request parameters. The getters
 * will mainly be used by the view.
 *
 * <p>Supports sorting the underlying list via a {@link SortDefinition} implementation,
 * available as property "sort". By default, a {@link MutableSortDefinition} instance
 * will be used, toggling the ascending value on setting the same property again.
 *
 * <p>The data binding names have to be called "pageSize" and "sort.ascending",
 * as expected by BeanWrapper. Note that the names and the nesting syntax match
 * the respective JSTL EL expressions, like "myModelAttr.pageSize" and
 * "myModelAttr.sort.ascending".
 *
 * @author Juergen Hoeller
 * @since 19.05.2003
 * @see #getPageList()
 * @see org.springframework.beans.support.MutableSortDefinition
 */
public class PagedListHolder implements Serializable {

	public static final int DEFAULT_PAGE_SIZE = 10;

	public static final int DEFAULT_MAX_LINKED_PAGES = 10;


	private List source;

	private Date refreshDate;

	private SortDefinition sort;

	private SortDefinition sortUsed;

	private int pageSize = DEFAULT_PAGE_SIZE;

	private int page = 0;

	private boolean newPageSet;

	private int maxLinkedPages = DEFAULT_MAX_LINKED_PAGES;


	/**
	 * Create a new holder instance.
	 * You'll need to set a source list to be able to use the holder.
	 * @see #setSource
	 */
	public PagedListHolder() {
		this(new ArrayList(0));
	}

	/**
	 * Create a new holder instance with the given source list, starting with
	 * a default sort definition (with "toggleAscendingOnProperty" activated).
	 * @param source the source List
	 * @see MutableSortDefinition#setToggleAscendingOnProperty
	 */
	public PagedListHolder(List source) {
		this(source, new MutableSortDefinition(true));
	}

	/**
	 * Create a new holder instance with the given source list.
	 * @param source the source List
	 * @param sort the SortDefinition to start with
	 */
	public PagedListHolder(List source, SortDefinition sort) {
		setSource(source);
		setSort(sort);
	}


	/**
	 * Set the source list for this holder.
	 */
	public void setSource(List source) {
		Assert.notNull(source, "Source List must not be null");
		this.source = source;
		this.refreshDate = new Date();
		this.sortUsed = null;
	}

	/**
	 * Return the source list for this holder.
	 */
	public List getSource() {
		return this.source;
	}

	/**
	 * Return the last time the list has been fetched from the source provider.
	 */
	public Date getRefreshDate() {
		return this.refreshDate;
	}

	/**
	 * Set the sort definition for this holder.
	 * Typically an instance of MutableSortDefinition.
	 * @see org.springframework.beans.support.MutableSortDefinition
	 */
	public void setSort(SortDefinition sort) {
		this.sort = sort;
	}

	/**
	 * Return the sort definition for this holder.
	 */
	public SortDefinition getSort() {
		return this.sort;
	}

	/**
	 * Set the current page size.
	 * Resets the current page number if changed.
	 * <p>Default value is 10.
	 */
	public void setPageSize(int pageSize) {
		if (pageSize != this.pageSize) {
			this.pageSize = pageSize;
			if (!this.newPageSet) {
				this.page = 0;
			}
		}
	}

	/**
	 * Return the current page size.
	 */
	public int getPageSize() {
		return this.pageSize;
	}

	/**
	 * Set the current page number.
	 * Page numbering starts with 0.
	 */
	public void setPage(int page) {
		this.page = page;
		this.newPageSet = true;
	}

	/**
	 * Return the current page number.
	 * Page numbering starts with 0.
	 */
	public int getPage() {
		this.newPageSet = false;
		if (this.page >= getPageCount()) {
			this.page = getPageCount() - 1;
		}
		return this.page;
	}

	/**
	 * Set the maximum number of page links to a few pages around the current one.
	 */
	public void setMaxLinkedPages(int maxLinkedPages) {
		this.maxLinkedPages = maxLinkedPages;
	}

	/**
	 * Return the maximum number of page links to a few pages around the current one.
	 */
	public int getMaxLinkedPages() {
		return this.maxLinkedPages;
	}


	/**
	 * Return the number of pages for the current source list.
	 */
	public int getPageCount() {
		float nrOfPages = (float) getNrOfElements() / getPageSize();
		return (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages);
	}

	/**
	 * Return if the current page is the first one.
	 */
	public boolean isFirstPage() {
		return getPage() == 0;
	}

	/**
	 * Return if the current page is the last one.
	 */
	public boolean isLastPage() {
		return getPage() == getPageCount() -1;
	}

	/**
	 * Switch to previous page.
	 * Will stay on first page if already on first page.
	 */
	public void previousPage() {
		if (!isFirstPage()) {
			this.page--;
		}
	}

	/**
	 * Switch to next page.
	 * Will stay on last page if already on last page.
	 */
	public void nextPage() {
		if (!isLastPage()) {
			this.page++;
		}
	}

	/**
	 * Return the total number of elements in the source list.
	 */
	public int getNrOfElements() {
		return getSource().size();
	}

	/**
	 * Return the element index of the first element on the current page.
	 * Element numbering starts with 0.
	 */
	public int getFirstElementOnPage() {
		return (getPageSize() * getPage());
	}

	/**
	 * Return the element index of the last element on the current page.
	 * Element numbering starts with 0.
	 */
	public int getLastElementOnPage() {
		int endIndex = getPageSize() * (getPage() + 1);
		int size = getNrOfElements();
		return (endIndex > size ? size : endIndex) - 1;
	}

	/**
	 * Return a sub-list representing the current page.
	 */
	public List getPageList() {
		return getSource().subList(getFirstElementOnPage(), getLastElementOnPage() + 1);
	}

	/**
	 * Return the first page to which create a link around the current page.
	 */
	public int getFirstLinkedPage() {
		return Math.max(0, getPage() - (getMaxLinkedPages() / 2));
	}

	/**
	 * Return the last page to which create a link around the current page.
	 */
	public int getLastLinkedPage() {
		return Math.min(getFirstLinkedPage() + getMaxLinkedPages() - 1, getPageCount() - 1);
	}


	/**
	 * Resort the list if necessary, i.e. if the current <code>sort</code> instance
	 * isn't equal to the backed-up <code>sortUsed</code> instance.
	 * <p>Calls <code>doSort</code> to trigger actual sorting.
	 * @see #doSort
	 */
	public void resort() {
		SortDefinition sort = getSort();
		if (sort != null && !sort.equals(this.sortUsed)) {
			this.sortUsed = copySortDefinition(sort);
			doSort(getSource(), sort);
			setPage(0);
		}
	}

	/**
	 * Create a deep copy of the given sort definition,
	 * for use as state holder to compare a modified sort definition against.
	 * <p>Default implementation creates a MutableSortDefinition instance.
	 * Can be overridden in subclasses, in particular in case of custom
	 * extensions to the SortDefinition interface. Is allowed to return
	 * null, which means that no sort state will be held, triggering
	 * actual sorting for each <code>resort</code> call.
	 * @param sort the current SortDefinition object
	 * @return a deep copy of the SortDefinition object
	 * @see MutableSortDefinition#MutableSortDefinition(SortDefinition)
	 */
	protected SortDefinition copySortDefinition(SortDefinition sort) {
		return new MutableSortDefinition(sort);
	}

	/**
	 * Actually perform sorting of the given source list, according to
	 * the given sort definition.
	 * <p>The default implementation uses Spring's PropertyComparator.
	 * Can be overridden in subclasses.
	 * @see PropertyComparator#sort(java.util.List, SortDefinition)
	 */
	protected void doSort(List source, SortDefinition sort) {
		PropertyComparator.sort(source, sort);
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
caoporn国产一区二区| 亚洲国产日韩精品| 国产精品1区2区3区| 欧美精品一区二区三区很污很色的 | 国产伦精品一区二区三区免费| 精品奇米国产一区二区三区| 国产在线播放一区三区四| 国产亚洲精品免费| 91网站视频在线观看| 亚洲一区二区在线观看视频| 9191成人精品久久| 老司机精品视频导航| 国产亚洲精品久| 色av一区二区| 美国精品在线观看| 中文一区二区完整视频在线观看| 99久久综合精品| 日韩成人一区二区三区在线观看| 欧美电影免费观看高清完整版在 | 成人午夜碰碰视频| 亚洲黄网站在线观看| 日韩欧美专区在线| 成人一区在线观看| 亚洲va中文字幕| 国产视频亚洲色图| 欧美色精品在线视频| 国产精品一卡二卡在线观看| 亚洲精品国久久99热| 精品国一区二区三区| 99r国产精品| 国内精品久久久久影院薰衣草| 亚洲色图丝袜美腿| 91精品国产一区二区三区| 成人黄色av网站在线| 日韩精品一区第一页| 欧美国产在线观看| 日韩视频一区二区在线观看| 95精品视频在线| 久久草av在线| 亚洲bdsm女犯bdsm网站| 欧美国产日韩在线观看| 91精品久久久久久久久99蜜臂| 成人激情综合网站| 91福利精品第一导航| 国产精品亚洲成人| 午夜激情久久久| 国产精品短视频| 精品国产亚洲一区二区三区在线观看 | 欧美二区在线观看| 99久久免费国产| 国产91在线|亚洲| 久久se这里有精品| 天天综合色天天综合| 亚洲美女区一区| 国产精品少妇自拍| 久久久久国产精品厨房| 日韩欧美第一区| 日韩一区二区三区三四区视频在线观看| 99re这里只有精品首页| 国产成人精品一区二区三区四区| 欧美a级理论片| 亚洲一二三四久久| 一区二区三区在线影院| 国产精品久久一卡二卡| 中文字幕欧美日韩一区| 久久精品视频在线免费观看 | 狠狠色丁香久久婷婷综合_中| 日韩一区精品视频| 日日摸夜夜添夜夜添国产精品| 一区二区三区中文在线观看| 成人免费一区二区三区视频| 国产精品毛片无遮挡高清| 国产无人区一区二区三区| 久久综合久久鬼色中文字| 欧美成人一区二区三区片免费| 日韩女优电影在线观看| 精品国产一区二区在线观看| 精品成人佐山爱一区二区| 日韩免费高清视频| 日韩欧美中文一区二区| 精品日韩在线观看| 久久亚洲综合色| 久久久99久久精品欧美| 国产日韩欧美综合在线| 国产精品色一区二区三区| 国产调教视频一区| 亚洲视频在线观看一区| 一区二区三区免费在线观看| 亚洲综合视频在线| 无码av中文一区二区三区桃花岛| 蜜臀av性久久久久蜜臀av麻豆| 久久99久久久欧美国产| 国产福利一区在线| 色综合咪咪久久| 欧美精品在线观看播放| 日韩欧美国产精品一区| 国产精品日产欧美久久久久| 一区二区三区四区乱视频| 三级不卡在线观看| 国产成人av影院| 色综合久久综合中文综合网| 欧美高清视频在线高清观看mv色露露十八 | 欧美乱妇20p| 精品国产伦一区二区三区免费| 国产视频视频一区| 亚洲另类在线制服丝袜| 日韩电影在线免费| 国产91精品在线观看| 欧美色网一区二区| 久久久蜜桃精品| 国产精品女主播av| 天堂成人国产精品一区| 精品一二线国产| av不卡一区二区三区| 3d动漫精品啪啪一区二区竹菊| 久久精品人人做| 亚洲国产欧美在线| 国产成人在线看| 欧美久久一二三四区| 中文子幕无线码一区tr| 午夜精品久久久久久久蜜桃app| 国产综合一区二区| 欧美日韩一区二区电影| 欧美国产视频在线| 蜜桃视频一区二区| 一本色道亚洲精品aⅴ| 精品久久久久久久久久久久久久久 | 无码av中文一区二区三区桃花岛| 国产精品996| 欧美日韩的一区二区| 国产精品高潮呻吟| 国产在线精品视频| 欧美午夜免费电影| 亚洲国产高清aⅴ视频| 美日韩一级片在线观看| 色婷婷综合五月| 国产欧美日韩激情| 精品午夜一区二区三区在线观看| 欧美亚洲动漫制服丝袜| 国产精品成人在线观看| 激情亚洲综合在线| 欧美精品tushy高清| 亚洲视频综合在线| 成人看片黄a免费看在线| 精品国产乱码久久久久久蜜臀 | 麻豆专区一区二区三区四区五区| 99这里都是精品| 久久久国际精品| 久久91精品国产91久久小草| 欧美午夜影院一区| 亚洲综合免费观看高清在线观看| 波多野结衣亚洲| 中文字幕免费观看一区| 国产精品99久| 日本一区二区三区国色天香| 精品一区二区三区久久久| 91精品国产日韩91久久久久久| 亚洲第一综合色| 欧美日韩在线播放三区| 亚洲精品综合在线| 日本韩国精品一区二区在线观看| 亚洲欧洲日韩av| 99国内精品久久| 亚洲欧美另类综合偷拍| 91毛片在线观看| 洋洋成人永久网站入口| 91国内精品野花午夜精品| 亚洲人成影院在线观看| 色网站国产精品| 午夜亚洲国产au精品一区二区| 欧美亚男人的天堂| 午夜日韩在线电影| 在线成人午夜影院| 免费成人美女在线观看.| 精品免费日韩av| 国产精品一区二区三区乱码 | 国产精品久久久久久久久免费丝袜| 国产九九视频一区二区三区| 国产日韩v精品一区二区| 国产精品一区二区无线| 亚洲国产成人私人影院tom| 91亚洲永久精品| 亚洲国产日韩a在线播放| 91精品国产麻豆国产自产在线 | 亚洲欧洲在线观看av| 97精品久久久久中文字幕| 国产精品不卡在线观看| 91丨九色丨蝌蚪富婆spa| 亚洲一区在线看| 精品乱码亚洲一区二区不卡| 成人黄色在线网站| 亚洲高清免费观看| 精品久久一二三区| 91视频在线看| 免费看黄色91| 国产精品天天看| 欧美日韩免费高清一区色橹橹| 国产中文一区二区三区| 中文字幕亚洲综合久久菠萝蜜| 在线成人av网站|