Class PageableListView<T>

    • Constructor Detail

      • PageableListView

        public PageableListView​(String id,
                                IModel<? extends List<T>> model,
                                long itemsPerPage)
        Constructor
        Parameters:
        id - See Component
        model - See Component
        itemsPerPage - Number of rows to show on a page
      • PageableListView

        public PageableListView​(String id,
                                List<T> list,
                                long itemsPerPage)
        Creates a pageable list view having the given number of rows per page that uses the provided object as a simple model.
        Parameters:
        id - See Component
        list - See Component
        itemsPerPage - Number of rows to show on a page
        See Also:
        ListView(String, List)
    • Method Detail

      • getCurrentPage

        public final long getCurrentPage()
        Gets the index of the current page being displayed by this list view.
        Specified by:
        getCurrentPage in interface IPageable
        Returns:
        Returns the currentPage.
      • getPageCount

        public final long getPageCount()
        Gets the number of pages in this list view.
        Specified by:
        getPageCount in interface IPageable
        Returns:
        The number of pages in this list view
      • getItemsPerPage

        public final long getItemsPerPage()
        Gets the maximum number of rows on each page.
        Specified by:
        getItemsPerPage in interface IPageableItems
        Returns:
        the maximum number of rows on each page.
      • setItemsPerPage

        public final void setItemsPerPage​(long itemsPerPage)
        Sets the maximum number of rows on each page.
        Specified by:
        setItemsPerPage in interface IPageableItems
        Parameters:
        itemsPerPage - the maximum number of rows on each page.
      • getFirstItemOffset

        public long getFirstItemOffset()
        Returns:
        offset of first item
      • getViewSize

        public int getViewSize()
        Description copied from class: ListView
        Based on the model object's list size, firstIndex and view size, determine what the view size really will be. E.g. default for viewSize is Integer.MAX_VALUE, if not set via setViewSize(). If the underlying list has 10 elements, the value returned by getViewSize() will be 10 if startIndex = 0.
        Overrides:
        getViewSize in class ListView<T>
        Returns:
        The number of items to be populated and rendered.
        See Also:
        ListView.getViewSize()
      • setCurrentPage

        public final void setCurrentPage​(long currentPage)
        Sets the current page that this list view should show.
        Specified by:
        setCurrentPage in interface IPageable
        Parameters:
        currentPage - The currentPage to set.