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, titleFields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
background, cli, enableInputOnReturn, returnToFields 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 booleancanBeClosed()Determines if the dialog can be closedvoidonArrowDown()Selects the next ActiveItem on the Dialog and refreshes the detailsvoidonArrowLeft()Selects the previous ActiveItem on the Dialog and refreshes the detailsvoidonArrowRight()Selects the next ActiveItem on the Dialog and refreshes the detailsvoidonArrowUp()Selects the previous ActiveItem on the Dialog and refreshes the detailsvoidonCarriageReturn()Selects/deselects list items or confirms the selection, based on the currentItemvoidonQuit()Determines the Dialog behaviour when it is asked to close itselfvoidonTab()Selects the next ActiveItem on the Dialog and refreshes the detailsvoidshow()Draws itselfprotected static intwidth(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, getTextColorMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Dialog
drawBackground, drawMessage, drawShadows, drawTitle, getBackgroundColor, removeMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
addToBackground, getCli, getReturnToMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItemMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBorders, findCenter, getColor, getHeight, getInitCoord, getWidth, hideBorders, loadPropertiesFileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
onQuitin 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:
canBeClosedin classInputDialog- Returns:
- true if the dialog can be closed, false otherwise
-
show
public void show()Description copied from class:InputDialogDraws itself- Overrides:
showin classInputDialog
-
onCarriageReturn
public void onCarriageReturn()Selects/deselects list items or confirms the selection, based on the currentItem- Specified by:
onCarriageReturnin interfaceKeyEventListener- Overrides:
onCarriageReturnin classInputDialog
-
onArrowRight
public void onArrowRight()Selects the next ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowRightin interfaceKeyEventListener- Overrides:
onArrowRightin classInputDialog
-
onArrowLeft
public void onArrowLeft()Selects the previous ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowLeftin interfaceKeyEventListener- Overrides:
onArrowLeftin classInputDialog
-
onTab
public void onTab()Selects the next ActiveItem on the Dialog and refreshes the details- Specified by:
onTabin interfaceKeyEventListener- Overrides:
onTabin classInputDialog
-
onArrowUp
public void onArrowUp()Selects the previous ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowUpin interfaceKeyEventListener- Overrides:
onArrowUpin classInputDialog
-
onArrowDown
public void onArrowDown()Selects the next ActiveItem on the Dialog and refreshes the details- Specified by:
onArrowDownin interfaceKeyEventListener- Overrides:
onArrowDownin classInputDialog
-