Interface Pagination


public interface Pagination
Paginates a list of items across a region of slots. Obtain via ViewContents.pagination(), configure the region and items, then navigate; every change re-renders the region automatically.
contents.pagination()
    .slots(layout, 'p')
    .items(shopEntries);
  • Method Summary

    Modifier and Type
    Method
    Description
    Jumps to the first page.
    boolean
    True when on the first page.
    boolean
    True when on the last page.
    Sets (or replaces) the items to paginate.
    int
    Number of slots per page (the size of the configured region).
    Jumps to the last page.
    Advances one page if possible.
    open(int page)
    Jumps to a page (clamped to the valid range) and re-renders.
    int
    Current zero-based page.
    int
    Total number of pages (at least 1, even with no items).
    Goes back one page if possible.
    void
    Re-renders the current page into the region (e.g. after external changes).
    slots(int... slots)
    Sets the unique slots the items flow into, in the given order.
    slots(Layout layout, char character)
    Sets the region to all slots marked with character in layout.
  • Method Details

    • slots

      Pagination slots(int... slots)
      Sets the unique slots the items flow into, in the given order. Resets to page 0.
      Throws:
      IllegalArgumentException - if a slot is out of range or duplicated
    • slots

      Pagination slots(Layout layout, char character)
      Sets the region to all slots marked with character in layout.
    • items

      Pagination items(List<ViewItem> items)
      Sets (or replaces) the items to paginate. Re-renders and clamps the current page.
    • page

      int page()
      Current zero-based page.
    • pageCount

      int pageCount()
      Total number of pages (at least 1, even with no items).
    • itemsPerPage

      int itemsPerPage()
      Number of slots per page (the size of the configured region).
    • isFirst

      boolean isFirst()
      True when on the first page.
    • isLast

      boolean isLast()
      True when on the last page.
    • open

      Pagination open(int page)
      Jumps to a page (clamped to the valid range) and re-renders.
    • next

      Pagination next()
      Advances one page if possible.
    • previous

      Pagination previous()
      Goes back one page if possible.
    • first

      Pagination first()
      Jumps to the first page.
    • last

      Pagination last()
      Jumps to the last page.
    • render

      void render()
      Re-renders the current page into the region (e.g. after external changes).