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 voidenable()Enables the componentvoidonArrowDown()Moves to the cell immediately below the current one, highlighting it;voidonArrowLeft()Moves to the cell immediately on the left of the current one, highlighting it;voidonArrowRight()Moves to the cell immediately on the right of the current one, highlighting it;voidonArrowUp()Moves to the cell immediately above the current one, highlighting it;voidonCarriageReturn()Returns the currently selected cell to the inputManagervoidonDisable()Disables the componentvoidonRelease()Defines the object behaviour when releasedvoidonSelect()Defines the object behaviour when selectedvoidsetHighlightedCells(java.util.List<Cell> highlightedCells)Sets the cells to highlight, valid until this gets disabledvoidshow()(Does not) print the object on the screenMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.ActiveItem
getBackgroundColorMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getCli, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem, removeMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getColor, getHeight, getInitCoord, getTextColor, 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, 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:
onSelectin classActiveItem
-
onRelease
public void onRelease()Defines the object behaviour when released- Specified by:
onReleasein classActiveItem
-
enable
public void enable()Enables the component- Specified by:
enablein interfaceToggleable- Overrides:
enablein classActiveItem
-
onDisable
public void onDisable()Disables the component- Specified by:
onDisablein interfaceToggleable- Overrides:
onDisablein classActiveItem
-
onArrowUp
public void onArrowUp()Moves to the cell immediately above the current one, highlighting it;- Specified by:
onArrowUpin interfaceKeyEventListener
-
onArrowDown
public void onArrowDown()Moves to the cell immediately below the current one, highlighting it;- Specified by:
onArrowDownin interfaceKeyEventListener
-
onArrowRight
public void onArrowRight()Moves to the cell immediately on the right of the current one, highlighting it;- Specified by:
onArrowRightin interfaceKeyEventListener
-
onArrowLeft
public void onArrowLeft()Moves to the cell immediately on the left of the current one, highlighting it;- Specified by:
onArrowLeftin interfaceKeyEventListener
-
onCarriageReturn
public void onCarriageReturn()Returns the currently selected cell to the inputManager- Specified by:
onCarriageReturnin interfaceKeyEventListener
-
show
public void show()(Does not) print the object on the screen- Overrides:
showin classWindowItem
-