Class Menu
java.lang.Object
pretty.layout.Menu
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Rollback all lines and temporary linesvoid
divider()
Push a divider to the menuchar
Get a char from the userchar
Get a char from the userdouble
Get a double from the userdouble
Get a double from the userfloat
Get a float from the userfloat
Get a float from the userstatic Menu
Get the singleton instance of Menuint
Get an integer from the userint
Get an integer from the userlong
Get an long integer from the userlong
Get an long integer from the userint
Show options to the user and get the selected optionint
Show options to the user and get the selected optionboolean
Get a confirmation from the userboolean
getPageConfirmation
(String reject) Get a confirmation from the userint
getPageOption
(String[] options) Get an option from the userint
getPageOption
(String[] options, int page, int optionsPerPage, int selected, String exit) Get an option from the userint
getPageOption
(String[] options, Integer[] lockeds) Get an option from the userint
getPageOption
(String[] options, Integer[] lockeds, int optionsPerPage, int selected, String exit) Get an option from the userint
getPageOption
(String[] options, Integer[] lockeds, int selected, String exit) Get an option from the userint
getPageOption
(String[] options, Integer[] lockeds, String exit) Get an option from the userint
getPageOption
(String[] options, String exit) Get an option from the userGet a string from the userGet a string from the uservoid
Push a header to the menuvoid
phantomPush
(String line) Push a line to the menu without rendering itvoid
Push a line to the menuvoid
Push a line to the menuvoid
Push a footer to the menu with the only option to go backvoid
rollback()
Rollback the last line and temporary linesvoid
rollback
(int count) Rollback a number of lines, not including temporary linesvoid
Rollback the last line, keeping temporary linesvoid
start()
Start the menu, called by the router by defaultvoid
temporarilyPush
(String line) Temporarily push a line to the menu.void
Rollback the last line and temporary lines and print an warning messagevoid
Rollback a number of lines and temporary lines and print an warning message
-
Method Details
-
getInstance
-
start
public void start()Start the menu, called by the router by default -
push
-
push
Push a line to the menu- Parameters:
line
- - the line to be pushednewLine
- - if the line should be end with a new line
-
temporarilyPush
Temporarily push a line to the menu. The line will be removed after the next rollback.- Parameters:
line
- - the line to be temporarily pushed
-
phantomPush
Push a line to the menu without rendering it- Parameters:
line
- - the line to be pushed
-
rollback
public void rollback()Rollback the last line and temporary lines -
rollback
public void rollback(int count) Rollback a number of lines, not including temporary lines- Parameters:
count
- - the number of lines
-
rollbackKeepingTemporary
public void rollbackKeepingTemporary()Rollback the last line, keeping temporary lines -
cleanup
public void cleanup()Rollback all lines and temporary lines -
warning
Rollback the last line and temporary lines and print an warning message- Parameters:
message
- - the message to be printed
-
warning
Rollback a number of lines and temporary lines and print an warning message- Parameters:
message
- - the message to be printedrollbacks
- - the number of lines to rollback
-
header
-
divider
public void divider()Push a divider to the menu -
getInt
-
getInt
-
getLong
-
getLong
-
getDouble
-
getDouble
-
getFloat
-
getFloat
-
getChar
-
getChar
-
getString
-
getString
-
getOption
-
getOption
Show options to the user and get the selected option- Parameters:
prompt
- - the prompt to be shownoptions
- - the options to be shownselected
- - the default selected option- Returns:
- the selected option, or -1 if no options is passed
-
pushPageBack
public void pushPageBack()Push a footer to the menu with the only option to go back -
getPageConfirmation
public boolean getPageConfirmation()Get a confirmation from the user- Returns:
- true, if the user confirms, false otherwise
-
getPageConfirmation
Get a confirmation from the user- Parameters:
reject
- - reject option message- Returns:
- true, if the user confirms, false otherwise
-
getPageOption
Get an option from the user- Parameters:
options
- - the options to be shown- Returns:
- the selected option or -1 if no options are selected
-
getPageOption
-
getPageOption
-
getPageOption
-
getPageOption
Get an option from the user- Parameters:
options
- - the options to be shownlockeds
- - the locked optionsselected
- - the default selected optionexit
- - exit option message- Returns:
- the selected option or -1 if no options are selected
-
getPageOption
Get an option from the user- Parameters:
options
- - the options to be shownpage
- - the current pageoptionsPerPage
- - the max number of options per pageselected
- - the default selected optionexit
- - exit option message- Returns:
- the selected option or -1 if no options are selected
-
getPageOption
public int getPageOption(String[] options, Integer[] lockeds, int optionsPerPage, int selected, String exit) Get an option from the user- Parameters:
options
- - the options to be shownlockeds
- - the locked optionsoptionsPerPage
- - the max number of options per pageselected
- - the default selected optionexit
- - exit option message- Returns:
- - the selected option or -1 if no options are selected
-