public class JLineTextTerminal extends AbstractTextTerminal<JLineTextTerminal>
TextTerminal
.DEFAULT_USER_INTERRUPT_KEY, SYSPROP_PROPERTIES_FILE_LOCATION
Constructor and Description |
---|
JLineTextTerminal() |
JLineTextTerminal(jline.console.ConsoleReader reader) |
Modifier and Type | Method and Description |
---|---|
static jline.console.ConsoleReader |
createReader() |
void |
dispose(java.lang.String resultData)
This method is typically called at the end of a text-based input/output session in order to allow the terminal to release its screen resources.
|
java.lang.String |
getAnsiBackgroundColor(java.lang.String colorName) |
java.lang.String |
getAnsiColor(java.lang.String colorName) |
java.lang.String |
getAnsiPrefix(org.beryx.textio.jline.JLineTextTerminal.StyleData styleData) |
java.util.Optional<java.lang.String> |
getColorCode(java.lang.String colorName) |
static java.lang.String |
getKeySequence(java.lang.String keyStroke) |
jline.console.ConsoleReader |
getReader() |
static int |
getStandardColorCode(java.lang.String colorName) |
boolean |
moveToLineStart()
Moves the cursor to the start of the current line of text in order to allow overwriting the current line.
|
void |
printAnsi(java.lang.String message) |
void |
println()
Terminates the current line by writing the line separator string.
|
void |
rawPrint(java.lang.String message)
Prints the message in its raw form.
|
java.lang.String |
read(boolean masking)
Reads a line of text
|
boolean |
registerHandler(java.lang.String keyStroke,
java.util.function.Function<JLineTextTerminal,ReadHandlerData> handler)
Associates a key combination to a handler.
|
boolean |
registerUserInterruptHandler(java.util.function.Consumer<JLineTextTerminal> handler,
boolean abortRead)
Registers a handler that will be called in response to a user interrupt.
|
boolean |
resetLine()
Clears the current line of text.
|
void |
setAnsiColorMode(java.lang.String mode) |
void |
setInputBackgroundColor(java.lang.String colorName) |
void |
setInputBold(boolean bold) |
void |
setInputColor(java.lang.String colorName) |
void |
setInputItalic(boolean italic) |
void |
setInputUnderline(boolean underline) |
void |
setPromptBackgroundColor(java.lang.String colorName) |
void |
setPromptBold(boolean bold) |
void |
setPromptColor(java.lang.String colorName) |
void |
setPromptItalic(boolean italic) |
void |
setPromptUnderline(boolean underline) |
addDefaultProperty, getDefaultProperties, getProperties, getPropertiesPrefixes, getPropertiesReader, init, initProperties, initProperties, initProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
abort, applyWithPropertiesConfigurator, dispose, executeWithPropertiesConfigurator, executeWithPropertiesPrefix, print, print, printf, printf, println, println, rawPrint, resetToBookmark, setBookmark
public JLineTextTerminal()
public JLineTextTerminal(jline.console.ConsoleReader reader)
public static int getStandardColorCode(java.lang.String colorName)
public java.util.Optional<java.lang.String> getColorCode(java.lang.String colorName)
public java.lang.String getAnsiColor(java.lang.String colorName)
public java.lang.String getAnsiBackgroundColor(java.lang.String colorName)
public static jline.console.ConsoleReader createReader()
public java.lang.String read(boolean masking)
TextTerminal
masking
- true, if the input should be masked (for example to enter a password)public void rawPrint(java.lang.String message)
TextTerminal
public void printAnsi(java.lang.String message)
public java.lang.String getAnsiPrefix(org.beryx.textio.jline.JLineTextTerminal.StyleData styleData)
public void println()
TextTerminal
public boolean resetLine()
TextTerminal
TextTerminal.println()
and returns false.public boolean moveToLineStart()
TextTerminal
TextTerminal.println()
and returns false.public boolean registerUserInterruptHandler(java.util.function.Consumer<JLineTextTerminal> handler, boolean abortRead)
TextTerminal
handler
- the action to be performed in response to a user interrupt.abortRead
- true, if the current read operation should be aborted on user interrupt.public boolean registerHandler(java.lang.String keyStroke, java.util.function.Function<JLineTextTerminal,ReadHandlerData> handler)
TextTerminal
keyStroke
- the key combination associated with the handler.
It should have the same format as the argument of KeyStroke.getKeyStroke(String)
.handler
- the action to be performed when the keyStroke
is detected during a read operation.public void dispose(java.lang.String resultData)
TextTerminal
resultData
- stringified information about the outcome of the input/output session; may be null,public jline.console.ConsoleReader getReader()
public void setPromptColor(java.lang.String colorName)
public void setPromptBackgroundColor(java.lang.String colorName)
public void setPromptBold(boolean bold)
public void setPromptItalic(boolean italic)
public void setPromptUnderline(boolean underline)
public void setInputColor(java.lang.String colorName)
public void setInputBackgroundColor(java.lang.String colorName)
public void setInputBold(boolean bold)
public void setInputItalic(boolean italic)
public void setInputUnderline(boolean underline)
public void setAnsiColorMode(java.lang.String mode)
public static java.lang.String getKeySequence(java.lang.String keyStroke)