- java.lang.Object
-
- org.jline.prompt.impl.DefaultCheckboxBuilder
-
- All Implemented Interfaces:
BaseBuilder<CheckboxBuilder>,CheckboxBuilder
public class DefaultCheckboxBuilder extends java.lang.Object implements CheckboxBuilder
Default implementation of CheckboxBuilder. This is now the native implementation that doesn't depend on console-ui.
-
-
Constructor Summary
Constructors Constructor Description DefaultCheckboxBuilder(PromptBuilder parent)Create a new DefaultCheckboxBuilder with the given parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CheckboxBuilderadd()Add the current item to the list.PromptBuilderaddPrompt()Add this prompt to the parent builder.voidaddSeparator(SeparatorItem separatorItem)Add a separator item to the list.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.CheckboxBuilderfilter(java.util.function.Function<java.lang.String,java.lang.String> filter)Set a filter function that modifies the actual returned value.CheckboxBuilderfilterable(boolean filterable)Set whether the checkbox list supports inline text filtering.CheckboxBuilderfooter(java.lang.String footer)Set the footer text for the current item.CheckboxBuildermaxSelections(int max)Set the maximum number of items that can be selected.CheckboxBuildermessage(java.lang.String message)Set the message to display to the user.CheckboxBuilderminSelections(int min)Set the minimum number of items that must be selected.CheckboxBuildername(java.lang.String name)Set the name of this prompt.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.CheckboxBuildertransformer(java.util.function.Function<java.lang.String,java.lang.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, wait
-
Methods inherited from interface org.jline.prompt.CheckboxBuilder
add, add, add
-
-
-
-
Constructor Detail
-
DefaultCheckboxBuilder
public DefaultCheckboxBuilder(PromptBuilder parent)
Create a new DefaultCheckboxBuilder with the given parent.- Parameters:
parent- the parent builder
-
-
Method Detail
-
name
public CheckboxBuilder name(java.lang.String name)
Set the name of this prompt.- Specified by:
namein interfaceBaseBuilder<CheckboxBuilder>- Parameters:
name- the name- Returns:
- this builder
-
message
public CheckboxBuilder message(java.lang.String message)
Set the message to display to the user.- Specified by:
messagein interfaceBaseBuilder<CheckboxBuilder>- Parameters:
message- the message- Returns:
- this builder
-
newItem
public CheckboxBuilder newItem(java.lang.String id)
Create a new item with the given ID.- Specified by:
newItemin interfaceCheckboxBuilder- Parameters:
id- the ID- Returns:
- this builder
-
text
public CheckboxBuilder text(java.lang.String text)
Set the text for the current item.- Specified by:
textin interfaceCheckboxBuilder- Parameters:
text- the text- Returns:
- this builder
-
checked
public CheckboxBuilder checked(boolean checked)
Set whether the current item is checked.- Specified by:
checkedin interfaceCheckboxBuilder- Parameters:
checked- whether the item is checked- Returns:
- this builder
-
disabled
public CheckboxBuilder disabled(boolean disabled)
Set whether the current item is disabled.- Specified by:
disabledin interfaceCheckboxBuilder- Parameters:
disabled- whether the item is disabled- Returns:
- this builder
-
disabledText
public CheckboxBuilder disabledText(java.lang.String disabledText)
Set the disabled text for the current item.- Specified by:
disabledTextin interfaceCheckboxBuilder- Parameters:
disabledText- the disabled text- Returns:
- this builder
-
footer
public CheckboxBuilder footer(java.lang.String footer)
Description copied from interface:CheckboxBuilderSet 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.- Specified by:
footerin interfaceCheckboxBuilder- Parameters:
footer- the footer text, ornull/empty for none- Returns:
- this builder
-
add
public CheckboxBuilder add()
Add the current item to the list.- Specified by:
addin interfaceCheckboxBuilder- Returns:
- this builder
-
filterable
public CheckboxBuilder filterable(boolean filterable)
Description copied from interface:CheckboxBuilderSet 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.- Specified by:
filterablein interfaceCheckboxBuilder- Parameters:
filterable- true to enable filtering, false to disable- Returns:
- this builder
-
pageSize
public CheckboxBuilder pageSize(int pageSize)
Description copied from interface:CheckboxBuilderSet the page size for pagination.- Specified by:
pageSizein interfaceCheckboxBuilder- Parameters:
pageSize- the page size, or 0 for no pagination- Returns:
- this builder
-
showPageIndicator
public CheckboxBuilder showPageIndicator(boolean showPageIndicator)
Description copied from interface:CheckboxBuilderSet whether to show page indicators.- Specified by:
showPageIndicatorin interfaceCheckboxBuilder- Parameters:
showPageIndicator- true to show page indicators- Returns:
- this builder
-
minSelections
public CheckboxBuilder minSelections(int min)
Description copied from interface:CheckboxBuilderSet the minimum number of items that must be selected.- Specified by:
minSelectionsin interfaceCheckboxBuilder- Parameters:
min- the minimum number of selections (0 for no minimum)- Returns:
- this builder
-
maxSelections
public CheckboxBuilder maxSelections(int max)
Description copied from interface:CheckboxBuilderSet the maximum number of items that can be selected.- Specified by:
maxSelectionsin interfaceCheckboxBuilder- Parameters:
max- the maximum number of selections (0 for no maximum)- Returns:
- this builder
-
newSeparator
public CheckboxSeparatorBuilder newSeparator()
Description copied from interface:CheckboxBuilderCreate a new separator with no text.- Specified by:
newSeparatorin interfaceCheckboxBuilder- Returns:
- a separator builder
-
newSeparator
public CheckboxSeparatorBuilder newSeparator(java.lang.String text)
Description copied from interface:CheckboxBuilderCreate a new separator with the given text.- Specified by:
newSeparatorin interfaceCheckboxBuilder- Parameters:
text- the separator text- Returns:
- a separator builder
-
addSeparator
public void addSeparator(SeparatorItem separatorItem)
Add a separator item to the list.- Parameters:
separatorItem- the separator item to add
-
transformer
public CheckboxBuilder transformer(java.util.function.Function<java.lang.String,java.lang.String> 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<CheckboxBuilder>- Parameters:
transformer- the transformer function- Returns:
- this builder instance for method chaining
-
filter
public CheckboxBuilder filter(java.util.function.Function<java.lang.String,java.lang.String> 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<CheckboxBuilder>- Parameters:
filter- the filter function- Returns:
- this builder instance for method chaining
-
addPrompt
public PromptBuilder addPrompt()
Add this prompt to the parent builder.- Specified by:
addPromptin interfaceBaseBuilder<CheckboxBuilder>- Returns:
- the parent
PromptBuilderfor continued prompt configuration - See Also:
PromptBuilder.build()
-
-