Module org.jline.console.ui
Package org.jline.consoleui.prompt
Class AbstractPrompt<T extends ConsoleUIItemIF>
java.lang.Object
org.jline.consoleui.prompt.AbstractPrompt<T>
- Direct Known Subclasses:
AbstractPrompt.CheckboxPrompt,AbstractPrompt.ConfirmPrompt,AbstractPrompt.ExpandableChoicePrompt,AbstractPrompt.InputValuePrompt,AbstractPrompt.ListChoicePrompt
Classes for all prompt implementations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classAbstractPrompt.ListChoicePrompt<T extends ListItemIF> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.jline.keymap.BindingReaderprotected final ConsolePrompt.UiConfigstatic final longprotected intprotected final org.jline.terminal.Terminal -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPrompt(org.jline.terminal.Terminal terminal, org.jline.utils.Display display, List<org.jline.utils.AttributedString> header, org.jline.utils.AttributedString message, List<T> items, int pageSize, ConsolePrompt.UiConfig cfg) AbstractPrompt(org.jline.terminal.Terminal terminal, org.jline.utils.Display display, List<org.jline.utils.AttributedString> header, org.jline.utils.AttributedString message, ConsolePrompt.UiConfig cfg) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidrefreshDisplay(int row) Refreshes the display so the UI is re-rendered with the specified cursor row.protected voidrefreshDisplay(int row, int column, String buffer, boolean newline) Refreshes the terminal display using the provided buffer and positions the cursor.protected voidrefreshDisplay(int buffRow, int buffCol, String buffer, int candRow, int candCol, List<org.jline.reader.Candidate> candidates) Resize the display to the cached terminal size, render the input buffer together with a candidate list, and position the cursor.protected voidrefreshDisplay(int row, Set<String> selected) Refreshes the UI to render items with the cursor positioned at the specified row and the given items marked as selected.protected voidprotected void
-
Field Details
-
terminal
protected final org.jline.terminal.Terminal terminal -
bindingReader
protected final org.jline.keymap.BindingReader bindingReader -
items
-
firstItemRow
protected int firstItemRow -
config
-
DEFAULT_TIMEOUT_WITH_ESC
public static final long DEFAULT_TIMEOUT_WITH_ESC- See Also:
-
-
Constructor Details
-
AbstractPrompt
public AbstractPrompt(org.jline.terminal.Terminal terminal, org.jline.utils.Display display, List<org.jline.utils.AttributedString> header, org.jline.utils.AttributedString message, ConsolePrompt.UiConfig cfg) -
AbstractPrompt
public AbstractPrompt(org.jline.terminal.Terminal terminal, org.jline.utils.Display display, List<org.jline.utils.AttributedString> header, org.jline.utils.AttributedString message, List<T> items, int pageSize, ConsolePrompt.UiConfig cfg)
-
-
Method Details
-
resetHeader
protected void resetHeader() -
resetDisplay
protected void resetDisplay() -
refreshDisplay
protected void refreshDisplay(int row) Refreshes the display so the UI is re-rendered with the specified cursor row.Uses column 0 and an empty input buffer (no trailing newline) when updating the display.
- Parameters:
row- the absolute terminal row to position the cursor for rendering
-
refreshDisplay
Refreshes the UI to render items with the cursor positioned at the specified row and the given items marked as selected. Resizes the display to the current terminal size, updates the rendered lines based on the cursor row and selection set, and moves the terminal cursor to the computed position.- Parameters:
row- the absolute terminal row where the cursor should appear (typically a value relative to the prompt's layout)selected- names of items that should be rendered as selected/checked
-
refreshDisplay
Refreshes the terminal display using the provided buffer and positions the cursor. This resizes the display to the current terminal Size, renders header/message/items together with the optional input buffer (when `newline` is true and `buffer` is non-empty the buffer is presented on its own line with a prompt marker), and moves the cursor to the computed (row, column) position.- Parameters:
row- the current cursor row used to determine which item/candidate is activecolumn- the cursor column within the buffer (column offset from the message start)buffer- the current input text to render; may be null to omit the buffer textnewline- if true and `buffer` is non-empty, render the buffer on its own line with a prompt marker
-
refreshDisplay
protected void refreshDisplay(int buffRow, int buffCol, String buffer, int candRow, int candCol, List<org.jline.reader.Candidate> candidates) Resize the display to the cached terminal size, render the input buffer together with a candidate list, and position the cursor. Renders the provided buffer (if non-null) and the candidates at the candidate display coordinates, updates the display content, and moves the cursor to the specified buffer coordinates.- Parameters:
buffRow- row where the input buffer's cursor should be placed after renderingbuffCol- column where the input buffer's cursor should be placed after renderingbuffer- the current input buffer to show; may be null to render no buffer textcandRow- row used to position and highlight the candidate listcandCol- column where the candidate list should startcandidates- the list of completion candidates to display alongside the buffer
-