ActiveBoxGrid
Extends: module:boxes/ActiveBoxBag.ActiveBoxBag
Source: ActiveBoxGrid.js:44
This class extends ActiveBoxBag with constructors that take an argument of type
Shaper used to build all its ActiveBoxcomponents. It also maintains information
about the number of "rows" and "columns", useful to compute valid (integer) values when
resizing or moving its components.
Constructor
new ActiveBoxGrid(
parent: module:boxes/AbstractBox.AbstractBox,
container: module:AWT.Container,
boxBase: module:boxes/BoxBase,
px: number,
py: number,
setWidth: number,
setHeight: number,
sh: module:shapers/Shaper.Shaper,
): ActiveBoxGridActiveBxGrid constructor
Parameters
parent(module:boxes/AbstractBox.AbstractBox) — The AbstractBox to which this box grid belongscontainer(module:AWT.Container) — The container where this box grid is placed.boxBase(module:boxes/BoxBase) — The object where colors, fonts, border and other graphic propertiespx(number) —Xcoordinate of the upper left corner of this box gridpy(number) —Ycoordinate of the upper left corner of this box gridsetWidth(number) — Total width of the box gridsetHeight(number) — Total height of the box gridsh(module:shapers/Shaper.Shaper) — Shaper used to build the ActiveBox objects
Instance Methods
getMinimumSize(): module:AWT.Dimension
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getMinimumSize
Gets the minimum size of this grid
Returns
getScaledSize(scale: number): module:AWT.Dimension
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getScaledSize
Gets a scaled size of this grid, rounded to the nearest integer values
Parameters
scale(number) — The scale factor
Returns
getCoord(bx: module:boxes/ActiveBox.ActiveBox): module:AWT.Point
Returns the logical coordinates of the provided ActiveBox.
The units of the result are not pixels, but ordinal numbers (relative positions) of columns
and rows in the grid.
Parameters
bx(module:boxes/ActiveBox.ActiveBox) — The box to process
Returns
getCoordDist(
src: module:boxes/ActiveBox.ActiveBox,
dest: module:boxes/ActiveBox.ActiveBox,
): module:AWT.Point
Calculates the logical distance between two ActiveBox objects.
Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows
in the grid.
Parameters
src(module:boxes/ActiveBox.ActiveBox) — First boxdest(module:boxes/ActiveBox.ActiveBox) — Second box
Returns
addActiveBox(bx: module:boxes/ActiveBox.ActiveBox)
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#addActiveBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#addActiveBox
Adds an ActiveBox to this bag
Parameters
bx(module:boxes/ActiveBox.ActiveBox) — The ActiveBox to be added to this bag
getActiveBox(idLoc: number): module:boxes/ActiveBox.ActiveBox
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#getActiveBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getActiveBox
Finds an ActiveBox by its relative location (idLoc field)
Parameters
idLoc(number)
Returns
getBackgroundActiveBox(): module:boxes/ActiveBox.ActiveBox
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#getBackgroundActiveBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getBackgroundActiveBox
Gets the background box
Returns
setContent(
abc: module:boxes/ActiveBagContent.ActiveBagContent,
altAbc?: module:boxes/ActiveBagContent.ActiveBagContent,
fromIndex?: number,
toCell?: number,
numCells?: number,
)
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#setContent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setContent
Sets the content of members of this ActiveBoxBag, based on one or more ActiveBagContent
objects.
Parameters
abc(module:boxes/ActiveBagContent.ActiveBagContent) — The main bag of contentaltAbc(module:boxes/ActiveBagContent.ActiveBagContent, optional) — The alternative bag of contentfromIndex(number, optional) — Starts taking the cell content located at this position on the bagtoCell(number, optional) — Starts filling the box located at this position on the ActiveBoxBagnumCells(number, optional) — Acts only with a limited number of elements.
findActiveBox(
point: module:AWT.Point,
): module:boxes/ActiveBox.ActiveBox
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#findActiveBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#findActiveBox
Finds an ActiveBox by location
Parameters
point(module:AWT.Point) — The location to search for
Returns
clearAllBoxes()
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#clearAllBoxes
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#clearAllBoxes
Clears the content of all boxes
clearAll()
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#clearAll
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#clearAll
Clears the content of all boxes and background box
countCellsAtPlace(): number
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#countCellsAtPlace
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#countCellsAtPlace
Count the number of cells that are at its original place
Returns
number
getActiveBoxWithIdLoc(
idLoc: number,
): module:boxes/ActiveBox.ActiveBox
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#getActiveBoxWithIdLoc
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getActiveBoxWithIdLoc
Finds the ActiveBox that has the specified idLoc attribute
Parameters
idLoc(number) — The idLoc to search for
Returns
cellIsAtEquivalentPlace(
bx: module:boxes/ActiveBox.ActiveBox,
checkCase: boolean,
): boolean
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#cellIsAtEquivalentPlace
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#cellIsAtEquivalentPlace
Checks if the place occupied by a cell corresponds to a cell with equivalent content.
Parameters
bx(module:boxes/ActiveBox.ActiveBox) — The box to checkcheckCase(boolean) — Iftrue, check case when comparing texts
Returns
boolean
countCellsAtEquivalentPlace(checkCase: boolean): number
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#countCellsAtEquivalentPlace
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#countCellsAtEquivalentPlace
Count the number of cells that are at its original place or equivalent
Parameters
checkCase(boolean)
Returns
number
countCellsWithIdAss(idAss: number): number
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#countCellsWithIdAss
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#countCellsWithIdAss
Counts the number of cells that have the provided idAss attribute
Parameters
idAss(number) — TheidAssattribute to search
Returns
number
setDefaultIdAss()
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#setDefaultIdAss
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setDefaultIdAss
Resets the default idAss attribute on all cells
shuffleCells(times: number, fitInArea: boolean)
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#shuffleCells
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#shuffleCells
Shuffles the cells
Parameters
times(number) — Number of times to shufflefitInArea(boolean) — Ensure that all cells are inside the bag rectangle
fitCellsInArea(boxes: Array.<module:boxes/ActiveBox.ActiveBox>)
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#fitCellsInArea
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#fitCellsInArea
Fits cells inside the ActiveBoxBag area. Useful when non-rectangular cells exchange its positions.
Parameters
boxes(Array.<module:boxes/ActiveBox.ActiveBox>) — The boxes to be checked
swapCellPositions(
bxa: module:boxes/ActiveBox.ActiveBox,
bxb: module:boxes/ActiveBox.ActiveBox,
fitInArea: boolean,
)
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#swapCellPositions
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#swapCellPositions
Exchange the positions of two cells inside the ActiveBoxBag area.
Parameters
bxa(module:boxes/ActiveBox.ActiveBox) — The first boxbxb(module:boxes/ActiveBox.ActiveBox) — The second boxfitInArea(boolean) — Ensure that all cells are inside the bag rectangle
resetIds()
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#resetIds
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#resetIds
Resets the IDs of all cells
getNextItem(currentItem: number, idAssValid?: string): number
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#getNextItem
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getNextItem
Gets the index of box located in the cells array after the provided index, having the
provided idAssValid value as idAss attribute.
When idAssValid is null or undefined, search for the next cell with idAss>0
Parameters
currentItem(number) — The index after to which start scanningidAssValid(string, optional) — TheidAssattribute value to search
Returns
number
buildAccessibleElements(
$canvas: external:jQuery,
$clickReceiver: external:jQuery,
eventType?: string,
): external:jQuery
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#buildAccessibleElements
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#buildAccessibleElements
Builds a group of hidden buton elements that will act as a accessible objects associated
to the canvas area of this ActiveBoxBag.
The buttons will only be created when CanvasRenderingContext2D has a method named addHitRegion.
See https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Hit_regions_and_accessibility
for more information and supported browsers.
Parameters
$canvas(external:jQuery) — Thecanvaswhere thisActiveBoxBagwill deploy, wrapped up in a jQuery object$clickReceiver(external:jQuery) — The DOM element that will be notified when a button is clicked.eventType(string, optional) — Type of event sent to $clickReceiver. Default isclick.
Returns
getPreferredSize(): module:AWT.Dimension
Inherited from module:boxes/BoxBag.BoxBag#getPreferredSize
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getPreferredSize
Gets the preferred size of this BoxBag
Returns
addBox(bx: module:boxes/AbstractBox.AbstractBox)
Inherited from module:boxes/BoxBag.BoxBag#addBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#addBox
Adds an AbstractBox to the collection of cells
Parameters
bx(module:boxes/AbstractBox.AbstractBox) — The box to add
boxIndex(bx: module:boxes/AbstractBox.AbstractBox): number
Inherited from module:boxes/BoxBag.BoxBag#boxIndex
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#boxIndex
Returns the index of a specific box in the cells array
Parameters
Returns
number
getBox(n: number): module:boxes/AbstractBox.AbstractBox
Inherited from module:boxes/BoxBag.BoxBag#getBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getBox
Returns the box at a specific index in the cells array
Parameters
n(number) — The index
Returns
getBackgroundBox(): module:boxes/AbstractBox.AbstractBox
Inherited from module:boxes/BoxBag.BoxBag#getBackgroundBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getBackgroundBox
Gets the background box
Returns
setBackgroundBox(bx: module:boxes/AbstractBox.AbstractBox)
Inherited from module:boxes/BoxBag.BoxBag#setBackgroundBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setBackgroundBox
Sets the background box
Parameters
recalcSize()
Inherited from module:boxes/BoxBag.BoxBag#recalcSize
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#recalcSize
Recalculates the total size of this BoxBag (useful after direct additions o deletions of
elements in the cells array).
Updates preferredBounds and the current position and size of the box bag.
getNumCells(): number
Inherited from module:boxes/BoxBag.BoxBag#getNumCells
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getNumCells
Returns the number of cells stored in this BoxBag
Returns
number
setCellAttr(key: string, value: any)
Inherited from module:boxes/BoxBag.BoxBag#setCellAttr
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setCellAttr
Sets the specified key - value pair to all cells of this bag.
Parameters
key(string) — The key to be establishedvalue(any) — The value, of any type
setBorder(newVal: boolean)
Inherited from module:boxes/BoxBag.BoxBag#setBorder
Overrides module:boxes/AbstractBox.AbstractBox#setBorder iterating over all the cells stored in this box bag.
Parameters
newVal(boolean) — Whether to set or unset the border
setVisible(newVal: boolean)
Inherited from module:boxes/BoxBag.BoxBag#setVisible
Overrides module:boxes/AbstractBox.AbstractBox#setVisible iterating over all the cells stored in this box bag.
Parameters
newVal(boolean) — Whether to set the cells visible or not
setAlternative(newVal: boolean)
Inherited from module:boxes/BoxBag.BoxBag#setAlternative
Overrides module:boxes/AbstractBox.AbstractBox#setAlternative iterating over all the cells stored in this box bag.
Parameters
newVal(boolean) — Whether to set or unset the cells in "alternative" mode
setBounds(
rect: AWT.Rectangle | number,
ry?: number,
rw?: number,
rh?: number,
): module:AWT.Rectangle
Inherited from module:boxes/BoxBag.BoxBag#setBounds
Overrides module:boxes/AbstractBox.AbstractBox#setBounds adjusting the position and size of all cells
Parameters
rect(AWT.Rectangle | number) — An AWT.Rectangle object, or thexcoordinate of the
upper-left corner of a new rectangle.ry(number, optional) —ycoordinate of the upper-left corner of the new rectangle.rw(number, optional) — Width of the new rectangle.rh(number, optional) — Height of the new rectangle.
Returns
update(
ctx: external:CanvasRenderingContext2D,
dirtyRegion?: module:AWT.Rectangle,
)
Inherited from module:boxes/BoxBag.BoxBag#update
Performs graphics operations for each cell.
Overrides module:boxes/AbstractBox.AbstractBox#update
Parameters
ctx(external:CanvasRenderingContext2D) — The canvas rendering context used to draw the
box contents.dirtyRegion(module:AWT.Rectangle, optional) — The area that must be repainted.nullrefers to the whole box.
findBox(
p: module:AWT.Point,
): module:boxes/AbstractBox.AbstractBox
Inherited from module:boxes/BoxBag.BoxBag#findBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#findBox
Finds the first visible AbstractBox located under the specified point
Parameters
p(module:AWT.Point)
Returns
countInactiveCells(): number
Inherited from module:boxes/BoxBag.BoxBag#countInactiveCells
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#countInactiveCells
Count the number of cells of this BoxBag that are in "inactive" state
Returns
number
setParent(parent: module:boxes/AbstractBox.AbstractBox)
Inherited from module:boxes/AbstractBox.AbstractBox#setParent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setParent
Setter method for parent
Parameters
parent(module:boxes/AbstractBox.AbstractBox) — The new parent of this box
getParent(): module:boxes/AbstractBox.AbstractBox
Inherited from module:boxes/AbstractBox.AbstractBox#getParent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getParent
Gets the current parent of this box
Returns
end()
Inherited from module:boxes/AbstractBox.AbstractBox#end
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#end
Finisher method
setContainer(newContainer: module:AWT.Container)
Inherited from module:boxes/AbstractBox.AbstractBox#setContainer
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setContainer
Setter method for container
Parameters
newContainer(module:AWT.Container) — The new Container assigned to this box
getContainerX(): module:AWT.Container
Inherited from module:boxes/AbstractBox.AbstractBox#getContainerX
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getContainerX
Gets the container attribute of this box, without checking its parent
Returns
getContainerResolve(): module:AWT.Container
Inherited from module:boxes/AbstractBox.AbstractBox#getContainerResolve
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getContainerResolve
Gets the container associated to this box, asking its parents when null.
Returns
invalidate(rect: module:AWT.Rectangle)
Inherited from module:boxes/AbstractBox.AbstractBox#invalidate
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#invalidate
Invalidates the zone corresponding to this box in the associated module:AWT.Container, if any.
Parameters
rect(module:AWT.Rectangle) — The rectangle to be invalidated. Whennull, it's the full
container area.
setBoxBase(boxBase: module:boxes/BoxBase.BoxBase)
Inherited from module:boxes/AbstractBox.AbstractBox#setBoxBase
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setBoxBase
Sets the BoxBase of this box
Parameters
boxBase(module:boxes/BoxBase.BoxBase) — The new BoxBase
getBoxBaseResolve(): module:boxes/BoxBase.BoxBase
Inherited from module:boxes/AbstractBox.AbstractBox#getBoxBaseResolve
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getBoxBaseResolve
Gets the real BoxBase associated to this box, scanning down parent relationships.
Returns
setShape(sh: module:AWT.Shape)
Inherited from module:boxes/AbstractBox.AbstractBox#setShape
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setShape
Sets the shape used to draw the content of this box
Parameters
sh(module:AWT.Shape) — The shape to be set
getShape(): module:AWT.Shape
Inherited from module:boxes/AbstractBox.AbstractBox#getShape
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getShape
Gets the current shape used in this box
Returns
contains(p: module:AWT.Point): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#contains
Check if this box contains the specified point
Parameters
p(module:AWT.Point) — The point to be checked
Returns
boolean
moveTo(newPos: AWT.Point | number, y?: number)
Inherited from module:boxes/AbstractBox.AbstractBox#moveTo
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#moveTo
Sets a new location for this box. In JClic this method was named setLocation
Parameters
newPos(AWT.Point | number) — A point or thexcoordinate of a new point.y(number, optional) — Theycoordinate of a new point.
moveBy(dx: number, dy: number)
Inherited from module:boxes/AbstractBox.AbstractBox#moveBy
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#moveBy
Sets a new location to this box. In JClic this method was named translate.
Parameters
dx(number) — The displacement on the X axisdy(number) — The displacement on the Y axis
setSize(width: number, height: number)
Inherited from module:boxes/AbstractBox.AbstractBox#setSize
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setSize
Changes the size of this box
Parameters
width(number)height(number)
hasBorder(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#hasBorder
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#hasBorder
Checks if this box has border
Returns
boolean
isVisible(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#isVisible
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isVisible
Checks if this box is fully visible
Returns
boolean
setHostedComponentVisible()
Inherited from module:boxes/AbstractBox.AbstractBox#setHostedComponentVisible
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setHostedComponentVisible
Makes module:boxes/AbstractBox.AbstractBox#$hostedComponent visible or invisible, based on the value of
the AbstractBox visible flag.
isTemporaryHidden(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#isTemporaryHidden
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isTemporaryHidden
Checks if this box is temporary hidden
Returns
boolean
setTemporaryHidden(newVal: boolean)
Inherited from module:boxes/AbstractBox.AbstractBox#setTemporaryHidden
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setTemporaryHidden
Makes this box temporary hidden (newVal true) or resets its original state (newVal false)
Parameters
newVal(boolean)
isInactive(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#isInactive
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isInactive
Checks if this box is currently inactive.
Returns
boolean
setInactive(newVal: boolean)
Inherited from module:boxes/AbstractBox.AbstractBox#setInactive
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setInactive
Makes this box active (false) or inactive (true)
Parameters
newVal(boolean)
isInverted(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#isInverted
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isInverted
Checks if this box is in inverted state.
Returns
boolean
setInverted(newVal: boolean)
Inherited from module:boxes/AbstractBox.AbstractBox#setInverted
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setInverted
Puts this box in inverted mode or restores its original state.
Parameters
newVal(boolean)
isMarked(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#isMarked
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isMarked
Checks if this box is marked
Returns
boolean
setMarked(newVal: boolean)
Inherited from module:boxes/AbstractBox.AbstractBox#setMarked
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setMarked
Sets this box in marked mode, or restores its original state.
Parameters
newVal(boolean)
isFocused(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#isFocused
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isFocused
Checks if this box has the input focus
Returns
boolean
setFocused(newVal: boolean)
Inherited from module:boxes/AbstractBox.AbstractBox#setFocused
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setFocused
Sets or unsets the input focus to this box.
Parameters
newVal(boolean)
isAlternative(): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#isAlternative
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isAlternative
Checks if this box is in alternative state.
Returns
boolean
updateContent(
_ctx: external:CanvasRenderingContext2D,
_dirtyRegion?: module:AWT.Rectangle,
)
Inherited from module:boxes/AbstractBox.AbstractBox#updateContent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#updateContent
Here is where classes derived from AbstractBox should implement the drawing of its
content. Background and border are already painted in module:boxes/AbstractBox.AbstractBox#update.
Parameters
_ctx(external:CanvasRenderingContext2D) — The canvas rendering context used to draw the
box content._dirtyRegion(module:AWT.Rectangle, optional) — The area that must be repainted.nullrefers to the whole box.
drawBorder(ctx: external:CanvasRenderingContext2D)
Inherited from module:boxes/AbstractBox.AbstractBox#drawBorder
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#drawBorder
Draws the box border
Parameters
ctx(external:CanvasRenderingContext2D) — The canvas rendering context where the border
will be drawn.
getBorderBounds(): module:AWT.Rectangle
Inherited from module:boxes/AbstractBox.AbstractBox#getBorderBounds
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getBorderBounds
Returns the enclosing Rectangle of this box including its border (if any)
Returns
setHostedComponent($hc: external:jQuery)
Inherited from module:boxes/AbstractBox.AbstractBox#setHostedComponent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setHostedComponent
Sets the $hostedComponent member.
Parameters
$hc(external:jQuery) — The jQuery DOM component hosted by this box.
getHostedComponent(): external:jQuery
Inherited from module:boxes/AbstractBox.AbstractBox#getHostedComponent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getHostedComponent
Gets the current $hostedComponent member
Returns
setHostedComponentColors()
Inherited from module:boxes/AbstractBox.AbstractBox#setHostedComponentColors
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setHostedComponentColors
Sets $hostedComponent colors and other css properties
based on the current BoxBase of this box.
setHostedComponentBorder()
Inherited from module:boxes/AbstractBox.AbstractBox#setHostedComponentBorder
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setHostedComponentBorder
Sets the $hostedComponent border, based on the current
BoxBase of this box.
setHostedComponentBounds(_sizeChanged: boolean)
Inherited from module:boxes/AbstractBox.AbstractBox#setHostedComponentBounds
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setHostedComponentBounds
Places and resizes $hostedComponent, based on the size
and position of this box.
Parameters
_sizeChanged(boolean) —truewhen this ActiveBox has changed its size
getBounds(): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#getBounds
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getBounds
Gets the enclosing Rectangle of this Shape.
Returns
equals(r: module:AWT.Shape): boolean
Inherited from module:AWT.Rectangle#equals
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#equals
Checks if two shapes are equivalent.
Parameters
r(module:AWT.Shape) — The Shape to compare against
Returns
boolean
clone(): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#clone
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#clone
Clones this Rectangle
Returns
scaleBy(delta: Point | Dimension): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#scaleBy
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#scaleBy
Multiplies the dimension of the Shape by the specified delta amount.
Parameters
Returns
grow(dx: number, dy: number): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#grow
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#grow
Expands the boundaries of this shape. This affects the current position and dimension.
Parameters
dx(number) — The amount to grow (or decrease) in horizontal directiondy(number) — The amount to grow (or decrease) in vertical direction
Returns
getOppositeVertex(): module:AWT.Point
Inherited from module:AWT.Rectangle#getOppositeVertex
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getOppositeVertex
Gets the module:AWT.Point corresponding to the lower-right vertex of the Rectangle.
Returns
add(shape: module:AWT.Shape): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#add
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#add
Adds the boundaries of another shape to the current one
Parameters
shape(module:AWT.Shape) — The module:AWT.Shape to be added
Returns
getCoords(): string
Inherited from module:AWT.Rectangle#getCoords
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getCoords
Gets a string with the co-ordinates of the upper-left and lower-right vertexs of this rectangle,
(with values rounded to int)
Returns
string
getAttributes(): object
Inherited from module:AWT.Rectangle#getAttributes
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#getAttributes
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
Returns
object
setAttributes(data: object): module:AWT.Rectangle
Inherited from module:AWT.Rectangle#setAttributes
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#setAttributes
Reads the properties of this Rectangle from a data object
Parameters
data(object) — The data object to be parsed
Returns
intersects(_r: module:AWT.Rectangle): boolean
Inherited from module:AWT.Shape#intersects
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#intersects
Checks if the provided Rectangle r intersects with this shape.
Parameters
_r(module:AWT.Rectangle)
Returns
boolean
fill(
ctx: external:CanvasRenderingContext2D,
dirtyRegion?: module:AWT.Rectangle,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#fill
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#fill
Fills the Shape with the current style in the provided HTML canvas context
Parameters
ctx(external:CanvasRenderingContext2D) — The canvas 2D rendering context where to fill this shape.dirtyRegion(module:AWT.Rectangle, optional) — The context region to be updated. Used as clipping
region when drawing.
Returns
stroke(
ctx: external:CanvasRenderingContext2D,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#stroke
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#stroke
Draws this shape in the provided HTML canvas 2D rendering context.
Parameters
ctx(external:CanvasRenderingContext2D) — The canvas 2D rendering context where to draw the shape.
Returns
preparePath(
ctx: external:CanvasRenderingContext2D,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#preparePath
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#preparePath
Prepares an HTML canvas 2D rendering context with a path that can be used to stroke a line,
to fill a surface or to define a clipping region.
Parameters
Returns
clip(
ctx: external:CanvasRenderingContext2D,
fillRule?: string,
): external:CanvasRenderingContext2D
Inherited from module:AWT.Shape#clip
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#clip
Creates a clipping region on the specified HTML canvas 2D rendering context
Parameters
ctx(external:CanvasRenderingContext2D) — The rendering contextfillRule(string, optional, default: "'nonzero'") — Can be 'nonzero' (default when not set) or 'evenodd'
Returns
isRect(): boolean
Inherited from module:AWT.Shape#isRect
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#isRect
Shorthand method for determining if a Shape is an Rectangle
Returns
boolean
toString(): string
Inherited from module:AWT.Shape#toString
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#toString
Overwrites the original 'Object.toString' method with a more descriptive text
Returns
string
setBorder(newVal: boolean)
Inherited from module:boxes/BoxBag.BoxBag#setBorder
Overrides module:boxes/AbstractBox.AbstractBox#setBorder iterating over all the cells stored in this box bag.
Parameters
newVal(boolean) — Whether to set or unset the border
setVisible(newVal: boolean)
Inherited from module:boxes/BoxBag.BoxBag#setVisible
Overrides module:boxes/AbstractBox.AbstractBox#setVisible iterating over all the cells stored in this box bag.
Parameters
newVal(boolean) — Whether to set the cells visible or not
setAlternative(newVal: boolean)
Inherited from module:boxes/BoxBag.BoxBag#setAlternative
Overrides module:boxes/AbstractBox.AbstractBox#setAlternative iterating over all the cells stored in this box bag.
Parameters
newVal(boolean) — Whether to set or unset the cells in "alternative" mode
setBounds(
rect: AWT.Rectangle | number,
ry?: number,
rw?: number,
rh?: number,
): module:AWT.Rectangle
Inherited from module:boxes/BoxBag.BoxBag#setBounds
Overrides module:boxes/AbstractBox.AbstractBox#setBounds adjusting the position and size of all cells
Parameters
rect(AWT.Rectangle | number) — An AWT.Rectangle object, or thexcoordinate of the
upper-left corner of a new rectangle.ry(number, optional) —ycoordinate of the upper-left corner of the new rectangle.rw(number, optional) — Width of the new rectangle.rh(number, optional) — Height of the new rectangle.
Returns
update(
ctx: external:CanvasRenderingContext2D,
dirtyRegion?: module:AWT.Rectangle,
)
Inherited from module:boxes/BoxBag.BoxBag#update
Performs graphics operations for each cell.
Overrides module:boxes/AbstractBox.AbstractBox#update
Parameters
ctx(external:CanvasRenderingContext2D) — The canvas rendering context used to draw the
box contents.dirtyRegion(module:AWT.Rectangle, optional) — The area that must be repainted.nullrefers to the whole box.
contains(p: module:AWT.Point): boolean
Inherited from module:boxes/AbstractBox.AbstractBox#contains
Check if this box contains the specified point
Parameters
p(module:AWT.Point) — The point to be checked
Returns
boolean
Static Methods
createEmptyGrid(
parent: module:boxes/AbstractBox.AbstractBox,
container: module:AWT.Container,
px: number,
py: number,
abc: module:boxes/ActiveBagContent.ActiveBagContent,
sh: module:shapers/Shaper.Shaper,
boxBase: module:boxes/BoxBase.BoxBase,
): module:boxes/ActiveBoxGrid.ActiveBoxGrid
This factory constructor creates a new empty grid with the number of cells indicated by the
ActiveBagContent abc, not filling the cells with any content.
Parameters
parent(module:boxes/AbstractBox.AbstractBox) — The AbstractBox to which this box grid belongscontainer(module:AWT.Container) — The container where this box grid is placed.px(number) —Xcoordinate of the upper left corner of this box gridpy(number) —Ycoordinate of the upper left corner of this box gridabc(module:boxes/ActiveBagContent.ActiveBagContent) — Used only to get the number of cells and the shaper (whenshisnull)sh(module:shapers/Shaper.Shaper) — Shaper used to build the ActiveBox objectsboxBase(module:boxes/BoxBase.BoxBase) — The object where colors, fonts, border and other graphic properties
of this box grid are defined.
Returns
layoutSingle(
preferredMaxSize: module:AWT.Dimension,
rs: Resizable,
margin: number,
): module:AWT.Dimension
Inherited from module:boxes/BoxBag.BoxBag
Static method that sets the position and dimension of a Resizable object based on a
preferred maximum dimension and a margin.
Parameters
preferredMaxSize(module:AWT.Dimension) — The preferred maximum sizers(Resizable) — A resizable object implementing the methods described in the
Resizable
interface of JClic. Currently a BoxBag or TextGrid.margin(number) — The margin between the available area and the BoxBag
Returns
layoutDouble(
desiredMaxSize: module:AWT.Dimension,
rsA: Resizable,
rsB: Resizable,
boxGridPos: string,
margin: number,
): module:AWT.Dimension
Inherited from module:boxes/BoxBag.BoxBag
Static method that sets the position and dimension of two Resizable objects based on a
preferred maximum size, a layout schema and a margin.
Parameters
desiredMaxSize(module:AWT.Dimension) — The preferred maximum sizersA(Resizable) — First resizable object implementing the methods described in the
Resizable
interface of JClic. Currently a BoxBag or TextGrid.rsB(Resizable) — Second resizable objectboxGridPos(string) — The layout schema. Possible values are:margin(number) — The margin between the available area and the BoxBag
Returns
buildShape(data: object): module:AWT.Shape
Inherited from module:AWT.Shape
Builds a shape based on the provided data object.
Data should contain a 'type' member, specifying the type of shape requested ('rect', 'ellipse', 'rectangle' or 'path')
Parameters
data(object) — Specific data for this shape
Returns
Instance Fields
nCols: number
Number of columns of this box grid
nRows: number
Number of rows of this box grid
$accessibleDiv: external:jQuery
Inherited from module:boxes/ActiveBoxBag.ActiveBoxBag#$accessibleDiv
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#$accessibleDiv
div containing the accessible elements associated to this ActiveBoxBag
cells: Array.<module:boxes/AbstractBox.AbstractBox>
Inherited from module:boxes/BoxBag.BoxBag#cells
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#cells
The array of cells
preferredBounds: module:AWT.Rectangle
Inherited from module:boxes/BoxBag.BoxBag#preferredBounds
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#preferredBounds
Rectangle containing the preferred bounds of the BoxBag
backgroundBox: module:boxes/AbstractBox.AbstractBox
Inherited from module:boxes/BoxBag.BoxBag#backgroundBox
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#backgroundBox
An optional box used as a background by this BoxBag
parent: module:boxes/AbstractBox.AbstractBox
Inherited from module:boxes/AbstractBox.AbstractBox#parent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#parent
The parent AbstractBox (can be null)
container: module:AWT.Container
Inherited from module:boxes/AbstractBox.AbstractBox#container
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#container
The Container to which this AbstractBox belongs
boxBase: module:boxes/BoxBase.BoxBase
Inherited from module:boxes/AbstractBox.AbstractBox#boxBase
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#boxBase
The BoxBase related to this AbstractBox. When null, the parent can provide an
alternative one.
border: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#border
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#border
Whether this box has a border or not
shape: module:AWT.Shape
Inherited from module:boxes/AbstractBox.AbstractBox#shape
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#shape
The shape of this box (the box Rectangle or a special Shape, if set)
specialShape: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#specialShape
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#specialShape
Whether this box has a shape that is not a rectangle
visible: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#visible
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#visible
Whether this box is visible or not
temporaryHidden: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#temporaryHidden
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#temporaryHidden
Used to temporary hide a box while other drawing operations are done
tmpTrans: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#tmpTrans
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#tmpTrans
Cells with this attribute will be transparent but with painted border
inactive: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#inactive
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#inactive
Whether this box is active or inactive
inverted: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#inverted
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#inverted
Whether this box must be displayed with inverted or regular colors
alternative: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#alternative
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#alternative
Whether this box must be displayed with alternative or regular color and font settings
marked: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#marked
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#marked
Whether this box is marked (selected) or not
focused: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#focused
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#focused
Whether this box holds the input focus
accessibleText: string
Inherited from module:boxes/AbstractBox.AbstractBox#accessibleText
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#accessibleText
Text to be used in accessible contexts
role: string
Inherited from module:boxes/AbstractBox.AbstractBox#role
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#role
Describes the main role of this box on the activity. Useful in wai-aria descriptions.
$accessibleElement: external:jQuery
Inherited from module:boxes/AbstractBox.AbstractBox#$accessibleElement
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#$accessibleElement
DOM element used to display this cell content in wai-aria contexts
accessibleAlwaysActive: boolean
Inherited from module:boxes/AbstractBox.AbstractBox#accessibleAlwaysActive
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#accessibleAlwaysActive
Flag indicating that $accessibleElement should be always active
$hostedComponent: external:jQuery
Inherited from module:boxes/AbstractBox.AbstractBox#$hostedComponent
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#$hostedComponent
An external JQuery DOM element hosted by this box
type: string
Inherited from module:AWT.Rectangle#type
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#type
Shape type id
dim: module:AWT.Dimension
Inherited from module:AWT.Rectangle#dim
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#dim
The Dimension of the Rectangle
pos: module:AWT.Point
Inherited from module:AWT.Shape#pos
Overrides: module:boxes/ActiveBoxBag.ActiveBoxBag#pos
The current position of the shape