List of usage examples for org.apache.wicket.markup.html.navigation.paging PagingNavigationLink PagingNavigationLink
public PagingNavigationLink(final String id, final IPageable pageable, final long pageNumber)
From source file:com.eltiland.ui.common.components.navigator.PagingNavigator.java
License:Apache License
/** * Create a new pagenumber link. May be subclassed to make use of specialized links, e.g. * Ajaxian links./*ww w.ja v a 2 s.c o m*/ * * @param id the link id * @param pageable the pageable to control * @param pageNumber the page to jump to * @return the pagenumber link */ protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { return new PagingNavigationLink<Void>(id, pageable, pageNumber); }
From source file:com.marc.lastweek.web.components.paginator.VerticalFancyPaginator.java
License:Open Source License
public VerticalFancyPaginator(String id, final IPageable pageableList) { super(id);/*from w ww .java 2s .co m*/ this.setOutputMarkupId(true); System.out.println("current: " + pageableList.getCurrentPage()); WebMarkupContainer paginatorBox = new WebMarkupContainer("paginatorBox") { private static final long serialVersionUID = -8245214604885147260L; @Override public boolean isVisible() { return pageableList.getPageCount() > 1; } }; this.add(paginatorBox); PagingNavigationLink firstPageLink = new PagingNavigationLink("firstPageLink", pageableList, 0); paginatorBox.add(firstPageLink); PagingNavigationLink lastPageLink = new PagingNavigationLink("lastPageLink", pageableList, pageableList.getPageCount() - 1); lastPageLink.add(new Label("lastPageLabel", new Model(Integer.valueOf(pageableList.getPageCount())))); paginatorBox.add(lastPageLink); // Before current page WebMarkupContainer beforeCurrenPageItem = new WebMarkupContainer("beforeCurrentPageItem") { private static final long serialVersionUID = -5876391261093967497L; @Override public boolean isVisible() { return pageableList.getCurrentPage() >= 2; } }; beforeCurrenPageItem.setOutputMarkupPlaceholderTag(true); PagingNavigationIncrementLink beforeCurrentPageLink = new PagingNavigationIncrementLink( "beforeCurrentPageLink", pageableList, -1); beforeCurrentPageLink.add(new Label("beforeCurrentPageLabel", new LoadableDetachableModel() { private static final long serialVersionUID = -3157979806031118522L; @Override protected Object load() { return Integer.valueOf(pageableList.getCurrentPage()); } })); beforeCurrenPageItem.add(beforeCurrentPageLink); paginatorBox.add(beforeCurrenPageItem); // Current page WebMarkupContainer currenPageItem = new WebMarkupContainer("currentPageItem") { private static final long serialVersionUID = -9186596865047783422L; @Override public boolean isVisible() { return pageableList.getCurrentPage() >= 1 && pageableList.getCurrentPage() != pageableList.getPageCount() - 1; } }; currenPageItem.setOutputMarkupPlaceholderTag(true); currenPageItem.add(new Label("currentPageLabel", new LoadableDetachableModel() { private static final long serialVersionUID = 393829273382282502L; @Override protected Object load() { return Integer.valueOf(pageableList.getCurrentPage() + 1); } })); paginatorBox.add(currenPageItem); // After CurrentPage WebMarkupContainer afterCurrenPageItem = new WebMarkupContainer("afterCurrentPageItem") { private static final long serialVersionUID = 7079913736005869990L; @Override public boolean isVisible() { return pageableList.getCurrentPage() < (pageableList.getPageCount() - 2); } }; afterCurrenPageItem.setOutputMarkupPlaceholderTag(true); PagingNavigationIncrementLink afterCurrentPageLink = new PagingNavigationIncrementLink( "afterCurrentPageLink", pageableList, 1); afterCurrentPageLink.add(new Label("afterCurrentPageLabel", new LoadableDetachableModel() { private static final long serialVersionUID = 8932718471553075655L; @Override protected Object load() { return Integer.valueOf(pageableList.getCurrentPage() + 2); } })); afterCurrenPageItem.add(afterCurrentPageLink); paginatorBox.add(afterCurrenPageItem); // Two After CurrentPage WebMarkupContainer twoAfterCurrenPageItem = new WebMarkupContainer("twoAfterCurrentPageItem") { private static final long serialVersionUID = 572789655450253585L; @Override public boolean isVisible() { return pageableList.getCurrentPage() < (pageableList.getPageCount() - 3); } }; twoAfterCurrenPageItem.setOutputMarkupPlaceholderTag(true); PagingNavigationIncrementLink twoAfterCurrentPageLink = new PagingNavigationIncrementLink( "twoAfterCurrentPageLink", pageableList, 2); twoAfterCurrentPageLink.add(new Label("twoAfterCurrentPageLabel", new LoadableDetachableModel() { private static final long serialVersionUID = 8932718471553075655L; @Override protected Object load() { return Integer.valueOf(pageableList.getCurrentPage() + 3); } })); twoAfterCurrenPageItem.add(twoAfterCurrentPageLink); paginatorBox.add(twoAfterCurrenPageItem); // Previous and next links WebMarkupContainer previousPageItem = new WebMarkupContainer("previousPageItem") { private static final long serialVersionUID = -5827228260699397983L; @Override public boolean isVisible() { return pageableList.getCurrentPage() > 0; } }; previousPageItem.add(new PagingNavigationIncrementLink("previousPageLink", pageableList, -1)); previousPageItem.setOutputMarkupPlaceholderTag(true); paginatorBox.add(previousPageItem); WebMarkupContainer nextPageItem = new WebMarkupContainer("nextPageItem") { private static final long serialVersionUID = -5827228260699397983L; @Override public boolean isVisible() { return pageableList.getCurrentPage() < (pageableList.getPageCount() - 1); } }; nextPageItem.add(new PagingNavigationIncrementLink("nextPageLink", pageableList, 1)); nextPageItem.setOutputMarkupPlaceholderTag(true); paginatorBox.add(nextPageItem); }
From source file:com.norconex.commons.wicket.bootstrap.table.BootstrapPagingNavigator.java
License:Apache License
@Override protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { ExternalLink navCont = new ExternalLink(id + "Cont", (String) null); // add css for enable/disable link long pageIndex = pageable.getCurrentPage() + pageNumber; navCont.add(new AttributeModifier("class", new BootstrapPageLinkCssModel(pageable, pageIndex, "disabled"))); // change original wicket-link, so that it always generates href navCont.add(new PagingNavigationLink<Void>(id, pageable, pageNumber)); return navCont; }
From source file:net.unit8.longadeseo.page.HomePage.java
License:Apache License
public HomePage() { add(new Label("pageTitle", "Top")); Form<ValueMap> form = new SearchForm("searchForm"); form.setMarkupId("searchform"); add(form);/* w w w . j av a 2s. c om*/ final PageableListView<SearchResultDto> listView = new PageableListView<SearchResultDto>("results", results, 5) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<SearchResultDto> item) { SearchResultDto row = item.getModelObject(); item.add(new Label("excerpt", row.getExcerpt()).setEscapeModelStrings(false)); ExternalLink link = new ExternalLink("titleLink", WebApplication.get().getServletContext().getContextPath() + "/repository/default" + row.getPath()); link.add(new Label("title", row.getTitle())); item.add(link); item.add(new Label("size", String.valueOf(Math.round(Math.ceil(row.getSize() / 1000d))) + "k")); item.add(new Label("lastModified", df.format(row.getLastModified().getTime()))); item.add(new Label("path", row.getPath())); } }; add(listView); add(new PagingNavigation("navigation", listView) { private static final long serialVersionUID = 1L; @Override protected void populateItem(LoopItem loopItem) { final int page = loopItem.getIndex(); final PagingNavigationLink<Label> link = new PagingNavigationLink<Label>("pageLink", listView, page); if (page > 0) { loopItem.add(new Label("separator", "|")); } else { loopItem.add(new Label("separator", "")); } link.add(new Label("pageNumber", String.valueOf(page + 1))); loopItem.add(link); } }); }