List of usage examples for org.apache.wicket.ajax.markup.html.navigation.paging AjaxPagingNavigationLink onClick
@Override public void onClick(AjaxRequestTarget target)
From source file:com.norconex.commons.wicket.bootstrap.table.BootstrapAjaxPagingNavigator.java
License:Apache License
@Override protected AbstractLink newPagingNavigationLink(final String id, IPageable pageable, int pageNumber) { final AjaxPagingNavigationLink link = new AjaxPagingNavigationLink(id, pageable, pageNumber) { private static final long serialVersionUID = -4537725137974552570L; protected long cullPageNumber(long pageNumber) { long idx = pageNumber; if (id.startsWith("first")) { return 0; }/* w ww. j av a2 s . c om*/ if (id.startsWith("last")) { return pageable.getPageCount() - 1; } if (id.startsWith("prev")) { idx = pageable.getCurrentPage() - 1; } else if (id.startsWith("next")) { idx = pageable.getCurrentPage() + 1; } if (idx < 0) { idx = 0; } if (idx > (pageable.getPageCount() - 1)) { idx = pageable.getPageCount() - 1; } if (idx < 0) { idx = 0; } return idx; } }; AjaxLink<String> navCont = new AjaxLink<String>(id + "Cont") { private static final long serialVersionUID = -7566811745303329592L; @Override public void onClick(AjaxRequestTarget target) { link.onClick(target); } }; navCont.add(link); // add css for enable/disable link long pageIndex = pageable.getCurrentPage() + pageNumber; navCont.add(new AttributeModifier("class", new BootstrapPageLinkCssModel(pageable, pageIndex, "disabled"))); return navCont; }
From source file:com.norconex.commons.wicket.bootstrap.table.BootstrapAjaxPagingNavigator.java
License:Apache License
@Override protected AbstractLink newPagingNavigationIncrementLink(final String id, IPageable pageable, int increment) { final AjaxPagingNavigationLink link = new AjaxPagingNavigationLink(id, pageable, increment) { private static final long serialVersionUID = 6737074324471003133L; protected long cullPageNumber(long pageNumber) { long idx = pageNumber; if (id.startsWith("first")) { return 0; }//w ww.ja v a2 s.c om if (id.startsWith("last")) { return pageable.getPageCount() - 1; } if (id.startsWith("prev")) { idx = pageable.getCurrentPage() - 1; } else if (id.startsWith("next")) { idx = pageable.getCurrentPage() + 1; } if (idx < 0) { idx = 0; } if (idx > (pageable.getPageCount() - 1)) { idx = pageable.getPageCount() - 1; } if (idx < 0) { idx = 0; } return idx; } }; AjaxLink<String> navCont = new AjaxLink<String>(id + "Cont") { private static final long serialVersionUID = -7414576817418282720L; @Override public void onClick(AjaxRequestTarget target) { link.onClick(target); } }; navCont.add(link); // add css for enable/disable link long pageIndex = pageable.getCurrentPage() + increment; navCont.add(new AttributeModifier("class", new BootstrapPageLinkIncrementCssModel(pageable, pageIndex))); return navCont; }