-
- All Superinterfaces:
BaseBuilder<ListBuilder>
- All Known Implementing Classes:
DefaultListBuilder
public interface ListBuilder extends BaseBuilder<ListBuilder>
Builder for list prompts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ListBuilderadd()Add the current item to the list.default ListBuilderadd(java.lang.String name, java.lang.String text)Convenience method to add a simple list item with name and text.default ListBuilderadd(java.lang.String name, java.lang.String text, boolean disabled)Convenience method to add a simple list item with name, text, and disabled state.default ListBuilderadd(java.lang.String name, java.lang.String text, boolean disabled, java.lang.String disabledText)Convenience method to add a simple list item with name, text, disabled state, and disabled text.ListBuilderdisabled(boolean disabled)Set whether the current item is disabled.ListBuilderdisabledText(java.lang.String disabledText)Set the disabled text for the current item.ListBuilderfilterable(boolean filterable)Set whether the list supports inline text filtering.default ListBuilderfooter(java.lang.String footer)Set the footer text for the current item.ListBuildernewItem(java.lang.String id)Create a new item with the given ID.ListSeparatorBuildernewSeparator()Create a new separator with no text.ListSeparatorBuildernewSeparator(java.lang.String text)Create a new separator with the given text.ListBuilderpageSize(int pageSize)Set the page size for pagination.ListBuildershowPageIndicator(boolean showPageIndicator)Set whether to show page indicators.ListBuildertext(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
ListBuilder newItem(java.lang.String id)
Create a new item with the given ID.- Parameters:
id- the ID- Returns:
- this builder
-
text
ListBuilder text(java.lang.String text)
Set the text for the current item.- Parameters:
text- the text- Returns:
- this builder
-
disabled
ListBuilder disabled(boolean disabled)
Set whether the current item is disabled.- Parameters:
disabled- whether the item is disabled- Returns:
- this builder
-
disabledText
ListBuilder disabledText(java.lang.String disabledText)
Set the disabled text for the current item.- Parameters:
disabledText- the disabled text- Returns:
- this builder
-
footer
default ListBuilder footer(java.lang.String footer)
Set the footer text for the current item. The footer is shown dimmed below the 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
ListBuilder add()
Add the current item to the list.- Returns:
- this builder
-
add
default ListBuilder add(java.lang.String name, java.lang.String text)
Convenience method to add a simple list item with name and text.- Parameters:
name- the item name/idtext- the display text- Returns:
- this builder
-
add
default ListBuilder add(java.lang.String name, java.lang.String text, boolean disabled)
Convenience method to add a simple list item with name, text, and disabled state.- Parameters:
name- the item name/idtext- the display textdisabled- whether the item is disabled- Returns:
- this builder
-
add
default ListBuilder add(java.lang.String name, java.lang.String text, boolean disabled, java.lang.String disabledText)
Convenience method to add a simple list item with name, text, disabled state, and disabled text.- Parameters:
name- the item name/idtext- the display textdisabled- whether the item is disableddisabledText- the text to show when disabled- Returns:
- this builder
-
filterable
ListBuilder filterable(boolean filterable)
Set whether the 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
ListBuilder pageSize(int pageSize)
Set the page size for pagination.- Parameters:
pageSize- the page size, or 0 for no pagination- Returns:
- this builder
-
showPageIndicator
ListBuilder showPageIndicator(boolean showPageIndicator)
Set whether to show page indicators.- Parameters:
showPageIndicator- true to show page indicators- Returns:
- this builder
-
newSeparator
ListSeparatorBuilder newSeparator()
Create a new separator with no text.- Returns:
- a separator builder
-
newSeparator
ListSeparatorBuilder newSeparator(java.lang.String text)
Create a new separator with the given text.- Parameters:
text- the separator text- Returns:
- a separator builder
-
-