java.lang.Object
org.jline.prompt.impl.DefaultListBuilder
- All Implemented Interfaces:
BaseBuilder<ListBuilder>,ListBuilder
Default implementation of ListBuilder.
This is now the native implementation that doesn't depend on console-ui.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultListBuilder(PromptBuilder parent) Create a new DefaultListBuilder with the given parent. -
Method Summary
Modifier and TypeMethodDescriptionadd()Add the current item to the list.Add this prompt to the parent builder and return to the parent.voidaddSeparator(SeparatorItem separatorItem) Add a separator item to the list.disabled(boolean disabled) Set whether the current item is disabled.disabledText(String disabledText) Set the disabled text for the current item.Set a filter function that modifies the actual returned value.filterable(boolean filterable) Set whether the list supports inline text filtering.Set the footer text for the current item.Set the message to display to the user.Set the name of this prompt.Create a new item with the given ID.Create a new separator with no text.newSeparator(String text) Create a new separator with the given text.pageSize(int pageSize) Set the page size for pagination.showPageIndicator(boolean showPageIndicator) Set whether to show page indicators.Set the text for the current item.transformer(Function<String, String> transformer) Set a transformer function that modifies how the answer is displayed after submission.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jline.prompt.ListBuilder
add, add, add
-
Constructor Details
-
DefaultListBuilder
Create a new DefaultListBuilder with the given parent.- Parameters:
parent- the parent builder
-
-
Method Details
-
name
Set the name of this prompt.- Specified by:
namein interfaceBaseBuilder<ListBuilder>- Parameters:
name- the name- Returns:
- this builder
-
message
Set the message to display to the user.- Specified by:
messagein interfaceBaseBuilder<ListBuilder>- Parameters:
message- the message- Returns:
- this builder
-
newItem
Create a new item with the given ID.- Specified by:
newItemin interfaceListBuilder- Parameters:
id- the ID- Returns:
- this builder
-
text
Set the text for the current item.- Specified by:
textin interfaceListBuilder- Parameters:
text- the text- Returns:
- this builder
-
disabled
Set whether the current item is disabled.- Specified by:
disabledin interfaceListBuilder- Parameters:
disabled- whether the item is disabled- Returns:
- this builder
-
disabledText
Set the disabled text for the current item.- Specified by:
disabledTextin interfaceListBuilder- Parameters:
disabledText- the disabled text- Returns:
- this builder
-
add
Add the current item to the list.- Specified by:
addin interfaceListBuilder- Returns:
- this builder
-
filterable
Description copied from interface:ListBuilderSet 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.- Specified by:
filterablein interfaceListBuilder- Parameters:
filterable- true to enable filtering, false to disable- Returns:
- this builder
-
pageSize
Description copied from interface:ListBuilderSet the page size for pagination.- Specified by:
pageSizein interfaceListBuilder- Parameters:
pageSize- the page size, or 0 for no pagination- Returns:
- this builder
-
showPageIndicator
Description copied from interface:ListBuilderSet whether to show page indicators.- Specified by:
showPageIndicatorin interfaceListBuilder- Parameters:
showPageIndicator- true to show page indicators- Returns:
- this builder
-
newSeparator
Description copied from interface:ListBuilderCreate a new separator with no text.- Specified by:
newSeparatorin interfaceListBuilder- Returns:
- a separator builder
-
newSeparator
Description copied from interface:ListBuilderCreate a new separator with the given text.- Specified by:
newSeparatorin interfaceListBuilder- Parameters:
text- the separator text- Returns:
- a separator builder
-
addSeparator
Add a separator item to the list.- Parameters:
separatorItem- the separator item to add
-
transformer
Description copied from interface:BaseBuilderSet 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:
transformerin interfaceBaseBuilder<ListBuilder>- Parameters:
transformer- the transformer function- Returns:
- this builder instance for method chaining
-
filter
Description copied from interface:BaseBuilderSet 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:
filterin interfaceBaseBuilder<ListBuilder>- Parameters:
filter- the filter function- Returns:
- this builder instance for method chaining
-
addPrompt
Add this prompt to the parent builder and return to the parent.- Specified by:
addPromptin interfaceBaseBuilder<ListBuilder>- Returns:
- the parent prompt builder
- See Also:
-