- All Known Implementing Classes:
DefaultPrompterConfig
public interface PrompterConfig
Configuration interface for customizing the visual appearance and behavior of prompts.
The configuration controls various visual elements used in the prompt display, including indicators, checkbox symbols, and interaction behavior. The API provides platform-specific defaults that work well on different operating systems.
Default Configurations:
- Windows:
">","( )","(x)","( )" - Unix/Linux/macOS:
"?","? ","? ","? "
Example Custom Configuration:
Prompter.Config config = new DefaultPrompter.DefaultConfig(
"?", // indicator
"? ", // unchecked box
"? ", // checked box
"? " // unavailable item
);
Prompter prompter = PrompterFactory.create(terminal, config);
- Since:
- 3.30.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAnswer text stylestatic final StringBox disabled stylestatic final StringBox enabled stylestatic final StringCheckbox stylestatic final StringCursor/selection indicator stylestatic final StringError message stylestatic final StringFooter/description text style (dimmed)static final StringMessage text stylestatic final StringPrompt text stylestatic final StringSelected item style -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the first prompt can be cancelled.Get the checked box character/string.static PrompterConfigcustom(String indicator, String uncheckedBox, String checkedBox, String unavailable, org.jline.utils.StyleResolver styleResolver, boolean cancellableFirstPrompt) Create a custom configuration with style resolver support.static PrompterConfigdefaults()Create a configuration with platform-specific defaults.default intMaximum height, in rows, of the dimmed footer pane shown below list and checkbox prompts.Get the indicator character/string.default org.jline.utils.AttributedStyledefault org.jline.utils.StyleResolverGet the style resolver for this configuration.Get the unavailable item character/string.Get the unchecked box character/string.static PrompterConfigunix()Create a configuration with Unix/Linux-specific defaults.static PrompterConfigwindows()Create a configuration with Windows-specific defaults.default PrompterConfigwithCancellableFirstPrompt(boolean cancellable)
-
Field Details
-
CURSOR
Cursor/selection indicator style- See Also:
-
PR
Prompt text style- See Also:
-
ME
Message text style- See Also:
-
AN
Answer text style- See Also:
-
BE
Box enabled style- See Also:
-
BD
Box disabled style- See Also:
-
SE
Selected item style- See Also:
-
CB
Checkbox style- See Also:
-
ERROR
Error message style- See Also:
-
FO
Footer/description text style (dimmed)- See Also:
-
-
Method Details
-
indicator
String indicator()Get the indicator character/string.- Returns:
- the indicator
-
uncheckedBox
String uncheckedBox()Get the unchecked box character/string.- Returns:
- the unchecked box
-
checkedBox
String checkedBox()Get the checked box character/string.- Returns:
- the checked box
-
styleResolver
default org.jline.utils.StyleResolver styleResolver()Get the style resolver for this configuration.- Returns:
- the style resolver, or null if not available
-
cancellableFirstPrompt
boolean cancellableFirstPrompt()Whether the first prompt can be cancelled.- Returns:
- true if the first prompt can be cancelled
-
withCancellableFirstPrompt
-
defaults
Create a configuration with platform-specific defaults.- Returns:
- a configuration with platform defaults
-
windows
Create a configuration with Windows-specific defaults.- Returns:
- a configuration with Windows defaults
-
unix
Create a configuration with Unix/Linux-specific defaults.- Returns:
- a configuration with Unix defaults
-
custom
static PrompterConfig custom(String indicator, String uncheckedBox, String checkedBox, String unavailable, org.jline.utils.StyleResolver styleResolver, boolean cancellableFirstPrompt) Create a custom configuration with style resolver support.- Parameters:
indicator- the indicator character/stringuncheckedBox- the unchecked box character/stringcheckedBox- the checked box character/stringunavailable- the unavailable item character/stringstyleResolver- the style resolver for applying styles- Returns:
- a custom configuration with styling support
-
style
-