Package org.strassburger.tui4j.input
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a select option that can be selected by the user -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an option to the select inputaddOptions(List<SelectInput.Option<T>> options) Adds multiple options to the select inputread()Read the input valuesetOptionsStyle(String optionsStyle) Sets the style of the optionssetOptionsStyle(StyledText optionsStyle) Sets the style of the optionsMethods inherited from class org.strassburger.tui4j.input.Input
addValidationRule, addValidationRules, getCursor, getErrorMessage, getLabel, getPrinter, getScanner, isRetryOnInvalid, setCursor, setErrorMessage, setErrorMessage, setLabel, setLabel, setPrinter, setRetryOnInvalid, setScanner, validate
-
Constructor Details
-
SelectInput
public SelectInput() -
SelectInput
-
-
Method Details
-
read
Description copied from class:InputRead the input value- Specified by:
readin classInput<T,SelectInput<T>> - Returns:
- the input value
- Throws:
InputValidationException- if the input is invalid and retryOnInvalid is false
-
addOption
Adds an option to the select input- Parameters:
label- The label that will be displayed to the uservalue- The value that will be returned when the user selects this option- Returns:
- The select input object
-
addOptions
Adds multiple options to the select input- Parameters:
options- The options to add- Returns:
- The select input object
-
setOptionsStyle
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
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
-