Class ListSelectDialogBuilder<T>


public class ListSelectDialogBuilder<T> extends AbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>
Dialog builder for the ListSelectDialog class, use this to create instances of that class and to customize them
  • Field Details

    • content

      private final List<T> content
    • listBoxSize

      private TerminalSize listBoxSize
    • canCancel

      private boolean canCancel
  • Constructor Details

    • ListSelectDialogBuilder

      public ListSelectDialogBuilder()
      Default constructor
  • Method Details

    • self

      protected ListSelectDialogBuilder<T> self()
      Description copied from class: AbstractDialogBuilder
      Helper method for casting this to type parameter B
      Specified by:
      self in class AbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>
      Returns:
      this as B
    • buildDialog

      protected ListSelectDialog<T> buildDialog()
      Description copied from class: AbstractDialogBuilder
      Builds the dialog according to the builder implementation
      Specified by:
      buildDialog in class AbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>
      Returns:
      New dialog object
    • setListBoxSize

      public ListSelectDialogBuilder<T> setListBoxSize(TerminalSize listBoxSize)
      Sets the size of the list box in the dialog, scrollbars will be used if there is not enough space to draw all items. If set to null, the dialog will ask for enough space to be able to draw all items.
      Parameters:
      listBoxSize - Size of the list box in the dialog
      Returns:
      Itself
    • getListBoxSize

      public TerminalSize getListBoxSize()
      Size of the list box in the dialog or null if the dialog will ask for enough space to draw all items
      Returns:
      Size of the list box in the dialog or null if the dialog will ask for enough space to draw all items
    • setCanCancel

      public ListSelectDialogBuilder<T> setCanCancel(boolean canCancel)
      Sets if the dialog can be cancelled or not (default: true)
      Parameters:
      canCancel - If true, the user has the option to cancel the dialog, if false there is no such button in the dialog
      Returns:
      Itself
    • isCanCancel

      public boolean isCanCancel()
      Returns true if the dialog can be cancelled once it's opened
      Returns:
      true if the dialog can be cancelled once it's opened
    • addListItem

      public ListSelectDialogBuilder<T> addListItem(T item)
      Adds an item to the list box at the end
      Parameters:
      item - Item to add to the list box
      Returns:
      Itself
    • addListItems

      @SafeVarargs public final ListSelectDialogBuilder<T> addListItems(T... items)
      Adds a list of items to the list box at the end, in the order they are passed in
      Parameters:
      items - Items to add to the list box
      Returns:
      Itself
    • getListItems

      public List<T> getListItems()
      Returns a copy of the list of items in the list box
      Returns:
      Copy of the list of items in the list box