Class PageBuilder

java.lang.Object
net.tnemc.menu.core.builder.PageBuilder

public class PageBuilder extends Object
Builder class for creating instances of the Page class.
Since:
1.5.0.0
Author:
creatorfromhell
See Also:
  • Field Details

  • Constructor Details

    • PageBuilder

      public PageBuilder(int pageNumber)
  • Method Details

    • withRow

      public PageBuilder withRow(int row, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified row.
      Parameters:
      row - The row index where the icons will be set. Rows are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified row.
    • withColumn

      public PageBuilder withColumn(int menuRows, int column, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified column.
      Parameters:
      menuRows - The number of rows that the menu has.
      column - The column index where the icons will be set. Columns are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified column.
    • withColumn

      public PageBuilder withColumn(int menuRows, int startingRow, int column, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified column.
      Parameters:
      menuRows - The number of rows that the menu has.
      startingRow - The row that the icons should start at, inclusive.
      column - The column index where the icons will be set. Columns are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified column.
    • withColumn

      public PageBuilder withColumn(int menuRows, int startingRow, int endingRow, int column, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified column.
      Parameters:
      menuRows - The number of rows that the menu has.
      startingRow - The row that the icons should start at, inclusive.
      endingRow - The row that the icons should end at, inclusive.
      column - The column index where the icons will be set. Columns are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified column.
    • withIcons

      public PageBuilder withIcons(Icon... icons)
      Adds icons to the page.
      Parameters:
      icons - The icons to be added to the page.
      Returns:
      This PageBuilder instance for method chaining.
    • withClickHandler

      public PageBuilder withClickHandler(Function<MenuClickHandler,Boolean> clickHandler)
      Sets the click handler for the page.
      Parameters:
      clickHandler - The click handler to be set for the page.
      Returns:
      This PageBuilder instance for method chaining.
    • withOpenHandler

      public PageBuilder withOpenHandler(Consumer<PageOpenCallback> open)
      Sets the open handler for the page.
      Parameters:
      open - The click handler to be set for the page.
      Returns:
      This PageBuilder instance for method chaining.
    • build

      public Page build()
      Builds and returns the Page instance based on the provided configuration.
      Returns:
      The constructed Page instance.