Class Widgets

java.lang.Object
org.jline.widget.Widgets
Direct Known Subclasses:
AutopairWidgets, AutosuggestionWidgets, TailTipWidgets

public abstract class Widgets extends Object
Create custom widgets by extending Widgets class
  • Field Details

  • Constructor Details

  • Method Details

    • addWidget

      public void addWidget(String name, Widget widget)
      Add widget to the LineReader
      Parameters:
      name - the name of widget
      widget - widget
    • namedWidget

      private Widget namedWidget(String name, Widget widget)
    • callWidget

      public void callWidget(String name)
      Call widget. System widget will be call if the name does not start with '_' or ends with '-toggle' i.e. '.' will be added at the beginning of the name.
      Parameters:
      name - widget name
    • executeWidget

      public void executeWidget(String name)
      Bind widget to ctrl-alt-x and execute it
      Parameters:
      name - widget name
    • aliasWidget

      public void aliasWidget(String orig, String alias)
      Create alias to widget
      Parameters:
      orig - widget original name
      alias - alias name
    • getWidget

      public String getWidget(String name)
      Parameters:
      name - widget name or alias
      Returns:
      widget name
    • existsWidget

      public boolean existsWidget(String name)
      Parameters:
      name - widget name or alias
      Returns:
      true if widget exists
    • widget

      private Widget widget(String name)
    • parser

      public Parser parser()
      Returns:
      The LineRearer Parser
    • getKeyMap

      public KeyMap<Binding> getKeyMap()
      Returns:
      The LineReader Main KeyMap
    • buffer

      public Buffer buffer()
      Returns:
      The LineReader Buffer
    • replaceBuffer

      public void replaceBuffer(Buffer buffer)
      Parameters:
      buffer - buffer that will be copied to the LineReader Buffer
    • args

      public List<String> args()
      Returns:
      command line arguments
    • prevChar

      public String prevChar()
      Returns:
      Buffer's previous character
    • currChar

      public String currChar()
      Returns:
      Buffer's current character
    • lastBinding

      public String lastBinding()
      Returns:
      LineReader's last binding
    • putString

      public void putString(String string)
      Parameters:
      string - string to be written into LineReader Buffer
    • tailTip

      public String tailTip()
      Returns:
      Command line tail tip.
    • setTailTip

      public void setTailTip(String tailTip)
      Parameters:
      tailTip - tail tip to be added to the command line
    • setErrorPattern

      public void setErrorPattern(Pattern errorPattern)
      Parameters:
      errorPattern - error pattern to be set LineReader Highlighter
    • setErrorIndex

      public void setErrorIndex(int errorIndex)
      Parameters:
      errorIndex - error index to be set LineReader Highlighter
    • clearTailTip

      public void clearTailTip()
      Clears command line tail tip
    • setSuggestionType

      public void setSuggestionType(LineReader.SuggestionType type)
      Parameters:
      type - type to be set to the LineReader autosuggestion
    • addDescription

      public void addDescription(List<AttributedString> desc)
      Parameters:
      desc - Text to be displayed on terminal status bar
    • clearDescription

      public void clearDescription()
      Clears terminal status bar
    • initDescription

      public void initDescription(int size)
      Initialize terminal status bar
      Parameters:
      size - Terminal status bar size in rows
    • destroyDescription

      public void destroyDescription()
      Remove terminal status bar