Class SelectInput<T>

java.lang.Object
org.strassburger.tui4j.input.Input<T,SelectInput<T>>
org.strassburger.tui4j.input.SelectInput<T>
Type Parameters:
T - The type of the value that will be returned when the user selects an option

public class SelectInput<T> extends Input<T,SelectInput<T>>
  • Constructor Details

  • Method Details

    • read

      public T read() throws InputValidationException
      Description copied from class: Input
      Read the input value
      Specified by:
      read in class Input<T,SelectInput<T>>
      Returns:
      the input value
      Throws:
      InputValidationException - if the input is invalid and retryOnInvalid is false
    • addOption

      public SelectInput<T> addOption(String label, T value)
      Adds an option to the select input
      Parameters:
      label - The label that will be displayed to the user
      value - The value that will be returned when the user selects this option
      Returns:
      The select input object
    • addOptions

      public SelectInput<T> addOptions(List<SelectInput.Option<T>> options)
      Adds multiple options to the select input
      Parameters:
      options - The options to add
      Returns:
      The select input object
    • setOptionsStyle

      public SelectInput<T> setOptionsStyle(StyledText optionsStyle)
      Sets the style of the options
      Parameters:
      optionsStyle - The style of the options (%num% will be replaced with the number of the option, %label% will be replaced with the label of the option)
      Returns:
      The select input object
    • setOptionsStyle

      public SelectInput<T> setOptionsStyle(String optionsStyle)
      Sets the style of the options
      Parameters:
      optionsStyle - The style of the options (%num% will be replaced with the number of the option, %label% will be replaced with the label of the option)
      Returns:
      The select input object