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

public abstract class AbstractPrompt<T extends ConsoleUIItemIF> extends Object
Classes for all prompt implementations.
  • Field Details

    • terminal

      protected final org.jline.terminal.Terminal terminal
    • bindingReader

      protected final org.jline.keymap.BindingReader bindingReader
    • items

      protected final List<T extends ConsoleUIItemIF> items
    • firstItemRow

      protected int firstItemRow
    • config

      protected final ConsolePrompt.UiConfig 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

      protected void refreshDisplay(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. 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

      protected void refreshDisplay(int row, int column, String buffer, boolean newline)
      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 active
      column - 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 text
      newline - 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 rendering
      buffCol - column where the input buffer's cursor should be placed after rendering
      buffer - the current input buffer to show; may be null to render no buffer text
      candRow - row used to position and highlight the candidate list
      candCol - column where the candidate list should start
      candidates - the list of completion candidates to display alongside the buffer