-
- All Superinterfaces:
BaseBuilder<CheckboxBuilder>
- All Known Implementing Classes:
DefaultCheckboxBuilder
public interface CheckboxBuilder extends BaseBuilder<CheckboxBuilder>
Builder for checkbox prompts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CheckboxBuilderadd()Add the current item to the list.default CheckboxBuilderadd(java.lang.String name, java.lang.String text)Convenience method to add a simple checkbox item with name and text.default CheckboxBuilderadd(java.lang.String name, java.lang.String text, boolean checked)Convenience method to add a simple checkbox item with name, text, and checked state.default CheckboxBuilderadd(java.lang.String name, java.lang.String text, boolean checked, boolean disabled)Convenience method to add a checkbox item with all options.CheckboxBuilderchecked(boolean checked)Set whether the current item is checked.CheckboxBuilderdisabled(boolean disabled)Set whether the current item is disabled.CheckboxBuilderdisabledText(java.lang.String disabledText)Set the disabled text for the current item.CheckboxBuilderfilterable(boolean filterable)Set whether the checkbox list supports inline text filtering.default CheckboxBuilderfooter(java.lang.String footer)Set the footer text for the current item.default CheckboxBuildermaxSelections(int max)Set the maximum number of items that can be selected.default CheckboxBuilderminSelections(int min)Set the minimum number of items that must be selected.CheckboxBuildernewItem(java.lang.String id)Create a new item with the given ID.CheckboxSeparatorBuildernewSeparator()Create a new separator with no text.CheckboxSeparatorBuildernewSeparator(java.lang.String text)Create a new separator with the given text.CheckboxBuilderpageSize(int pageSize)Set the page size for pagination.CheckboxBuildershowPageIndicator(boolean showPageIndicator)Set whether to show page indicators.CheckboxBuildertext(java.lang.String text)Set the text for the current item.-
Methods inherited from interface org.jline.prompt.BaseBuilder
addPrompt, filter, message, name, transformer
-
-
-
-
Method Detail
-
newItem
CheckboxBuilder newItem(java.lang.String id)
Create a new item with the given ID.- Parameters:
id- the ID- Returns:
- this builder
-
text
CheckboxBuilder text(java.lang.String text)
Set the text for the current item.- Parameters:
text- the text- Returns:
- this builder
-
checked
CheckboxBuilder checked(boolean checked)
Set whether the current item is checked.- Parameters:
checked- whether the item is checked- Returns:
- this builder
-
disabled
CheckboxBuilder disabled(boolean disabled)
Set whether the current item is disabled.- Parameters:
disabled- whether the item is disabled- Returns:
- this builder
-
disabledText
CheckboxBuilder disabledText(java.lang.String disabledText)
Set the disabled text for the current item.- Parameters:
disabledText- the disabled text- Returns:
- this builder
-
footer
default CheckboxBuilder footer(java.lang.String footer)
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.- Parameters:
footer- the footer text, ornull/empty for none- Returns:
- this builder
-
add
CheckboxBuilder add()
Add the current item to the list.- Returns:
- this builder
-
add
default CheckboxBuilder add(java.lang.String name, java.lang.String text)
Convenience method to add a simple checkbox item with name and text.- Parameters:
name- the item name/idtext- the display text- Returns:
- this builder
-
add
default CheckboxBuilder add(java.lang.String name, java.lang.String text, boolean checked)
Convenience method to add a simple checkbox item with name, text, and checked state.- Parameters:
name- the item name/idtext- the display textchecked- whether the item is initially checked- Returns:
- this builder
-
add
default CheckboxBuilder add(java.lang.String name, java.lang.String text, boolean checked, boolean disabled)
Convenience method to add a checkbox item with all options.- Parameters:
name- the item name/idtext- the display textchecked- whether the item is initially checkeddisabled- whether the item is disabled- Returns:
- this builder
-
filterable
CheckboxBuilder filterable(boolean filterable)
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.- Parameters:
filterable- true to enable filtering, false to disable- Returns:
- this builder
-
pageSize
CheckboxBuilder pageSize(int pageSize)
Set the page size for pagination.- Parameters:
pageSize- the page size, or 0 for no pagination- Returns:
- this builder
-
showPageIndicator
CheckboxBuilder showPageIndicator(boolean showPageIndicator)
Set whether to show page indicators.- Parameters:
showPageIndicator- true to show page indicators- Returns:
- this builder
-
minSelections
default CheckboxBuilder minSelections(int min)
Set the minimum number of items that must be selected.- Parameters:
min- the minimum number of selections (0 for no minimum)- Returns:
- this builder
-
maxSelections
default CheckboxBuilder maxSelections(int max)
Set the maximum number of items that can be selected.- Parameters:
max- the maximum number of selections (0 for no maximum)- Returns:
- this builder
-
newSeparator
CheckboxSeparatorBuilder newSeparator()
Create a new separator with no text.- Returns:
- a separator builder
-
newSeparator
CheckboxSeparatorBuilder newSeparator(java.lang.String text)
Create a new separator with the given text.- Parameters:
text- the separator text- Returns:
- a separator builder
-
-