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.MultipleChoiceListDialog
- All Implemented Interfaces:
KeyEventListener
public final class MultipleChoiceListDialog extends InputDialog
-
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 MultipleChoiceListDialog(java.lang.String title, java.lang.String message, Window caller, java.util.Map<java.lang.String,java.util.LinkedList<java.lang.String>> detailedOptions, int numberOfChoices)
Default constructor -
Method Summary
Modifier and Type Method Description boolean
canBeClosed()
Determines if the dialog can be closedvoid
onArrowDown()
Selects the next ActiveItem on the Dialog and refreshes the detailsvoid
onArrowLeft()
Selects the previous ActiveItem on the Dialog and refreshes the detailsvoid
onArrowRight()
Selects the next ActiveItem on the Dialog and refreshes the detailsvoid
onArrowUp()
Selects the previous ActiveItem on the Dialog and refreshes the detailsvoid
onCarriageReturn()
Selects/deselects list items or confirms the selection, based on the currentItemvoid
onQuit()
Determines the Dialog behaviour when it is asked to close itselfvoid
onTab()
Selects the next ActiveItem on the Dialog and refreshes the detailsvoid
show()
Draws itselfprotected 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
getInputs, getTextColor
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
-
MultipleChoiceListDialog
public MultipleChoiceListDialog(java.lang.String title, java.lang.String message, Window caller, java.util.Map<java.lang.String,java.util.LinkedList<java.lang.String>> detailedOptions, int numberOfChoices)Default constructorCreates a MultipleChoiceListDialog.xml, 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 thisdetailedOptions
- the options to show and their detailsnumberOfChoices
- the number of items to select
-
-
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
-
onQuit
public void onQuit()Determines the Dialog behaviour when it is asked to close itselfFor a MultipleChoiceListDialog, all of its inputs are passed to the inputManager
- Overrides:
onQuit
in classInputDialog
-
canBeClosed
public boolean canBeClosed()Determines if the dialog can be closedFor a MultipleChoiceListDialog.xml, it can be closed when the number of selected items matches the number of requested inputs
- Overrides:
canBeClosed
in classInputDialog
- Returns:
- true if the dialog can be closed, false otherwise
-
show
public void show()Description copied from class:InputDialog
Draws itself- Overrides:
show
in classInputDialog
-
onCarriageReturn
public void onCarriageReturn()Selects/deselects list items or confirms the selection, based on the currentItem- Specified by:
onCarriageReturn
in interfaceKeyEventListener
- Overrides:
onCarriageReturn
in classInputDialog
-
onArrowRight
public void onArrowRight()Selects the next ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowRight
in interfaceKeyEventListener
- Overrides:
onArrowRight
in classInputDialog
-
onArrowLeft
public void onArrowLeft()Selects the previous ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowLeft
in interfaceKeyEventListener
- Overrides:
onArrowLeft
in classInputDialog
-
onTab
public void onTab()Selects the next ActiveItem on the Dialog and refreshes the details- Specified by:
onTab
in interfaceKeyEventListener
- Overrides:
onTab
in classInputDialog
-
onArrowUp
public void onArrowUp()Selects the previous ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowUp
in interfaceKeyEventListener
- Overrides:
onArrowUp
in classInputDialog
-
onArrowDown
public void onArrowDown()Selects the next ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowDown
in interfaceKeyEventListener
- Overrides:
onArrowDown
in classInputDialog
-