Class Paginator

All Implemented Interfaces:
Iterable<AlbumObject>, Collection<AlbumObject>

public class Paginator extends AbstractCollection<AlbumObject>
Simplify iterating over groups ("pages") of album objects of current folder The various counter methods (size(), totalPages(), totalSize()) reflects the various filters set up. This class uses a "fluent" API, returning itself in a modified state. Use reset() to reset it to initial state. Will always ignore excluded and hidden objects

An instance of this class is available via the "children" variable during processing of index.htt and within jAlbum's system console.

Since:
33
  • Constructor Details

    • Paginator

      public Paginator(AlbumBean engine, AlbumObject currentFolder)
    • Paginator

      public Paginator(Paginator original)
      Create a copy
      Parameters:
      original -
  • Method Details

    • page

      public Paginator page(int page)
      Set current page to iterate over, starting with 0. Set to -1 to iterate over all pages
      Parameters:
      page -
      Returns:
      new Paginator specific for this page
    • getPage

      public int getPage()
      Returns:
      Current page or -1 if no paging has been set
    • size

      public int size()
      Specified by:
      size in interface Collection<AlbumObject>
      Specified by:
      size in class AbstractCollection<AlbumObject>
      Returns:
      Number of items in current page
    • totalSize

      public int totalSize()
      Returns:
      Total number of items in current folder
    • totalPages

      public int totalPages()
      Returns:
      Total number of pages in current folder
    • getItemsPerPage

      public int getItemsPerPage()
    • include

      public Paginator include(Category... cats)
      Include one or several categories. As soon as one category added, other categories are excluded
      Parameters:
      cats -
      Returns:
    • exclude

      public Paginator exclude(Category... cats)
      Exclude one or several categories
      Parameters:
      cats -
      Returns:
    • include

      public Paginator include(String... types)
      Include one or several file types. As soon as one file type is added, other file types are excluded
      Parameters:
      types -
      Returns:
      Since:
      33.2
    • exclude

      public Paginator exclude(String... types)
      Exclude one or several file types
      Parameters:
      types -
      Returns:
      Since:
      33.2
    • dirs

      public Paginator dirs()
      Include directories only (convenience for include(Category.folder))
      Returns:
    • nodirs

      public Paginator nodirs()
      Exclude directories (convenience for exclude(Category.folder))
      Returns:
    • thumbnails

      public Paginator thumbnails()
      Convenience to exclude directories, pages and web locations
      Returns:
    • filter

      public Paginator filter(Predicate<AlbumObject> filter)
      Add a custom filter
      Parameters:
      filter -
      Returns:
    • reset

      public Paginator reset()
      Reset Paginator to initial state
      Returns:
    • iterator

      public Iterator<AlbumObject> iterator()
      Specified by:
      iterator in interface Collection<AlbumObject>
      Specified by:
      iterator in interface Iterable<AlbumObject>
      Specified by:
      iterator in class AbstractCollection<AlbumObject>