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.ActiveItem
it.polimi.ingsw.view.cli.console.graphics.GridOverlay
- All Implemented Interfaces:
Toggleable
,KeyEventListener
public final class GridOverlay extends ActiveItem implements Toggleable
An invisible overlay to select the cells on the board
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
activeItems, id, parent, passiveItems
-
Constructor Summary
Constructors Constructor Description GridOverlay(Window parent, CursorPosition initCoord, FancyPrinterBoardUtils printer, java.lang.String id)
-
Method Summary
Modifier and Type Method Description void
enable()
Enables the componentvoid
onArrowDown()
Moves to the cell immediately below the current one, highlighting it;void
onArrowLeft()
Moves to the cell immediately on the left of the current one, highlighting it;void
onArrowRight()
Moves to the cell immediately on the right of the current one, highlighting it;void
onArrowUp()
Moves to the cell immediately above the current one, highlighting it;void
onCarriageReturn()
Returns the currently selected cell to the inputManagervoid
onDisable()
Disables the componentvoid
onRelease()
Defines the object behaviour when releasedvoid
onSelect()
Defines the object behaviour when selectedvoid
setHighlightedCells(java.util.List<Cell> highlightedCells)
Sets the cells to highlight, valid until this gets disabledvoid
show()
(Does not) print the object on the screenMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.ActiveItem
getBackgroundColor
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getCli, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem, remove
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getColor, getHeight, getInitCoord, getTextColor, 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, onTab
-
Constructor Details
-
GridOverlay
public GridOverlay(Window parent, CursorPosition initCoord, FancyPrinterBoardUtils printer, java.lang.String id) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Details
-
setHighlightedCells
Sets the cells to highlight, valid until this gets disabled- Parameters:
highlightedCells
- the cells to highlight
-
onSelect
public void onSelect()Defines the object behaviour when selected- Specified by:
onSelect
in classActiveItem
-
onRelease
public void onRelease()Defines the object behaviour when released- Specified by:
onRelease
in classActiveItem
-
enable
public void enable()Enables the component- Specified by:
enable
in interfaceToggleable
- Overrides:
enable
in classActiveItem
-
onDisable
public void onDisable()Disables the component- Specified by:
onDisable
in interfaceToggleable
- Overrides:
onDisable
in classActiveItem
-
onArrowUp
public void onArrowUp()Moves to the cell immediately above the current one, highlighting it;- Specified by:
onArrowUp
in interfaceKeyEventListener
-
onArrowDown
public void onArrowDown()Moves to the cell immediately below the current one, highlighting it;- Specified by:
onArrowDown
in interfaceKeyEventListener
-
onArrowRight
public void onArrowRight()Moves to the cell immediately on the right of the current one, highlighting it;- Specified by:
onArrowRight
in interfaceKeyEventListener
-
onArrowLeft
public void onArrowLeft()Moves to the cell immediately on the left of the current one, highlighting it;- Specified by:
onArrowLeft
in interfaceKeyEventListener
-
onCarriageReturn
public void onCarriageReturn()Returns the currently selected cell to the inputManager- Specified by:
onCarriageReturn
in interfaceKeyEventListener
-
show
public void show()(Does not) print the object on the screen- Overrides:
show
in classWindowItem
-