Constructor
new ActiveBox(parentopt, containeropt, boxBaseopt, setIdLocopt, rectopt)
ActiveBox constructor
Name | Type | Attributes | Description |
---|---|---|---|
parent | module:boxes/AbstractBox. | <optional> | The AbstractBox to which this ActiveBox belongs |
container | module:AWT. | <optional> | The container where this box is placed. |
boxBase | module:boxes/BoxBase. | <optional> | The object where colors, fonts, border and other graphic properties |
setIdLoc | number | <optional> | A numeric identifier, used to locate this box in a set of sibling objects. |
rect | module:AWT. | <optional> | The initial bounds of the box. |
- Source
Extends
Members
$accessibleElement :external:jQuery
DOM element used to display this cell content in wai-aria contexts
- Source
$hostedComponent :external:jQuery
An external JQuery DOM element hosted by this box
- Source
accessibleAlwaysActive :boolean
Flag indicating that $accessibleElement should be always active
- boolean
- Source
accessibleText :string
Text to be used in accessible contexts
- string
- Source
altContent :module:boxes/ActiveBoxContent.ActiveBoxContent
Alternative content of this box
- Source
alternative :boolean
Whether this box must be displayed with alternative or regular color and font settings
- boolean
- Source
border :boolean
Whether this box has a border or not
- boolean
- Source
boxBase :module:boxes/BoxBase.BoxBase
The BoxBase
related to this AbstractBox. When null
, the parent can provide an
alternative one.
- Source
container :module:AWT.Container
The Container to which this AbstractBox belongs
- Source
content :module:boxes/ActiveBoxContent.ActiveBoxContent
Main content of this box
- Source
dim :module:AWT.Dimension
The Dimension
of the Rectangle
focused :boolean
Whether this box holds the input focus
- boolean
- Source
hostedComponent :boolean
Flag to check if this box has a 'hosted component'
- boolean
- Source
hostedMediaPlayer :module:media/ActiveMediaPlayer.ActiveMediaPlayer
The media player associated to this box
- Source
idAss :number
Identifier used to establish relationships between cells of different sets (in associations)
- number
- Source
idLoc :number
Identifier used to set a relative position in the space.
- number
- Source
idOrder :number
Identifier used to set the relative position of this box in a set.
- number
- Source
inactive :boolean
Whether this box is active or inactive
- boolean
- Source
inverted :boolean
Whether this box must be displayed with inverted or regular colors
- boolean
- Source
isBackground :boolean
Indicates that this box is used as a background. When drawing, the clipping region must be respected.
- boolean
- Source
marked :boolean
Whether this box is marked (selected) or not
- boolean
- Source
parent :module:boxes/AbstractBox.AbstractBox
The parent AbstractBox (can be null
)
- Source
pos :module:AWT.Point
The current position of the shape
pos0 :module:AWT.Point
Backup of the original position of the cell, useful when the real position must be restored after a temporary change.
- Source
role :string
Describes the main role of this box on the activity. Useful in wai-aria descriptions.
- string
- Source
shape :module:AWT.Shape
The shape of this box (the box Rectangle or a special Shape, if set)
- Source
specialShape :boolean
Whether this box has a shape that is not a rectangle
- boolean
- Source
temporaryHidden :boolean
Used to temporary hide a box while other drawing operations are done
- boolean
- Source
tmpTrans :boolean
Cells with this attribute will be transparent but with painted border
- boolean
- Source
type :string
Shape type id
- string
visible :boolean
Whether this box is visible or not
- boolean
- Source
Methods
_focusAccessibleElement(ctx)
Draw focus on accessible element if needed
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas rendering context used to draw the |
- Source
add(shape) → {module:AWT.Rectangle}
Adds the boundaries of another shape to the current one
Name | Type | Description |
---|---|---|
shape | module:AWT. | The |
- Type:
- module:AWT.
Rectangle
buildAccessibleElement($canvas, $clickReceiver, $canvasGroupopt, eventTypeopt) → {external:jQuery}
Builds a hidden buton
that will act as a accessible element associated to the canvas area
of this ActiveBox.
The button will be created only 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.
Name | Type | Attributes | Description |
---|---|---|---|
$canvas | external:jQuery | The | |
$clickReceiver | external:jQuery | The DOM element that will be notified when | |
$canvasGroup | external:jQuery | <optional> | Optional DOM element containing the accessible element. Useful to group cells in associations. When |
eventType | string | <optional> | Type of event sent to $clickReceiver. Default is |
- Source
- The accessible element associated to this ActiveBox.
- Type:
- external:jQuery
checkAutoStartMedia()
Checks if the call has a module:media/MediaContent.MediaContent
set to autostart
, and launches it when found.
- Source
checkHostedComponent()
Checks the presence of content susceptible to be treated as HTML DOM embedded in this ActiveBox.
- Source
clear()
Clears the current content
- Source
clip(ctx, fillRuleopt) → {external:CanvasRenderingContext2D}
Creates a clipping region on the specified HTML canvas 2D rendering context
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ctx | external:CanvasRenderingContext2D | The rendering context | ||
fillRule | string | <optional> | 'nonzero' | Can be 'nonzero' (default when not set) or 'evenodd' |
- The provided rendering context
clone() → {module:AWT.Rectangle}
Clones this Rectangle
- Type:
- module:AWT.
Rectangle
copyContent(bx)
Copy the content of another ActiveBox into this one
Name | Type | Description |
---|---|---|
bx | module:boxes/ActiveBox. | The ActiveBox from which to take the content |
- Source
drawBorder(ctx)
Draws the box border
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas rendering context where the border |
- Source
end()
Finisher method
- Source
equals(r) → {boolean}
Checks if two shapes are equivalent.
Name | Type | Description |
---|---|---|
r | module:AWT. | The Shape to compare against |
- Type:
- boolean
exchangeContent(bx)
Exhanges the content of this ActiveBox with another one
Name | Type | Description |
---|---|---|
bx | module:boxes/ActiveBox. | The ActiveBox with which to exchange the content. |
- Source
exchangeLocation(bx)
Swaps the location of two active boxes
Name | Type | Description |
---|---|---|
bx | module:boxes/ActiveBox. | The ActiveBox to swap with this one. |
- Source
fill(ctx, dirtyRegionopt) → {external:CanvasRenderingContext2D}
Fills the Shape with the current style in the provided HTML canvas context
Name | Type | Attributes | Description |
---|---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas 2D rendering context where to fill this shape. | |
dirtyRegion | module:AWT. | <optional> | The context region to be updated. Used as clipping |
- The provided rendering context
getAttributes() → {object}
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.
- The resulting object, with minimal attrributes
- Type:
- object
getBorderBounds() → {module:AWT.Rectangle}
Returns the enclosing Rectangle of this box including its border (if any)
- Source
- Type:
- module:AWT.
Rectangle
getBounds() → {module:AWT.Rectangle}
Gets the enclosing Rectangle
of this Shape.
- Type:
- module:AWT.
Rectangle
getBoxBaseResolve() → {module:boxes/BoxBase.BoxBase}
Gets the real BoxBase
associated to this box, scanning down parent relationships.
- Source
getContainerResolve() → {module:AWT.Container}
Gets the container associated to this box, asking its parents when null
.
- Source
- Type:
- module:AWT.
Container
getContainerX() → {module:AWT.Container}
Gets the container
attribute of this box, without checking its parent
- Source
- Type:
- module:AWT.
Container
getContent() → {module:boxes/ActiveBoxContent.ActiveBoxContent}
Returns the current content, creating an empty one if needed.
- Source
getCoords() → {string}
Gets a string with the co-ordinates of the upper-left and lower-right vertexs of this rectangle,
(with values rounded to int)
- Type:
- string
getCurrentContent() → {module:boxes/ActiveBoxContent.ActiveBoxContent}
Returns the current content used by the box
- Source
getDescription() → {string}
Gets the description
field of the current ActiveBoxContent
- Source
- Type:
- string
getHostedComponent() → {external:jQuery}
Gets the current $hostedComponent
member
- Source
- Type:
- external:jQuery
getOppositeVertex() → {module:AWT.Point}
Gets the module:AWT.Point
corresponding to the lower-right vertex of the Rectangle.
- Type:
- module:AWT.
Point
getParent() → {module:boxes/AbstractBox.AbstractBox}
Gets the current parent of this box
- Source
getShape() → {module:AWT.Shape}
Gets the current shape used in this box
- Source
- Type:
- module:AWT.
Shape
grow(dx, dy) → {module:AWT.Rectangle}
Expands the boundaries of this shape. This affects the current position and dimension.
Name | Type | Description |
---|---|---|
dx | number | The amount to grow (or decrease) in horizontal direction |
dy | number | The amount to grow (or decrease) in vertical direction |
- Type:
- module:AWT.
Rectangle
hasBorder() → {boolean}
Checks if this box has border
- Source
- Type:
- boolean
intersects(_r) → {boolean}
Checks if the provided Rectangle
r
intersects with this shape.
Name | Type | Description |
---|---|---|
_r | module:AWT. |
- Type:
- boolean
invalidate(rect)
Invalidates the zone corresponding to this box in the associated module:AWT.Container
, if any.
Name | Type | Description |
---|---|---|
rect | module:AWT. | The rectangle to be invalidated. When |
- Source
isAlternative() → {boolean}
Checks if this box is in alternative
state.
- Source
- Type:
- boolean
isAtPlace() → {boolean}
Checks if this ActiveBox is at its original place.
- Source
- Type:
- boolean
isCurrentContentEquivalent(bx, checkCaseopt) → {boolean}
Same functionality as isEquivalent
, but comparing the current content.
Name | Type | Attributes | Description |
---|---|---|---|
bx | module:boxes/ActiveBox. | The ActiveBox to check against this. | |
checkCase | boolean | <optional> | When |
- Source
- Type:
- boolean
isEquivalent(bx, checkCaseopt) → {boolean}
Checks if two ActiveBox objects have equivalent content
Name | Type | Attributes | Description |
---|---|---|---|
bx | module:boxes/ActiveBox. | The ActiveBox to check against this. | |
checkCase | boolean | <optional> | When |
- Source
true
if both cells are equivalent.
- Type:
- boolean
isFocused() → {boolean}
Checks if this box has the input focus
- Source
- Type:
- boolean
isInactive() → {boolean}
Checks if this box is currently inactive.
- Source
- Type:
- boolean
isInverted() → {boolean}
Checks if this box is in inverted
state.
- Source
- Type:
- boolean
isMarked() → {boolean}
Checks if this box is marked
- Source
- Type:
- boolean
isRect() → {boolean}
Shorthand method for determining if a Shape is an Rectangle
- Type:
- boolean
isTemporaryHidden() → {boolean}
Checks if this box is temporary hidden
- Source
- Type:
- boolean
isVisible() → {boolean}
Checks if this box is fully visible
- Source
- Type:
- boolean
moveBy(dx, dy)
Sets a new location to this box. In JClic this method was named translate
.
Name | Type | Description |
---|---|---|
dx | number | The displacement on the X axis |
dy | number | The displacement on the Y axis |
- Source
moveTo(newPos, yopt)
Sets a new location for this box. In JClic this method was named setLocation
Name | Type | Attributes | Description |
---|---|---|---|
newPos | AWT. | A point or the | |
y | number | <optional> | The |
- Source
playMedia(ps, delayedActions)
Plays the action or media associated with this ActiveBox
Name | Type | Default | Description |
---|---|---|---|
ps | module:JClicPlayer. | Usually, a | |
delayedActions | Array.<function()> | null | If set, store the the action in this array for future execution |
- Source
preparePath(ctx) → {external:CanvasRenderingContext2D}
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.
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D |
- The provided rendering context
scaleBy(delta) → {module:AWT.Rectangle}
Multiplies the dimension of the Shape by the specified delta
amount.
Name | Type | Description |
---|---|---|
delta | Point | | Object containing the X and Y ratio to be scaled. |
- Type:
- module:AWT.
Rectangle
setAltContent(abc, i)
Sets the ActiveBoxContent
that will act as an alternative content (altContent
field)
of this ActiveBox,
Name | Type | Description |
---|---|---|
abc | ActiveBoxContent | | Object containing the content to set. |
i | number | When |
- Source
setAlternative(newVal)
Sets this box in alternative
mode, or restores its original state.
Name | Type | Description |
---|---|---|
newVal | boolean |
- Source
setAttributes(data) → {module:AWT.Rectangle}
Reads the properties of this Rectangle from a data object
Name | Type | Description |
---|---|---|
data | object | The data object to be parsed |
- Type:
- module:AWT.
Rectangle
setBorder(newVal)
Sets/unsets a border to this box
Name | Type | Description |
---|---|---|
newVal | boolean |
|
- Source
setBoxBase(boxBase)
Sets the BoxBase
of this box
Name | Type | Description |
---|---|---|
boxBase | module:boxes/BoxBase. | The new BoxBase |
- Source
setContainer(newContainer)
Setter method for container
Name | Type | Description |
---|---|---|
newContainer | module:AWT. | The new Container assigned to this box |
- Source
setContent(abc, i)
Sets the ActiveBoxContent
of this ActiveBox
Name | Type | Description |
---|---|---|
abc | ActiveBoxContent | | Object containing the content to set. |
i | number | When |
- Source
setCurrentContent(abc)
Sets the current content of this ActiveBox
Name | Type | Description |
---|---|---|
abc | module:boxes/ActiveBoxContent. | The content to set. |
- Source
setDefaultIdAss()
Sets the default value to idAss
- Source
setFocused(newVal)
Sets or unsets the input focus to this box.
Name | Type | Description |
---|---|---|
newVal | boolean |
- Source
setHostedComponent($hc)
Sets the $hostedComponent
member.
Name | Type | Description |
---|---|---|
$hc | external:jQuery | The jQuery DOM component hosted by this box. |
- Source
setHostedComponentBorder()
Sets the $hostedComponent
border, based on the currentBoxBase
of this box.
- Source
setHostedComponentBounds(sizeChanged)
Places and resizes $hostedComponent
, based on the size
and position of this box.
Name | Type | Description |
---|---|---|
sizeChanged | boolean |
|
- Source
setHostedComponentColors()
Sets $hostedComponent
colors and other css properties
based on the current BoxBase
of this box.
- Source
setHostedComponentVisible()
Makes module:boxes/AbstractBox.AbstractBox#$hostedComponent
visible or invisible, based on the value of
the AbstractBox visible
flag.
- Source
setHostedMediaPlayer(amp)
Sets the hosted media player of this ActiveBox
Name | Type | Description |
---|---|---|
amp | module:media/ActiveMediaPlayer. | The media player. |
- Source
setInactive(newVal)
Makes this box active (false
) or inactive (true
)
Name | Type | Description |
---|---|---|
newVal | boolean |
- Source
setInverted(newVal)
Puts this box in inverted
mode or restores its original state.
Name | Type | Description |
---|---|---|
newVal | boolean |
- Source
setMarked(newVal)
Sets this box in marked
mode, or restores its original state.
Name | Type | Description |
---|---|---|
newVal | boolean |
- Source
setParent(parent)
Setter method for parent
Name | Type | Description |
---|---|---|
parent | module:boxes/AbstractBox. | The new parent of this box |
- Source
setShape(sh)
Sets the shape used to draw the content of this box
Name | Type | Description |
---|---|---|
sh | module:AWT. | The shape to be set |
- Source
setSize(width, height)
Changes the size of this box
Name | Type | Description |
---|---|---|
width | number | |
height | number |
- Source
setTemporaryHidden(newVal)
Makes this box temporary hidden (newVal true
) or resets its original state (newVal false
)
Name | Type | Description |
---|---|---|
newVal | boolean |
- Source
setTextContent(tx)
Sets the text content of this ActiveBox.
Name | Type | Description |
---|---|---|
tx | string | The text to set. |
- Source
setVisible(newVal)
Sets this box visible or invisible
Name | Type | Description |
---|---|---|
newVal | boolean |
|
- Source
stroke(ctx) → {external:CanvasRenderingContext2D}
Draws this shape in the provided HTML canvas 2D rendering context.
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas 2D rendering context where to draw the shape. |
- The provided rendering context
switchToAlt()
Puts this ActiveBox in "alternative" mode, meaning that altContent
will be used instead of content
- Source
toString() → {string}
Gets a descriptive text for this ActiveBox
- Source
- Type:
- string
update(ctx, dirtyRegionopt)
Draws the content of this box on an HTML canvas
element. At this level, only background
and border are painted/stroked. Derived classes should implement specific drawing tasks inmodule:boxes/AbstractBox.AbstractBox#updateContent
.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas rendering context used to draw the | ||
dirtyRegion | module:AWT. | <optional> | null | The area that must be repainted. |
- Source
updateContent(ctx, dirtyRegionopt)
Draws the content of this Activebox on the specified canvas context.
Name | Type | Attributes | Description |
---|---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas rendering context used to draw the | |
dirtyRegion | module:AWT. | <optional> | The area that must be repainted. |
- Source
(static) createCell($dom, abc) → {module:boxes/ActiveBox.ActiveBox}
Factory constructor that creates a new cell inside a JQuery DOM element.
Name | Type | Description |
---|---|---|
$dom | external:jQuery | The DOM element that will act as a container |
abc | module:boxes/ActiveBoxContent. | The cell's content. Must not be null and have the |
- Source