-
- All Known Implementing Classes:
DefaultPrompterConfig
public interface PrompterConfigConfiguration 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:
PrompterFactory.create(Terminal, PrompterConfig)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANAnswer text stylestatic java.lang.StringBDBox disabled stylestatic java.lang.StringBEBox enabled stylestatic java.lang.StringCBCheckbox stylestatic java.lang.StringCURSORCursor/selection indicator stylestatic java.lang.StringERRORError message stylestatic java.lang.StringFOFooter/description text style (dimmed)static java.lang.StringMEMessage text stylestatic java.lang.StringPRPrompt text stylestatic java.lang.StringSESelected item style
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancancellableFirstPrompt()Whether the first prompt can be cancelled.java.lang.StringcheckedBox()Get the checked box character/string.static PrompterConfigcustom(java.lang.String indicator, java.lang.String uncheckedBox, java.lang.String checkedBox, java.lang.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 intfooterMaxRows()Maximum height, in rows, of the dimmed footer pane shown below list and checkbox prompts.java.lang.Stringindicator()Get the indicator character/string.default org.jline.utils.AttributedStylestyle(java.lang.String style)default org.jline.utils.StyleResolverstyleResolver()Get the style resolver for this configuration.java.lang.Stringunavailable()Get the unavailable item character/string.java.lang.StringuncheckedBox()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 Detail
-
CURSOR
static final java.lang.String CURSOR
Cursor/selection indicator style- See Also:
- Constant Field Values
-
PR
static final java.lang.String PR
Prompt text style- See Also:
- Constant Field Values
-
ME
static final java.lang.String ME
Message text style- See Also:
- Constant Field Values
-
AN
static final java.lang.String AN
Answer text style- See Also:
- Constant Field Values
-
BE
static final java.lang.String BE
Box enabled style- See Also:
- Constant Field Values
-
BD
static final java.lang.String BD
Box disabled style- See Also:
- Constant Field Values
-
SE
static final java.lang.String SE
Selected item style- See Also:
- Constant Field Values
-
CB
static final java.lang.String CB
Checkbox style- See Also:
- Constant Field Values
-
ERROR
static final java.lang.String ERROR
Error message style- See Also:
- Constant Field Values
-
FO
static final java.lang.String FO
Footer/description text style (dimmed)- See Also:
- Constant Field Values
-
-
Method Detail
-
indicator
java.lang.String indicator()
Get the indicator character/string.- Returns:
- the indicator
-
uncheckedBox
java.lang.String uncheckedBox()
Get the unchecked box character/string.- Returns:
- the unchecked box
-
checkedBox
java.lang.String checkedBox()
Get the checked box character/string.- Returns:
- the checked box
-
unavailable
java.lang.String unavailable()
Get the unavailable item character/string.- Returns:
- the unavailable item
-
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
default PrompterConfig withCancellableFirstPrompt(boolean cancellable)
-
defaults
static PrompterConfig defaults()
Create a configuration with platform-specific defaults.- Returns:
- a configuration with platform defaults
-
windows
static PrompterConfig windows()
Create a configuration with Windows-specific defaults.- Returns:
- a configuration with Windows defaults
-
unix
static PrompterConfig unix()
Create a configuration with Unix/Linux-specific defaults.- Returns:
- a configuration with Unix defaults
-
custom
static PrompterConfig custom(java.lang.String indicator, java.lang.String uncheckedBox, java.lang.String checkedBox, java.lang.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
default org.jline.utils.AttributedStyle style(java.lang.String style)
-
footerMaxRows
default int footerMaxRows()
Maximum height, in rows, of the dimmed footer pane shown below list and checkbox prompts.- Returns:
- the maximum footer pane height in rows
-
-