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[][]
background
The window backgroundprotected CLI
cli
The View objectprotected boolean
enableInputOnReturn
Determines if the console input has to be enabled when closing thisprotected CursorPosition
returnTo
The 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 void
addToBackground(PrintableObject obj, CursorPosition coord)
Adds a PrintableObject to the backgroundCLI
getCli()
cli getterCursorPosition
getReturnTo()
returnTo gettervoid
show()
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, remove
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getBackgroundColor, 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
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:
getCli
in 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:
show
in classWindowItem
-