Class PageableListView<T>

    • Constructor Detail

      • PageableListView

        public PageableListView​(java.lang.String id,
                                IModel<? extends java.util.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​(java.lang.String id,
                                java.util.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.
      • setStartIndex

        public ListView<T> setStartIndex​(int startIndex)
                                  throws java.lang.UnsupportedOperationException
        Prevent users from accidentally using it.
        Overrides:
        setStartIndex in class ListView<T>
        Parameters:
        startIndex - First index of model object's list to display
        Returns:
        This
        Throws:
        java.lang.UnsupportedOperationException - always
        See Also:
        ListView.setStartIndex(int)
      • setViewSize

        public ListView<T> setViewSize​(int size)
                                throws java.lang.UnsupportedOperationException
        Prevent users from accidentally using it.
        Overrides:
        setViewSize in class ListView<T>
        Parameters:
        size - the view size
        Returns:
        This
        Throws:
        java.lang.UnsupportedOperationException - always
        See Also:
        ListView.setStartIndex(int)