Package adams.core.io.console
Class Lanterna
- java.lang.Object
-
- adams.core.io.console.Lanterna
-
-
Field Summary
Fields Modifier and Type Field Description protected com.googlecode.lanterna.gui2.MultiWindowTextGUI
m_Context
the lanterna context.protected com.googlecode.lanterna.gui2.TextBox
m_TextBoxLog
the text box for logging output.
-
Constructor Summary
Constructors Constructor Description Lanterna(com.googlecode.lanterna.gui2.MultiWindowTextGUI context, com.googlecode.lanterna.gui2.TextBox textBoxLog)
Initializes the console helper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
enterMultiLineValue(String msg)
Lets the user enter a multi-line value.String[]
enterMultipleValues(String msg)
Lets the user enter multiple values.adams.core.base.BasePassword
enterPassword(String msg)
Lets the user enter a password.String
enterValue(String msg)
Lets the user enter a value.String
enterValue(String msg, String initial)
Lets the user enter a value.void
printlnErr(String msg)
Outputs the error message.void
printlnOut(String msg)
Outputs the message.adams.core.io.PlaceholderDirectory
selectDirectory(String msg, adams.core.io.PlaceholderDirectory initial)
Lets the user select a directory.adams.core.io.PlaceholderFile[]
selectFiles(String msg, adams.core.io.PlaceholderFile... initial)
Lets the user select files.String
selectOption(String msg, String[] options)
Lets the user select from a number of choices.String
selectOption(String msg, String[] options, String initial)
Lets the user select from a number of choices.
-
-
-
Method Detail
-
enterMultiLineValue
public String enterMultiLineValue(String msg)
Lets the user enter a multi-line value.- Specified by:
enterMultiLineValue
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output before reading the input- Returns:
- the entered value, null if cancelled or failed to read input
-
enterValue
public String enterValue(String msg)
Lets the user enter a value.- Specified by:
enterValue
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output before reading the input- Returns:
- the entered value, null if cancelled or failed to read input
-
enterValue
public String enterValue(String msg, String initial)
Lets the user enter a value.- Specified by:
enterValue
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output before reading the inputinitial
- the initial value, ignored if empty or null- Returns:
- the entered value, null if cancelled or failed to read input (or initial value if empty string returned)
-
enterMultipleValues
public String[] enterMultipleValues(String msg)
Lets the user enter multiple values. Empty string terminates the loop.- Specified by:
enterMultipleValues
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output before reading the input- Returns:
- the entered value, null if cancelled or failed to read input
-
enterPassword
public adams.core.base.BasePassword enterPassword(String msg)
Lets the user enter a password.- Specified by:
enterPassword
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output before reading the input- Returns:
- the entered value, null if cancelled or failed to read input
-
selectOption
public String selectOption(String msg, String[] options)
Lets the user select from a number of choices.- Specified by:
selectOption
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output before reading the inputoptions
- the options to choose from- Returns:
- the selected option, null if cancelled or failed to read input
-
selectOption
public String selectOption(String msg, String[] options, String initial)
Lets the user select from a number of choices.- Specified by:
selectOption
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output before reading the inputoptions
- the options to choose frominitial
- the initial selection (selected if just hitting enter), null or empty string to ignore- Returns:
- the selected option, null if cancelled or failed to read input
-
selectDirectory
public adams.core.io.PlaceholderDirectory selectDirectory(String msg, adams.core.io.PlaceholderDirectory initial)
Lets the user select a directory.- Specified by:
selectDirectory
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to outputinitial
- the initial directory- Returns:
- the directory, null if cancelled
-
selectFiles
public adams.core.io.PlaceholderFile[] selectFiles(String msg, adams.core.io.PlaceholderFile... initial)
Lets the user select files.- Specified by:
selectFiles
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to outputinitial
- the initial files- Returns:
- the directory, null if cancelled
-
printlnOut
public void printlnOut(String msg)
Outputs the message.- Specified by:
printlnOut
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the message to output
-
printlnErr
public void printlnErr(String msg)
Outputs the error message.- Specified by:
printlnErr
in interfaceadams.core.io.console.Console
- Parameters:
msg
- the error message to output
-
-