PaginationBar
If you want to add pagination function in any "show data component ",the add-on is your best selection.
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; } }
Links
Compatibility
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.API for 6.0+
API for 7.0+
PaginationBar version 2.0.0
Change log:
v2.0.0
change listener add method parameter "int currentPageIndex"
v1.0.1 :parameter like methodName(PaginationBar pagination, Button button);
v2.0.0 :parameter like methodName(int currentPageIndex, PaginationBar pagination, Button button);
@param:int currentPageIndex was the current page index you can use it for loading Data;
About details of usage, you can see the demo source file.
Any issue you find,you can contact me through mail to 672308444@163.com or submit your comment in my blog "http://www.host900.com".
PaginationBar version 3.0.0
Change log:
Add a panel to the bar,bind "shortcut KeyBoard.ENTER" to the panel.
V2.0 add a global shortcut for input,
V3.0 'scope' the shortcut to the panel.
Any issue you find,you can contact me through mail to 672308444@163.com or
submit your comment in my blog "http://www.host900.com".
PaginationBar version 3.0.1
Fix a little of Layout about bar.
PaginationBar version 4.0.0
Change log:
############### V4.0.0 ###################
Make the button looks like label,that look feel good.
############### V3.0.1 ###################
Fix a little of Layout about bar.
############### V3.0.0 ###################
Add a panel to the bar,bind "shortcut KeyBoard.ENTER" to the panel.
V2.0 add a global shortcut for input,
V3.0 'scope' the shortcut to the panel.
############### v2.0.0 ###################
change listener add method parameter "int currentPageIndex"
v1.0.1 :parameter like methodName(PaginationBar pagination, Button button);
v2.0.0 :parameter like methodName(int currentPageIndex, PaginationBar pagination, Button button);
@param:int currentPageIndex was the current page index you can use it for loading data easyly.
About details of usage, you can see the demo source file.
Any issue you find,you can contact me through mail to 672308444@163.com or
submit your comment in my blog "http://www.host900.com".
PaginationBar version 5.0.0
Change log:
############### V5.0.0 ###################
1.Set default text to << < > >>
2.Add set Tool Tip method.
setForwardTooTip(String forwardTooTip)
setFirstTooTip(String firstTooTip)
setNextTooTip(String nextTooTip)
setLastTooTip(String lastTooTip)
setInputTooTip(String inputTooTip)
3.Add getter medthod.
public TextField getInputField()
public NativeButton getFirstButton()
public NativeButton getLastButton()
public NativeButton getNextButton()
public NativeButton getForwardButton()
PaginationBar version 6.0.0
Change log:
############### V6.0.0 ###################
1.use icons replace text to make it nicer and smaller.
2.Add method to set tooltip language,default : "en"
parameter can be "en"(english) or "cn"(china)
3.In addition,you must place "icos files" to folder : WebRoot/VAADIN/themes/paginationbar/icons/16/
"icos files" are in "WebRoot" folder of zip package.
PaginationBar version 7.0.0
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/