public class ConsoleClient
extends java.lang.Object
Constructor and Description |
---|
ConsoleClient(java.lang.String appname,
Module homeModule)
Sets the name of the app and the starting module
|
Modifier and Type | Method and Description |
---|---|
void |
addModule(Module m)
Adds a possible module to the client.
|
void |
addShutdownHook(java.lang.Thread onShutdown)
Adds a proccess to run when the app shuts down.
|
void |
enableAlerts(boolean enabled)
Sets whether the client will trigger the system's default alert sound when
the user performs actions that cannot have a result.
|
void |
enableHistoryIndexDisplay(boolean enabled)
Sets whether the client will display the history index in the prompt.
|
void |
enableHistoryLogging(boolean enabled)
Sets whether the client will log history of user commands.
|
void |
enableTabCompletion(boolean enabled)
Sets whether the client will be able to toggle through command history using
the tab key
|
void |
removeModule(Module m)
Removes a possible module from the client.
|
void |
runConsole()
Runs the console application accross all modules, starting from the home
module
|
void |
setModuleSeparator(java.lang.String separator)
Sets the character(s) that will be shown between the app name and the module
in the prompt display.
|
void |
setPromptDisplayName(java.lang.String name)
Sets the app name that will show on the prompt display.
|
void |
setPromptSeparator(java.lang.String separator)
Sets the character(s) that will come up at the end of the prompt on the CLI
to separate the prompt from the user input.
|
public ConsoleClient(java.lang.String appname, Module homeModule)
appname
- The name of the console applicationhomeModule
- The default module that is loaded when user first starts up
applicationpublic void setPromptSeparator(java.lang.String separator)
The following examples show two prompts with the same settings but different prompt seprators:
AppName: module$
- separator is
set to "$"
(default setting)
AppName: module>
- separator is
set to ">"
AppName: module >
- separator is set to
" >"
separator
- public void setModuleSeparator(java.lang.String separator)
The following examples show two prompts with the same settings but different module seprators:
AppName: module 0$
- separator is set to
": "
(default setting)
AppName/ module 0$
- separator is set to
"/ "
AppName/module 0$
- separator is
set to "/"
separator
- public void enableHistoryLogging(boolean enabled)
historyEnabled
- if true, client will log command historypublic void enableHistoryIndexDisplay(boolean enabled)
enabled
- if true, client will display history index in promptpublic void enableTabCompletion(boolean enabled)
historyEnabled
- if true, client will log command historypublic void enableAlerts(boolean enabled)
enabled
- if true, client will trigger system alertspublic void setPromptDisplayName(java.lang.String name)
name
- public void addShutdownHook(java.lang.Thread onShutdown)
onShutdown
- Thread containing process to run on shutdownpublic void addModule(Module m)
m
- Module to addpublic void removeModule(Module m)
m
- Module to removepublic void runConsole()