Modifier and Type | Field and Description |
---|---|
(package private) java.io.BufferedReader |
in |
(package private) java.io.PrintStream |
out |
Constructor and Description |
---|
TextUI() |
Modifier and Type | Method and Description |
---|---|
void |
displayError(java.lang.String message)
Displays the error.
|
void |
displayMessage(java.lang.String message)
Displays the message.
|
private java.lang.String |
getResponse() |
java.lang.String[] |
processForm(UIForm form)
Displays a form and returns an array of validated responses.
|
void |
processMenu(UIMenu menu)
Displays a menu and calls the menu action corresponding to the user input.
|
public TextUI()
public void displayMessage(java.lang.String message)
UI
displayMessage
in interface UI
public void displayError(java.lang.String message)
UI
displayError
in interface UI
private java.lang.String getResponse()
public void processMenu(UIMenu menu)
UI
menu.getPrompt(i)
for each menu item i
.
selection
from the user.
menu.runAction(selection)
.
processMenu
in interface UI
public java.lang.String[] processForm(UIForm form)
UI
form.getPrompt(i)
for each form item i
.
response
from the user, for each form item i
, and validates it using form.checkInput(response)
. Only valid responses are accepted.
processForm
in interface UI