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

📄 simplepagination.java

📁 网上购物系统
💻 JAVA
字号:
package tarena.data;

import java.util.LinkedList;
import java.util.List;

public class SimplePagination extends AbstractPagination {

	private List<Page> pages = null;
	
	public SimplePagination(){}
		
	public SimplePagination(int total, int every, int current, String url, String param) {
		super(total, every, current, url, param);		
	}

	public SimplePagination(int total, int every, int current, String url) {
		super(total, every, current, url);		
	}



	@Override
	public List<Page> getContent() {
		if(this.pages != null) return this.pages;
		
		List<Page> content = new LinkedList<Page>();
		int totalpage = this.getTotalPage();
		for(int i=1;i<=totalpage;i++){			
			content.add(new Page(i,this.getURLByPage(i)));			
		}
		content.get(this.getCurrent()-1).setUrl(null);
		
		return content;
	}

	@Override
	public Page getFirst(String pageName) {		
		return new Page(1,pageName,this.getURLByPage(1));
	}
	
	
	@Override
	public Page getLast(String pageName) {	
		int totalpage = this.getTotalPage();
		return new Page(totalpage,pageName,this.getURLByPage(totalpage));
	}
	

	@Override
	public Page getNext(String pageName) {	
		int next = this.getCurrent()+1;
		if(next<=this.getTotalPage()){
			return new Page(next,pageName,this.getURLByPage(next));
		}
		return null;
	}

	@Override
	public Page getPrevious(String pageName) {
		int previous = this.getCurrent()-1;
		if(previous>=1){
			return new Page(previous,pageName,this.getURLByPage(previous));
		}
		return null;
	}

}

⌨️ 快捷键说明

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