Class DefaultCheckboxBuilder

java.lang.Object
org.jline.prompt.impl.DefaultCheckboxBuilder
All Implemented Interfaces:
BaseBuilder<CheckboxBuilder>, CheckboxBuilder

public class DefaultCheckboxBuilder extends Object implements CheckboxBuilder
Default implementation of CheckboxBuilder. This is now the native implementation that doesn't depend on console-ui.
  • Constructor Details

    • DefaultCheckboxBuilder

      public DefaultCheckboxBuilder(PromptBuilder parent)
      Create a new DefaultCheckboxBuilder with the given parent.
      Parameters:
      parent - the parent builder
  • Method Details

    • name

      public CheckboxBuilder name(String name)
      Set the name of this prompt.
      Specified by:
      name in interface BaseBuilder<CheckboxBuilder>
      Parameters:
      name - the name
      Returns:
      this builder
    • message

      public CheckboxBuilder message(String message)
      Set the message to display to the user.
      Specified by:
      message in interface BaseBuilder<CheckboxBuilder>
      Parameters:
      message - the message
      Returns:
      this builder
    • newItem

      public CheckboxBuilder newItem(String id)
      Create a new item with the given ID.
      Specified by:
      newItem in interface CheckboxBuilder
      Parameters:
      id - the ID
      Returns:
      this builder
    • text

      public CheckboxBuilder text(String text)
      Set the text for the current item.
      Specified by:
      text in interface CheckboxBuilder
      Parameters:
      text - the text
      Returns:
      this builder
    • checked

      public CheckboxBuilder checked(boolean checked)
      Set whether the current item is checked.
      Specified by:
      checked in interface CheckboxBuilder
      Parameters:
      checked - whether the item is checked
      Returns:
      this builder
    • disabled

      public CheckboxBuilder disabled(boolean disabled)
      Set whether the current item is disabled.
      Specified by:
      disabled in interface CheckboxBuilder
      Parameters:
      disabled - whether the item is disabled
      Returns:
      this builder
    • disabledText

      public CheckboxBuilder disabledText(String disabledText)
      Set the disabled text for the current item.
      Specified by:
      disabledText in interface CheckboxBuilder
      Parameters:
      disabledText - the disabled text
      Returns:
      this builder
    • footer

      public CheckboxBuilder footer(String footer)
      Description copied from interface: CheckboxBuilder
      Set the footer text for the current item. The footer is shown dimmed below the checkbox list while this item is focused. Newlines split it into multiple lines, and long lines wrap to the terminal width. The footer pane has a fixed height, so the list does not shift between items.
      Specified by:
      footer in interface CheckboxBuilder
      Parameters:
      footer - the footer text, or null/empty for none
      Returns:
      this builder
    • add

      public CheckboxBuilder add()
      Add the current item to the list.
      Specified by:
      add in interface CheckboxBuilder
      Returns:
      this builder
    • filterable

      public CheckboxBuilder filterable(boolean filterable)
      Description copied from interface: CheckboxBuilder
      Set whether the checkbox list supports inline text filtering. When enabled (the default), the user can type characters to filter the displayed items. When disabled, typed characters are ignored.
      Specified by:
      filterable in interface CheckboxBuilder
      Parameters:
      filterable - true to enable filtering, false to disable
      Returns:
      this builder
    • pageSize

      public CheckboxBuilder pageSize(int pageSize)
      Description copied from interface: CheckboxBuilder
      Set the page size for pagination.
      Specified by:
      pageSize in interface CheckboxBuilder
      Parameters:
      pageSize - the page size, or 0 for no pagination
      Returns:
      this builder
    • showPageIndicator

      public CheckboxBuilder showPageIndicator(boolean showPageIndicator)
      Description copied from interface: CheckboxBuilder
      Set whether to show page indicators.
      Specified by:
      showPageIndicator in interface CheckboxBuilder
      Parameters:
      showPageIndicator - true to show page indicators
      Returns:
      this builder
    • minSelections

      public CheckboxBuilder minSelections(int min)
      Description copied from interface: CheckboxBuilder
      Set the minimum number of items that must be selected.
      Specified by:
      minSelections in interface CheckboxBuilder
      Parameters:
      min - the minimum number of selections (0 for no minimum)
      Returns:
      this builder
    • maxSelections

      public CheckboxBuilder maxSelections(int max)
      Description copied from interface: CheckboxBuilder
      Set the maximum number of items that can be selected.
      Specified by:
      maxSelections in interface CheckboxBuilder
      Parameters:
      max - the maximum number of selections (0 for no maximum)
      Returns:
      this builder
    • newSeparator

      public CheckboxSeparatorBuilder newSeparator()
      Description copied from interface: CheckboxBuilder
      Create a new separator with no text.
      Specified by:
      newSeparator in interface CheckboxBuilder
      Returns:
      a separator builder
    • newSeparator

      public CheckboxSeparatorBuilder newSeparator(String text)
      Description copied from interface: CheckboxBuilder
      Create a new separator with the given text.
      Specified by:
      newSeparator in interface CheckboxBuilder
      Parameters:
      text - the separator text
      Returns:
      a separator builder
    • addSeparator

      public void addSeparator(SeparatorItem separatorItem)
      Add a separator item to the list.
      Parameters:
      separatorItem - the separator item to add
    • transformer

      public CheckboxBuilder transformer(Function<String,String> transformer)
      Description copied from interface: BaseBuilder
      Set a transformer function that modifies how the answer is displayed after submission. This does not change the actual returned value. For example, a password prompt might transform the answer to "***".
      Specified by:
      transformer in interface BaseBuilder<CheckboxBuilder>
      Parameters:
      transformer - the transformer function
      Returns:
      this builder instance for method chaining
    • filter

      public CheckboxBuilder filter(Function<String,String> filter)
      Description copied from interface: BaseBuilder
      Set a filter function that modifies the actual returned value. This changes the value stored in the result map. For example, trimming whitespace or converting to lowercase.
      Specified by:
      filter in interface BaseBuilder<CheckboxBuilder>
      Parameters:
      filter - the filter function
      Returns:
      this builder instance for method chaining
    • addPrompt

      public PromptBuilder addPrompt()
      Add this prompt to the parent builder.
      Specified by:
      addPrompt in interface BaseBuilder<CheckboxBuilder>
      Returns:
      the parent PromptBuilder for continued prompt configuration
      See Also: