List of usage examples for org.apache.wicket.ajax.markup.html.navigation.paging AjaxPagingNavigation AjaxPagingNavigation
public AjaxPagingNavigation(final String id, final IPageable pageable, final IPagingLabelProvider labelProvider)
From source file:au.org.theark.core.web.component.navigator.ArkAjaxPagingNavigator.java
License:Open Source License
@Override protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation("navigation", pageable, labelProvider) { private static final long serialVersionUID = 1456846335814294449L; protected PagingNavigationLink<?> newPagingNavigationLink(String id, IPageable pageable, int pageIndex) { AjaxPagingNavigationLink link = new AjaxPagingNavigationLink(id, pageable, pageIndex) { private static final long serialVersionUID = 1L; @Override//w w w. j ava2 s.co m protected void onInitialize() { super.onInitialize(); add(new AjaxPagingNavigationBehavior(this, pageable, "onclick") { /** * */ private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String onClickEvent = tag.getAttribute("onclick"); if (onClickEvent != null) { tag.put("onclick", dirtyFormJavaScript(onClickEvent)); } } }); } }; return link; } }; }
From source file:com.norconex.commons.wicket.bootstrap.table.BootstrapAjaxPagingNavigator.java
License:Apache License
@Override protected PagingNavigation newNavigation(final String id, final IPageable pageable, final IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation(id, pageable, labelProvider) { private static final long serialVersionUID = -1041791124600426054L; @Override/* ww w.j av a 2s. c o m*/ protected LoopItem newItem(int iteration) { LoopItem item = super.newItem(iteration); // add css for enable/disable link long pageIndex = getStartIndex() + iteration; item.add(new AttributeModifier("class", new BootstrapPageLinkCssModel(pageable, pageIndex, "active"))); return item; } }; }
From source file:com.schat.components.paging.bootstrap.BootstrapPagingNavigator.java
License:Apache License
@Override protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation(id, pageable, labelProvider) { /*@Override//from www. j a va2s. c o m protected LoopItem newItem(int iteration) { LoopItem item = super.newItem(iteration); // add css for enable/disable link long pageIndex = getStartIndex() + iteration; item.add(new AttributeModifier("class", new PagingNavigationCssModel(pageable, pageIndex, "active"))); return item; }*/ }; }
From source file:com.servoy.j2db.server.headlessclient.dataui.ServoyAjaxPagingNavigator.java
License:Open Source License
/** * @see wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator#newNavigation(wicket.markup.html.navigation.paging.IPageable, wicket.markup.html.navigation.paging.IPagingLabelProvider) *///from ww w . j a v a 2s .com @Override protected PagingNavigation newNavigation(IPageable pageable, IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation("navigation", pageable, labelProvider) { private static final long serialVersionUID = 1L; /** * @see wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigation#newPagingNavigationLink(java.lang.String, wicket.markup.html.navigation.paging.IPageable, int) */ @Override protected Link newPagingNavigationLink(String id, IPageable pageable, int pageIndex) { Link rez = new ServoyAjaxPagingNavigationLink(id, pageable, pageIndex); TabIndexHelper.setUpTabIndexAttributeModifier(rez, tabIndex); return rez; } }; }
From source file:dk.teachus.frontend.components.list.ListPanel.java
License:Apache License
private AjaxNavigationToolbar createNavigationToolbar(DataTable<T> dataTable) { return new AjaxNavigationToolbar(dataTable) { private static final long serialVersionUID = 1L; @Override/*from ww w . j ava2s. c o m*/ protected WebComponent newNavigatorLabel(String navigatorId, final DataTable<?> table) { Label label = new Label(navigatorId, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { int of = table.getRowCount(); int from = table.getCurrentPage() * table.getItemsPerPage(); int to = Math.min(of, from + table.getItemsPerPage()); from++; if (of == 0) { from = 0; to = 0; } String label = TeachUsSession.get().getString("ListPanel.navigatorLabel"); label = label.replace("${from}", "" + from); label = label.replace("${to}", "" + to); label = label.replace("${of}", "" + of); return label; } }); label.setRenderBodyOnly(true); return label; } @Override protected PagingNavigator newPagingNavigator(String navigatorId, DataTable<?> table) { return new AjaxPagingNavigator(navigatorId, table) { private static final long serialVersionUID = 1L; @Override protected void onAjaxEvent(final AjaxRequestTarget target) { target.add(getTable()); } @Override protected Link<?> newPagingNavigationLink(String id, IPageable pageable, final int pageNumber) { final Link<?> pagingNavigationLink = super.newPagingNavigationLink(id, pageable, pageNumber); pagingNavigationLink.setBody(Model.of("")); pagingNavigationLink .add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { String cls = "btn btn-mini"; if (pageNumber == 0) { cls += " icon-fast-backward"; } else { cls += " icon-fast-forward"; } if (false == pagingNavigationLink.isEnabled()) { cls += " disabled"; } return cls; } })); return pagingNavigationLink; } @Override protected Link<?> newPagingNavigationIncrementLink(String id, IPageable pageable, final int increment) { final Link<?> pagingNavigationIncrementLink = super.newPagingNavigationIncrementLink(id, pageable, increment); pagingNavigationIncrementLink.setBody(Model.of("")); pagingNavigationIncrementLink .add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { String cls = "btn btn-mini"; if (increment < 0) { cls += " icon-backward"; } else { cls += " icon-forward"; } if (false == pagingNavigationIncrementLink.isEnabled()) { cls += " disabled"; } return cls; } })); return pagingNavigationIncrementLink; } @Override protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation(id, pageable, labelProvider) { private static final long serialVersionUID = 1L; @Override protected Link<?> newPagingNavigationLink(String id, IPageable pageable, int pageIndex) { final Link<?> pagingNavigationLink = super.newPagingNavigationLink(id, pageable, pageIndex); pagingNavigationLink .add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { StringBuilder cls = new StringBuilder(); cls.append("btn btn-mini"); if (false == pagingNavigationLink.isEnabled()) { cls.append(" btn-primary disabled"); } return cls.toString(); } })); return pagingNavigationLink; } }; } }; } }; }
From source file:org.cyclop.web.components.pagination.BootstrapPagingNavigator.java
License:Apache License
@Override protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation(id, pageable, labelProvider) { @Override/* w ww.ja v a2s . com*/ protected LoopItem newItem(int iteration) { LoopItem item = super.newItem(iteration); // add css for enable/disable link long pageIndex = getStartIndex() + iteration; item.add(new AttributeModifier("class", new PagingNavigationCssModel(pageable, pageIndex, "active"))); return item; } }; }
From source file:org.xaloon.wicket.component.navigation.DecoratedPagingNavigatorContainer.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from w w w.java 2s .co m protected void onBeforeRender() { super.onBeforeRender(); // Ajax paginator should be added before render if (currentLink == null) { AbstractPageableView<T> dataView = (AbstractPageableView<T>) getDefaultModelObject(); AjaxPagingNavigator pagingNavigator = new AjaxPagingNavigator("navigator", dataView) { private static final long serialVersionUID = 1L; @Override protected org.apache.wicket.markup.html.navigation.paging.PagingNavigation newNavigation(String id, org.apache.wicket.markup.html.navigation.paging.IPageable pageable, org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider labelProvider) { return new AjaxPagingNavigation(id, pageable, labelProvider) { private static final long serialVersionUID = 1L; @Override protected void populateItem(LoopItem loopItem) { super.populateItem(loopItem); new LinkDecorator().withLoopItem(loopItem).withCurrentPage(pageable.getCurrentPage()) .withStartIndex(getStartIndex()).decorate(); } }; }; }; addOrReplace(pagingNavigator); } }