java.lang.Object
it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
- Direct Known Subclasses:
ActiveItem
,DetailPane
,LoggerPane
,Window
public abstract class WindowItem extends Rectangle
An abstraction for any kind of item that can be put inside a window, including a window itself
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Deque<ActiveItem>
activeItems
A list containing all the active itemsprotected java.lang.String
id
The item idprotected WindowItem
parent
The window which invoked the dialogprotected java.util.List<WindowItem>
passiveItems
A list containing all non-active items (e.g. -
Constructor Summary
Constructors Modifier Constructor Description protected
WindowItem(WindowItem parent, CursorPosition initCoord, int width, int height, java.lang.String id)
Custom constructorprotected
WindowItem(WindowItem parent, CursorPosition initCoord, java.lang.String id)
Default constructorprotected
WindowItem(Window parent, java.lang.String id)
Window constructor -
Method Summary
Modifier and Type Method Description protected void
addActiveItem(ActiveItem item)
Adds a new active item to the items listprotected void
addPassiveItem(WindowItem item)
Adds a new item to the items listprotected ActiveItem
currentActiveItem()
Provides the dialog item which is currently selectedprotected void
drawShadows()
Draws right and bottom shadows
Uses the parent color scheme, to merge seamlessly with the backgroundprotected CLI
getCli()
cli getterjava.lang.String
getID()
id getterWindowItem
getParent()
parent getterprotected void
hideShadows()
Hides the shadowsstatic int
maxStringLength(java.util.List<java.lang.String> strings)
Provides the length of the longest string in a listprotected ActiveItem
nextActiveItem()
Retrieves the next itemprotected ActiveItem
previousActiveItem()
Retrieves the previous itemvoid
remove()
Removes itself, restoring the underlying dialogsvoid
show()
Prints the object on the screenMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getBackgroundColor, getColor, getHeight, getInitCoord, getTextColor, getWidth, hideBorders, loadPropertiesFile
-
Field Details
-
parent
The window which invoked the dialog -
id
protected final java.lang.String idThe item id -
activeItems
A list containing all the active items -
passiveItems
A list containing all non-active items (e.g. DetailPane)
-
-
Constructor Details
-
WindowItem
Window constructorCreates a Window using its default settings
- Parameters:
parent
- the Window containing thisid
- the object id
-
WindowItem
Default constructorCreates an item using its default settings;
The initial coordinates are relative to the object's parent- Parameters:
parent
- the Window containing thisinitCoord
- the item coordinatesid
- the object id
-
WindowItem
protected WindowItem(WindowItem parent, CursorPosition initCoord, int width, int height, java.lang.String id)Custom constructorCreates an item using custom settings
The initial coordinates are relative to the object's parent- Parameters:
parent
- the Dialog containing thisinitCoord
- the item coordinateswidth
- the object widthheight
- the object heightid
- the object id
-
-
Method Details
-
getCli
cli getter- Returns:
- null, if not overridden
-
addActiveItem
Adds a new active item to the items list- Parameters:
item
- the item to add
-
addPassiveItem
Adds a new item to the items list- Parameters:
item
- the item to add
-
currentActiveItem
Provides the dialog item which is currently selected- Returns:
- the currently selected active item
-
nextActiveItem
Retrieves the next item- Returns:
- the next item in the deque
-
previousActiveItem
Retrieves the previous item- Returns:
- the previous item in the deque
-
maxStringLength
public static int maxStringLength(java.util.List<java.lang.String> strings)Provides the length of the longest string in a list- Parameters:
strings
- the list of strings- Returns:
- the length of the longest string
-
getParent
parent getter- Returns:
- this item's parent
-
getID
public java.lang.String getID()id getter- Returns:
- the WindowItem id
-
drawShadows
protected void drawShadows()Draws right and bottom shadows
Uses the parent color scheme, to merge seamlessly with the background- Overrides:
drawShadows
in classRectangle
-
hideShadows
protected void hideShadows()Hides the shadows- Overrides:
hideShadows
in classRectangle
-
show
public void show()Prints the object on the screen -
remove
public void remove()Removes itself, restoring the underlying dialogs
-