Class Menu
java.lang.Object
pretty.layout.Menu
- 
Method SummaryModifier and TypeMethodDescriptionvoidcleanup()Rollback all lines and temporary linesvoiddivider()Push a divider to the menucharGet a char from the usercharGet a char from the userdoubleGet a double from the userdoubleGet a double from the userfloatGet a float from the userfloatGet a float from the userstatic MenuGet the singleton instance of MenuintGet an integer from the userintGet an integer from the userlongGet an long integer from the userlongGet an long integer from the userintShow options to the user and get the selected optionintShow options to the user and get the selected optionbooleanGet a confirmation from the userbooleangetPageConfirmation(String reject) Get a confirmation from the userintgetPageOption(String[] options) Get an option from the userintgetPageOption(String[] options, int page, int optionsPerPage, int selected, String exit) Get an option from the userintgetPageOption(String[] options, Integer[] lockeds) Get an option from the userintgetPageOption(String[] options, Integer[] lockeds, int optionsPerPage, int selected, String exit) Get an option from the userintgetPageOption(String[] options, Integer[] lockeds, int selected, String exit) Get an option from the userintgetPageOption(String[] options, Integer[] lockeds, String exit) Get an option from the userintgetPageOption(String[] options, String exit) Get an option from the userGet a string from the userGet a string from the uservoidPush a header to the menuvoidphantomPush(String line) Push a line to the menu without rendering itvoidPush a line to the menuvoidPush a line to the menuvoidPush a footer to the menu with the only option to go backvoidrollback()Rollback the last line and temporary linesvoidrollback(int count) Rollback a number of lines, not including temporary linesvoidRollback the last line, keeping temporary linesvoidstart()Start the menu, called by the router by defaultvoidtemporarilyPush(String line) Temporarily push a line to the menu.voidRollback the last line and temporary lines and print an warning messagevoidRollback a number of lines and temporary lines and print an warning message
- 
Method Details- 
getInstance
- 
startpublic void start()Start the menu, called by the router by default
- 
push
- 
pushPush a line to the menu- Parameters:
- line- - the line to be pushed
- newLine- - if the line should be end with a new line
 
- 
temporarilyPushTemporarily push a line to the menu. The line will be removed after the next rollback.- Parameters:
- line- - the line to be temporarily pushed
 
- 
phantomPushPush a line to the menu without rendering it- Parameters:
- line- - the line to be pushed
 
- 
rollbackpublic void rollback()Rollback the last line and temporary lines
- 
rollbackpublic void rollback(int count) Rollback a number of lines, not including temporary lines- Parameters:
- count- - the number of lines
 
- 
rollbackKeepingTemporarypublic void rollbackKeepingTemporary()Rollback the last line, keeping temporary lines
- 
cleanuppublic void cleanup()Rollback all lines and temporary lines
- 
warningRollback the last line and temporary lines and print an warning message- Parameters:
- message- - the message to be printed
 
- 
warningRollback a number of lines and temporary lines and print an warning message- Parameters:
- message- - the message to be printed
- rollbacks- - the number of lines to rollback
 
- 
header
- 
dividerpublic void divider()Push a divider to the menu
- 
getInt
- 
getInt
- 
getLong
- 
getLong
- 
getDouble
- 
getDouble
- 
getFloat
- 
getFloat
- 
getChar
- 
getChar
- 
getString
- 
getString
- 
getOption
- 
getOptionShow options to the user and get the selected option- Parameters:
- prompt- - the prompt to be shown
- options- - the options to be shown
- selected- - the default selected option
- Returns:
- the selected option, or -1 if no options is passed
 
- 
pushPageBackpublic void pushPageBack()Push a footer to the menu with the only option to go back
- 
getPageConfirmationpublic boolean getPageConfirmation()Get a confirmation from the user- Returns:
- true, if the user confirms, false otherwise
 
- 
getPageConfirmationGet a confirmation from the user- Parameters:
- reject- - reject option message
- Returns:
- true, if the user confirms, false otherwise
 
- 
getPageOptionGet 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
- 
getPageOptionGet an option from the user- Parameters:
- options- - the options to be shown
- lockeds- - the locked options
- selected- - the default selected option
- exit- - exit option message
- Returns:
- the selected option or -1 if no options are selected
 
- 
getPageOptionGet an option from the user- Parameters:
- options- - the options to be shown
- page- - the current page
- optionsPerPage- - the max number of options per page
- selected- - the default selected option
- exit- - exit option message
- Returns:
- the selected option or -1 if no options are selected
 
- 
getPageOptionpublic int getPageOption(String[] options, Integer[] lockeds, int optionsPerPage, int selected, String exit) Get an option from the user- Parameters:
- options- - the options to be shown
- lockeds- - the locked options
- optionsPerPage- - the max number of options per page
- selected- - the default selected option
- exit- - exit option message
- Returns:
- - the selected option or -1 if no options are selected
 
 
-