Directory

← Back

PaginationBar

If you want to add pagination function in any "show data component ",the add-on is your best selection.

Author

Rating

Popularity

<100

How to use:

1.Copy PaginationBar.jar to your WebRoot/lib folder. 2.Copy demo folder's files to your Vaadin project src folder, and change package com.host900.PaginationBar with your own package 3.In your project somewhere you like add "addComponent(new PaginationBarDemo())" in your Componet. 4.Run your application and show your Componet you will see the demo.

5.For 6+ you must place "icos files" to folder : WebRoot/VAADIN/themes/paginationbar/icons/16/ "icos files" are in "WebRoot" folder of zip package.

In 6+ default behaviour are: 1.tooltips defalut are "To First Page","To First Pgae","To Forward Page","To Next Page","Please input a page number,then press Enter." 2.language defalut is en,you can through medthod "setLanguage" switch whole tooltip quickly to english(en) or chinese(cn). 3.button text defult is null.

Attention:

In order to avoid disturb your application layout , the bar be designed to a commom component HorizontalLayout,so you can use it flexibly. You can place it anywhere,and disable or enable it just throught setEnable(true/false) etc.

Any issue you find,you can submit your rating or contact me through mail to 672308444@163.com or submit your comment in my blog "http://www.host900.com".

Sample code

public class SearchView extends Panel {
    public SearchView(final Main app) {
        setCaption("PaginationBar Demo");
        setSizeFull();
        addComponent(new PaginationBarDemo());
    }
}
public class PaginationBarDemo extends VerticalLayout{
       public PaginationBarListener paginationBarListener;
       public PaginationBar paginationBar;
       public Table table;
       public PaginationBarDemo(){
    	   final Table table=new Table();
    	   table.setWidth(300,Sizeable.UNITS_PIXELS);
    	   table.setHeight(180,Sizeable.UNITS_PIXELS);
           Container dataSource=new TableContainer(DataBean.class).createDataSource(1,5);
    	   table.setContainerDataSource(dataSource);
    	   
            addComponent(table);
           
            paginationBarListener=new PaginationBarListener() {
			@Override
			public void pageRequested(int pageIndexRequested) {
		    table.setContainerDataSource(new TableContainer(DataBean.class).createDataSource(pageIndexRequested,5));
			}
			
			};//end paginationBarListener
			
			paginationBar=new PaginationBar(100, paginationBarListener);
            
			HorizontalLayout pageBar=paginationBar.createPagination();
			addComponent(pageBar);
       }
}
class TableContainer extends BeanItemContainer<DataBean>{

	public TableContainer(Class<? super DataBean> type)
			throws IllegalArgumentException {
		super(type);
	}

	public TableContainer createDataSource(int pageIndex,int pageSize){
		ArrayList<DataBean> list=new ArrayList<DataBean>();
		for(int i=(pageIndex-1)*pageSize+1;i<=(pageIndex-1)*pageSize+pageSize;i++){
			DataBean bean=new DataBean();
			bean.setId(i);
			bean.setName("name"+String.valueOf(i));
            list.add(bean);
		}
		addAll(list);
		return this;
	}
	
	
	
}
public class DataBean{
	private int id;
	private String name;
	/**
	 * @???? id
	 */
	
	public int getId() {
		return id;
	}
	/**
	 * @???? id
	 */
	
	public void setId(int id) {
		this.id = id;
	}
	/**
	 * @???? name
	 */
	
	public String getName() {
		return name;
	}
	/**
	 * @???? name
	 */
	
	public void setName(String name) {
		this.name = name;
	}
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Remove all unnecessary methods of PaginationBarListener. PaginationBar's goal is write little do more. Detials you can find in online API 7.0,@http://www.host900.com/index.php/articles/34/

Released
2011-10-06
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.6+
Browser
Internet Explorer
Internet Explorer
Internet Explorer
Firefox
Opera
Safari
Google Chrome
Internet Explorer

PaginationBar - Vaadin Add-on Directory

If you want to add pagination function in any "show data component ",the add-on is your best selection. PaginationBar - Vaadin Add-on Directory
How to use: 1.Copy PaginationBar.jar to your WebRoot/lib folder. 2.Copy demo folder's files to your Vaadin project src folder, and change package com.host900.PaginationBar with your own package 3.In your project somewhere you like add "addComponent(new PaginationBarDemo())" in your Componet. 4.Run your application and show your Componet you will see the demo. 5.For 6+ you must place "icos files" to folder : WebRoot/VAADIN/themes/paginationbar/icons/16/ "icos files" are in "WebRoot" folder of zip package. In 6+ default behaviour are: 1.tooltips defalut are "To First Page","To First Pgae","To Forward Page","To Next Page","Please input a page number,then press Enter." 2.language defalut is en,you can through medthod "setLanguage" switch whole tooltip quickly to english(en) or chinese(cn). 3.button text defult is null. Attention: In order to avoid disturb your application layout , the bar be designed to a commom component HorizontalLayout,so you can use it flexibly. You can place it anywhere,and disable or enable it just throught setEnable(true/false) etc. Any issue you find,you can submit your rating or contact me through mail to 672308444@163.com or submit your comment in my blog "http://www.host900.com".
Online