- All Implemented Interfaces:
KeyEventListener
- Direct Known Subclasses:
ButtonsDialog
,MultipleChoiceListDialog
,SingleChoiceListDialog
,TextInputDialog
public abstract class InputDialog extends Dialog
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<ActiveItem,java.lang.String>
inputs
Maps all the activeItems whichFields 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 InputDialog(java.lang.String title, java.lang.String message, int width, int height, CursorPosition initCoord, Window caller)
Custom constructorInputDialog(java.lang.String title, java.lang.String message, int width, int height, Window caller)
Custom constructorInputDialog(java.lang.String title, java.lang.String message, Window caller)
Default constructor -
Method Summary
Modifier and Type Method Description boolean
canBeClosed()
Determines if the dialog can be closedjava.util.Map<ActiveItem,java.lang.String>
getInputs()
Provides a map containing active items and their corresponding values to be returnedjava.lang.String
getTextColor()
Provides the first WindowItem.activeItems textColorvoid
onArrowDown()
Selects the next ActiveItem on the Dialogvoid
onArrowLeft()
Selects the previous ActiveItem on the Dialogvoid
onArrowRight()
Selects the next ActiveItem on the Dialogvoid
onArrowUp()
Selects the previous ActiveItem on the Dialogvoid
onCarriageReturn()
Performs an action based on the currently selected ActiveItemvoid
onQuit()
Determines the Dialog behaviour when it is asked to close itselfvoid
onTab()
Selects the next ActiveItem on the Dialogvoid
show()
Draws itselfMethods 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
-
Field Details
-
inputs
Maps all the activeItems which
-
-
Constructor Details
-
InputDialog
Default constructorCreates a standard size inputDialog window, using the properties file, without printing it; 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 this
-
InputDialog
public InputDialog(java.lang.String title, java.lang.String message, int width, int height, Window caller)Custom constructorCreates a custom size input dialog window, without printing it; 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:
height
- the dialog heightwidth
- the dialog widthtitle
- the dialog titlemessage
- the dialog messagecaller
- the window which invoked this
-
InputDialog
public InputDialog(java.lang.String title, java.lang.String message, int width, int height, CursorPosition initCoord, Window caller)Custom constructorCreates a custom size input dialog window, without printing it;
The console echo is disabled as soon as the Dialog is created- Parameters:
height
- the dialog heightwidth
- the dialog widthtitle
- the dialog titlemessage
- the dialog messagecaller
- the window which invoked this
-
-
Method Details
-
getInputs
Provides a map containing active items and their corresponding values to be returned- Returns:
- the up mentioned map
-
canBeClosed
public boolean canBeClosed()Determines if the dialog can be closedFor a InputDialog, it can be closed when all the required input fields have been filled
- Overrides:
canBeClosed
in classDialog
- Returns:
- true if the dialog can be closed, false otherwise
-
onQuit
public void onQuit()Determines the Dialog behaviour when it is asked to close itselfFor an InputDialog, all of its inputs are passed to the inputManager
-
getTextColor
public java.lang.String getTextColor()Provides the first WindowItem.activeItems textColor- Overrides:
getTextColor
in classRectangle
- Returns:
- the first item's text color scheme
-
show
public void show()Draws itself -
onArrowRight
public void onArrowRight()Selects the next ActiveItem on the Dialog -
onArrowLeft
public void onArrowLeft()Selects the previous ActiveItem on the Dialog -
onCarriageReturn
public void onCarriageReturn()Performs an action based on the currently selected ActiveItem -
onTab
public void onTab()Selects the next ActiveItem on the Dialog -
onArrowUp
public void onArrowUp()Selects the previous ActiveItem on the Dialog -
onArrowDown
public void onArrowDown()Selects the next ActiveItem on the Dialog
-