java.lang.Object
it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
it.polimi.ingsw.view.cli.console.graphics.components.Window
it.polimi.ingsw.view.cli.console.graphics.components.Dialog
it.polimi.ingsw.view.cli.console.graphics.components.InputDialog
it.polimi.ingsw.view.cli.console.graphics.SingleChoiceListDialog
- All Implemented Interfaces:
KeyEventListener
- Direct Known Subclasses:
DetailedSingleChoiceListDialog
public class SingleChoiceListDialog extends InputDialog
A dialog showing a list of elements; when the enter key is pressed, the currently selected item is triggered, causing
it to return its value to the inputManager and this to be closed
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Dialog
message, title
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
background, cli, enableInputOnReturn, returnTo
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
activeItems, id, parent, passiveItems
-
Constructor Summary
Constructors Constructor Description SingleChoiceListDialog(java.lang.String title, java.lang.String message, Window caller, java.util.List<java.lang.String> options)
Default constructorSingleChoiceListDialog(java.lang.String title, java.lang.String message, Window caller, java.util.List<java.lang.String> options, int width, int height, CursorPosition initCoord)
Custom constructor -
Method Summary
Modifier and Type Method Description protected static int
width(java.util.List<java.lang.String> options)
Determines the dialog width based on the number of optionsMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.InputDialog
canBeClosed, getInputs, getTextColor, onArrowDown, onArrowLeft, onArrowRight, onArrowUp, onCarriageReturn, onQuit, onTab, show
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Dialog
drawBackground, drawMessage, drawShadows, drawTitle, getBackgroundColor, remove
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
addToBackground, getCli, getReturnTo
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBorders, findCenter, getColor, getHeight, getInitCoord, getWidth, hideBorders, loadPropertiesFile
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.polimi.ingsw.view.cli.console.KeyEventListener
onBackspace, onPrintableKey
-
Constructor Details
-
SingleChoiceListDialog
public SingleChoiceListDialog(java.lang.String title, java.lang.String message, Window caller, java.util.List<java.lang.String> options)Default constructorCreates a SimpleListChoiceDialog, which dimensions are adapted on the options provided; if other dialogs are already showing, the new dialog is created at an offset from the already existing one
The console echo is disabled as soon as the Dialog is created- Parameters:
title
- the dialog titlemessage
- the dialog messagecaller
- the window which invoked thisoptions
- the options to show
-
SingleChoiceListDialog
public SingleChoiceListDialog(java.lang.String title, java.lang.String message, Window caller, java.util.List<java.lang.String> options, int width, int height, CursorPosition initCoord)Custom constructorCreates a SimpleListChoiceDialog, using custom if other dialogs are already showing, the new dialog is created at an offset from the already existing one
The console echo is disabled as soon as the Dialog is created- Parameters:
title
- the dialog titlemessage
- the dialog messagecaller
- the window which invoked thisoptions
- the options to showinitCoord
- the initial coordinates
-
-
Method Details
-
width
protected static int width(java.util.List<java.lang.String> options)Determines the dialog width based on the number of options- Parameters:
options
- the list of options- Returns:
- the adapted dialog size
-