public class WebTextTerminal extends AbstractTextTerminal<WebTextTerminal> implements DataApi
TextTerminal that allows accessing the application via a browser.
It works only in conjunction with a web server supporting the DataApi (such as SparkDataServer)
and a web component that accesses this API (typically via textterm.js).| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_TIMEOUT_HAS_ACTION |
static long |
DEFAULT_TIMEOUT_NOT_EMPTY |
DEFAULT_USER_INTERRUPT_KEY, SYSPROP_PROPERTIES_FILE_LOCATION| Constructor and Description |
|---|
WebTextTerminal() |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
This method is typically called when a text-based input/output session has been aborted by the user or when a severe error occurred.
|
void |
addSetting(String key,
Object value) |
void |
addSettings(TextTerminalData.KeyValue... keyValues) |
WebTextTerminal |
createCopy() |
void |
dispose()
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.
|
TextTerminalData |
getTextTerminalData()
This method is called by the web component while polling for data
|
void |
postUserInput(String newInput)
This method is called by the web component to post the user input
|
void |
postUserInput(String newInput,
boolean userInterrupt) |
void |
postUserInterrupt(String partialInput)
This method is called by the web component in response to a user interrupt (typically triggered by typing Ctrl+Q).
|
void |
println()
Terminates the current line by writing the line separator string.
|
void |
rawPrint(String message)
Prints the message in its raw form.
|
String |
read(boolean masking)
Reads a line of text
|
boolean |
registerUserInterruptHandler(Consumer<WebTextTerminal> handler,
boolean abortRead)
Registers a handler that will be called in response to a user interrupt.
|
protected void |
setAction(TextTerminalData.Action action) |
void |
setOnAbort(Runnable onAbort) |
void |
setOnDispose(Runnable onDispose) |
void |
setTimeoutHasAction(long timeoutHasAction) |
void |
setTimeoutNotEmpty(long timeoutNotEmpty) |
void |
setUserInterruptKey(int code,
boolean ctrl,
boolean shift,
boolean alt) |
void |
setUserInterruptKey(String keyStroke) |
addDefaultProperty, getDefaultProperties, getProperties, getPropertiesPrefixes, getPropertiesReader, init, initProperties, initProperties, initPropertiespublic static final long DEFAULT_TIMEOUT_NOT_EMPTY
public static final long DEFAULT_TIMEOUT_HAS_ACTION
public void setTimeoutNotEmpty(long timeoutNotEmpty)
public void setTimeoutHasAction(long timeoutHasAction)
public WebTextTerminal createCopy()
public void dispose()
TextTerminaldispose in interface TextTerminal<WebTextTerminal>public void abort()
TextTerminalabort in interface TextTerminal<WebTextTerminal>public void setOnDispose(Runnable onDispose)
public void setOnAbort(Runnable onAbort)
public String read(boolean masking)
TextTerminalread in interface TextTerminal<WebTextTerminal>masking - true, if the input should be masked (for example to enter a password)protected void setAction(TextTerminalData.Action action)
public void rawPrint(String message)
TextTerminalrawPrint in interface TextTerminal<WebTextTerminal>public void println()
TextTerminalprintln in interface TextTerminal<WebTextTerminal>public boolean registerUserInterruptHandler(Consumer<WebTextTerminal> handler, boolean abortRead)
TextTerminalregisterUserInterruptHandler in interface TextTerminal<WebTextTerminal>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 TextTerminalData getTextTerminalData()
DataApigetTextTerminalData in interface DataApipublic void postUserInput(String newInput, boolean userInterrupt)
public void postUserInput(String newInput)
DataApipostUserInput in interface DataApipublic void postUserInterrupt(String partialInput)
DataApipostUserInterrupt in interface DataApipartialInput - the partially entered input when the user interrupt occurred.public void setUserInterruptKey(String keyStroke)
public void addSettings(TextTerminalData.KeyValue... keyValues)
public void setUserInterruptKey(int code,
boolean ctrl,
boolean shift,
boolean alt)