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
- All Implemented Interfaces:
Toggleable
,KeyEventListener
- Direct Known Subclasses:
Button
,GridOverlay
,ListPane
,SimpleListItem
,SingleChoiceListPane
,TextBox
public abstract class ActiveItem extends WindowItem implements Toggleable
An abstraction for any object containable in a Window
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
activeItems, id, parent, passiveItems
-
Constructor Summary
Constructors Modifier Constructor Description protected
ActiveItem(WindowItem parent, CursorPosition initCoord, int width, int height, java.lang.String id)
Custom constructorprotected
ActiveItem(WindowItem parent, CursorPosition initCoord, java.lang.String id)
Default constructor -
Method Summary
Modifier and Type Method Description void
enable()
Enables the componentjava.lang.String
getBackgroundColor()
background gettervoid
onDisable()
Disables the componentabstract void
onRelease()
Defines the object behaviour when releasedabstract void
onSelect()
Defines the object behaviour when selectedMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getCli, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem, remove, show
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
onArrowDown, onArrowLeft, onArrowRight, onArrowUp, onBackspace, onCarriageReturn, onPrintableKey, onTab
-
Constructor Details
-
ActiveItem
Default constructorCreates an active item using its default settings;
The initial coordinates are relative to the object's parent- Parameters:
parent
- the Window containing thisinitCoord
- the itemid
- the object id
-
ActiveItem
protected ActiveItem(WindowItem parent, CursorPosition initCoord, int width, int height, java.lang.String id)Custom constructorCreates an active item using custom settings
The initial coordinates are relative to the object's parent- Parameters:
parent
- the Window containing thisinitCoord
- the item coordinateswidth
- the object widthheight
- the object heightid
- the object id
-
-
Method Details
-
getBackgroundColor
public java.lang.String getBackgroundColor()background getter- Overrides:
getBackgroundColor
in classRectangle
- Returns:
- the parent's background color
-
onSelect
public abstract void onSelect()Defines the object behaviour when selected -
onRelease
public abstract void onRelease()Defines the object behaviour when released -
enable
public void enable()Enables the component- Specified by:
enable
in interfaceToggleable
-
onDisable
public void onDisable()Disables the component- Specified by:
onDisable
in interfaceToggleable
-