/** * Gets the link node of the previous page. * * @param page the pagination object * @param contextPath current context path of servlet * @return the node */ private Element getPreviousElement(final Page<?> page, final String contextPath) { final Element result = new Element("li"); String url; if (!page.hasPrevious()) { url = getPagedParams(contextPath, 0, page.getSize()); } else { url = getPagedParams(contextPath, page.getNumber() - 1, page.getSize()); } final Element a = new Element("a"); a.setAttribute("href", url); result.addChild(a); final Element icon = new Element("i"); icon.setAttribute("class", "glyphicon glyphicon-triangle-left"); a.addChild(icon); if (!page.hasPrevious()) { result.setAttribute("class", "disabled"); } return result; }
private void addPreviousLink(Page<T> page, String pageParam, String sizeParam) { if (page.hasPrevious()) { Link link = buildPageLink( pageParam, page.getNumber() - 1, sizeParam, page.getSize(), Link.REL_PREVIOUS); add(link); } }