关键字: wicket 分页 1.Navigator.java
package com.logcd.wicket.list;
import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.navigation.paging.IPageable; import
org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider; import
org.apache.wicket.markup.html.navigation.paging.PagingNavigation; import
org.apache.wicket.markup.html.navigation.paging.PagingNavigator; import org.apache.wicket.model.LoadableDetachableModel;
public class Navigator extends PagingNavigator { private static final long serialVersionUID = 1; public Navigator(String arg0, final IPageable arg1,final Integer total) { super(arg0, arg1); Link totallink = new Link(\ private static final long serialVersionUID = 1; @Override public boolean isEnabled() { return arg1.getPageCount() - 1 > 0; } @Override public void onClick() { arg1.setCurrentPage(arg1.getPageCount() - 1); } }; totallink.add(new Label(\LoadableDetachableModel() { private static final long serialVersionUID = 1; @Override protected Object load() {
return String.valueOf(arg1.getPageCount()); } })); this.add(totallink); this.add(new Label(\ } public Navigator(String arg0, final IPageable arg1, IPagingLabelProvider arg2,final Integer total) { super(arg0, arg1, arg2); Link totallink = new Link(\ private static final long serialVersionUID = 1; @Override public boolean isEnabled() { return arg1.getPageCount() - 1 > 0; } @Override public void onClick() { arg1.setCurrentPage(arg1.getPageCount() - 1); } }; totallink.add(new Label(\LoadableDetachableModel() { private static final long serialVersionUID = 1; @Override protected Object load() { return String.valueOf(arg1.getPageCount()); } })); this.add(totallink); this.add(new Label(\ } @Override protected PagingNavigation newNavigation(IPageable arg0, IPagingLabelProvider arg1) { return new PagingSetting(\this);
} }
2.PagingSetting.java:用于,显示控制
package com.logcd.wicket.list;
import org.apache.wicket.markup.html.navigation.paging.IPageable; import
org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider; import
org.apache.wicket.markup.html.navigation.paging.PagingNavigation;
public class PagingSetting extends PagingNavigation { private static final long serialVersionUID = 1; @SuppressWarnings(\ private IPageable arg1 = null; private Navigator style = null; public PagingSetting(String arg0, IPageable arg1, IPagingLabelProvider arg2, Navigator style) { super(arg0, arg1, arg2); this.arg1 = arg1; this.style = style; this.setViewSize(5); } @Override protected void onModelChanged() { super.onModelChanged(); style.get(\ style.get(\ style.get(\ style.get(\ if (arg1.getCurrentPage() < 2) { style.get(\ } if (arg1.getCurrentPage() < 1) {
style.get(\ } if (arg1.getCurrentPage() > arg1.getPageCount() - 2) { style.get(\ } if (arg1.getCurrentPage() > arg1.getPageCount() - 3) { style.get(\ } } }
3.Navigator.html
|