List of usage examples for org.apache.wicket.util.cookies CookieUtils CookieUtils
public CookieUtils()
From source file:org.xaloon.wicket.component.navigation.DecoratedPagingNavigatorContainer.java
License:Apache License
/** * @param dataView//from w w w . j a v a 2 s . c o m * @param isNavigatorVisible */ public void addAbstractPageableView(AbstractPageableView<T> dataView, boolean isNavigatorVisible) { if (dataView == null) { setVisible(false); return; } // Get selected items page from cookie String cookieValue = new CookieUtils().load(DecoratedPagingNavigator.ITEMS_PER_PAGE_COOKIE); Long defaultItemsPerPage = DecoratedPagingNavigator.ITEMS_PER_PAGE_COUNT_20; if (cookieValue != null && StringUtils.isNumeric(cookieValue)) { defaultItemsPerPage = new Long(cookieValue); } dataView.setItemsPerPage(defaultItemsPerPage); setVisible(dataView.getItemCount() > 0); // Add data view setDefaultModel(new Model<AbstractPageableView<T>>(dataView)); // Add bookmarkable navigator if (currentLink != null) { int currentPage; // Select current page currentPage = getCurrentPage(); dataView.setCurrentPage(currentPage); BookmarkablePagingNavigator bookmarkablePagingNavigator = new BookmarkablePagingNavigator("navigator", dataView, currentLink); addOrReplace(bookmarkablePagingNavigator); bookmarkablePagingNavigator.setVisible(isNavigatorVisible); } add(dataView); }