Interface Pagination<P>

Type Parameters:
P - Type of the underlying page props
All Known Implementing Classes:
DefaultPagination

public interface Pagination<P>
A pagination is used to include multiple sub-frames (pages) inside a single frame
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds shared data to this pagination.
    void
    Closes this pagination
    void
    Finishes the initialization of this pagination.
    void
    Adds prioritized shared components to this pagination.
    default void
    Composes shared packed composable data for this pagination.
    void
    composeShared(@NotNull ComposableSpace space, @NotNull Composable composable)
    Adds shared component to this pagination.
    createPage(int page, @Nullable String title, P props)
    Creates a single page frame
    default Frame
    createPage(@Nullable String title, P props)
    Creates a frame with props and title
    default Frame
    createPage(P props)
    Creates a frame with props
    int
    Gets the zero-based index of currently open page
    void
    enable(Frame currentFrame)
    Enables pagination for current frame.
    getPage(int page)
    Gets the page with provided number
    default void
    nextPage(org.bukkit.entity.Player viewer)
    Switches to the next page for the viewer
    int
    Increments atomic counter and returns the index of the next page
    void
    open(org.bukkit.entity.Player player)
    Opens this pagination to player
    int
    Gets the current count of pages
    @Nullable Frame
    Peeks the previous frame in this pagination
    default void
    previousPage(org.bukkit.entity.Player viewer)
    Switches to the previous page for the viewer
    void
    setPage(int page)
    Sets current page number
    void
    switchPage(org.bukkit.entity.Player viewer, int to)
    Switches page for viewer to certain index
  • Method Details

    • createPage

      Frame createPage(int page, @Nullable @Nullable String title, @NotNull P props)
      Creates a single page frame
      Parameters:
      page - Number of the page
      title - Title of the page
      props - Props passed to the page
      Returns:
      Constructed page
    • getPage

      Frame getPage(int page)
      Gets the page with provided number
      Parameters:
      page - Number of the page
      Returns:
      Found page
    • setPage

      void setPage(int page)
      Sets current page number
      Parameters:
      page - New page number
    • nextPageIdx

      int nextPageIdx()
      Increments atomic counter and returns the index of the next page
      Returns:
      Zero-based index of the next page
    • pageCount

      int pageCount()
      Gets the current count of pages
      Returns:
      Current count of pages
    • currentPage

      int currentPage()
      Gets the zero-based index of currently open page
      Returns:
      Zero-based index of currently open page
    • enable

      void enable(Frame currentFrame)
      Enables pagination for current frame. Partially internal method
      Parameters:
      currentFrame - Frame to be used
    • switchPage

      void switchPage(org.bukkit.entity.Player viewer, int to)
      Switches page for viewer to certain index
      Parameters:
      viewer - Viewer of this pagination
      to - Zero-based index of page to change to
    • open

      void open(org.bukkit.entity.Player player)
      Opens this pagination to player
      Parameters:
      player - Player for whom to open this pagination
    • close

      void close()
      Closes this pagination
    • peekPrevious

      @Nullable @Nullable Frame peekPrevious()
      Peeks the previous frame in this pagination
      Returns:
      Previous frame or null
    • addSharedData

      void addSharedData(Map<ComposableSpace,Composable> packed)
      Adds shared data to this pagination. Shared components will be injected at the initialization of page frames
      Parameters:
      packed - Data to be added
    • composeShared

      void composeShared(@NotNull @NotNull ComposableSpace space, @NotNull @NotNull Composable composable)
      Adds shared component to this pagination. Shared components will be injected at the initialization of page frames
      Parameters:
      space - Space of the composed data
      composable - Composable to be added
    • composePrioritizedShared

      void composePrioritizedShared(@NotNull @NotNull Callable<PackedComposable> packed)
      Adds prioritized shared components to this pagination. Shared components will be injected at the initialization of page frames
      Parameters:
      packed - Producer for the packed composable. It will be called lazily.
    • commit

      void commit()
      Finishes the initialization of this pagination. After this method call composeShared(space.maxus.flare.ui.space.ComposableSpace, space.maxus.flare.ui.Composable), etc. will not have any effect.
    • createPage

      default Frame createPage(@NotNull P props)
      Creates a frame with props
      Parameters:
      props - Props for the frame
      Returns:
      Constructed page frame
    • createPage

      default Frame createPage(@Nullable @Nullable String title, @NotNull P props)
      Creates a frame with props and title
      Parameters:
      props - Props for the frame
      title - Title of the frame
      Returns:
      Constructed page frame
    • nextPage

      default void nextPage(org.bukkit.entity.Player viewer)
      Switches to the next page for the viewer
      Parameters:
      viewer - Viewer observing this pagination
    • previousPage

      default void previousPage(org.bukkit.entity.Player viewer)
      Switches to the previous page for the viewer
      Parameters:
      viewer - Viewer observing this pagination
    • composeShared

      default void composeShared(@NotNull @NotNull PackedComposable packed)
      Composes shared packed composable data for this pagination. Shared components will be injected at the initialization of page frames
      Parameters:
      packed - Packed composable to be composed