Package tripleplay.ui

Class PagedMenu

All Implemented Interfaces:
Iterable<Element<?>>

public class PagedMenu extends Menu
A menu that is also capable of showing one page of its items at a time. Note that the caller must connect buttons or sliders or some other UI elements within the menu to perform paging.

Note that this implementation assumes items are added in order of their page. Removal and of items and addition of items to the end of the last page is naturally supported.

TODO: support insertion of items in the middle of a page
  • Field Details

    • itemsPerPage

      public final int itemsPerPage
      Number of items on a page is constant.
  • Constructor Details

    • PagedMenu

      public PagedMenu(Layout layout, int itemsPerPage)
      Creates a new paged menu with the given layout and number of items per page.
  • Method Details

    • page

      public react.ValueView<Integer> page()
      Gets a view of the current page value.
    • numPages

      public react.ValueView<Integer> numPages()
      Gets a view of the number of pages value.
    • pageSlot

      public react.Slot<Integer> pageSlot()
      Gets a slot that will update the page when emitted.
    • incrementPage

      public react.UnitSlot incrementPage(int delta)
      Gets a slot that will increment the page by the given delta when emitted.
    • getPage

      public int getPage()
      Gets the current page.
    • setPage

      public PagedMenu setPage(int page)
      Sets the current page. Items on the page are shown. All others are hidden.