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
- All Implemented Interfaces:
KeyEventListener
- Direct Known Subclasses:
BoardUtils,Console,Dialog
public abstract class Window extends WindowItem implements KeyEventListener
General abstraction for a window
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String[][]backgroundThe window backgroundprotected CLIcliThe View objectprotected booleanenableInputOnReturnDetermines if the console input has to be enabled when closing thisprotected CursorPositionreturnToThe cursor position to restore on window exitFields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
activeItems, id, parent, passiveItems -
Constructor Summary
Constructors Constructor Description Window(CLI cli)Console constructor
Creates the initial window, centeredWindow(Window parent, int width, int height, CursorPosition initCoord, java.lang.String id)Custom constructor
Creates a custom sized windowWindow(Window parent, java.lang.String id)Default constructor
Creates a new Window, loading its settings from file -
Method Summary
Modifier and Type Method Description voidaddToBackground(PrintableObject obj, CursorPosition coord)Adds a PrintableObject to the backgroundCLIgetCli()cli getterCursorPositiongetReturnTo()returnTo gettervoidshow()Shows the window on the consoleMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem, removeMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getBackgroundColor, 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
onArrowDown, onArrowLeft, onArrowRight, onArrowUp, onBackspace, onCarriageReturn, onPrintableKey, onTab
-
Field Details
-
enableInputOnReturn
protected final boolean enableInputOnReturnDetermines if the console input has to be enabled when closing this -
returnTo
The cursor position to restore on window exit -
cli
The View object -
background
protected final java.lang.String[][] backgroundThe window background
-
-
Constructor Details
-
Window
Console constructor
Creates the initial window, centered -
Window
Default constructor
Creates a new Window, loading its settings from file- Parameters:
parent- the parentid- the Window id
-
Window
Custom constructor
Creates a custom sized window- Parameters:
width- the window widthheight- the window heightinitCoord- the window initial coordinatesparent- the callerid- the Window id
-
-
Method Details
-
getCli
cli getter- Overrides:
getCliin classWindowItem- Returns:
- the cli containing this
-
getReturnTo
returnTo getter- Returns:
- the cursor position to restore when closing the window
-
addToBackground
Adds a PrintableObject to the background- Parameters:
obj- the printableObject to addcoord- the starting coordinates of the scene
-
show
public void show()Shows the window on the console- Overrides:
showin classWindowItem
-