ActiveBoxContent
Source: ActiveBoxContent.js:85
This class defines a content that can be displayed by ActiveBox objects. This content
can be a text, an image, a fragment of an image or a combination of text and images. The style
(colors, font and size, borders, shadows, margins, etc.) are specified in the style attribute,
always pointing to a BoxBase object.
Constructor
new ActiveBoxContent(id?: string): ActiveBoxContentActiveBoxContent constructor
Parameters
id(string, optional) — An optional identifier.
Instance Methods
setProperties(
$xml: external:jQuery,
mediaBag: module:bags/MediaBag.MediaBag,
)
Loads settings from a specific JQuery XML element
Parameters
$xml(external:jQuery) — The XML element to be parsedmediaBag(module:bags/MediaBag.MediaBag) — The media bag used to retrieve images and other media
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.
Returns
object
setAttributes(
data: object | string,
mediaBag: module:bags/MediaBag.MediaBag,
): module:boxes/ActiveBoxContent.ActiveBoxContent
Reads the properties of this ActiveBoxContent from a data object
Parameters
data(object | string) — The data object to be parsed, or just the text contentmediaBag(module:bags/MediaBag.MediaBag) — The media bag used to retrieve images and other media
Returns
readAlign(
str: string,
): module:boxes/ActiveBoxContent.ActiveBoxContent~alignType
Decode expressions with combined values of horizontal and vertical alignments in the form:
"(left|middle|right),(top|middle|bottom)"
Parameters
str(string) — The string to parse
Returns
module:boxes/ActiveBoxContent.ActiveBoxContent~alignType
isEmpty()
Checks if this is an empty content (text and img are null)
isEquivalent(
abc: module:boxes/ActiveBoxContent.ActiveBoxContent,
checkCase: boolean,
): boolean
Checks if two contents are equivalent
Parameters
abc(module:boxes/ActiveBoxContent.ActiveBoxContent) — The content to compare with this.checkCase(boolean) — Whentruethe comparing will be case-sensitive.
Returns
boolean
setTextContent(tx: string)
Sets the text content of this ActiveBox
Parameters
tx(string)
checkHtmlText()
Checks if cell's text uses HTML, initializing the innerHtmlText member as needed.
setImgContent(
img: external:HTMLImageElement,
imgClip: module:AWT.Shape,
animatedGifFile?: string,
)
Sets a fragment of a main image as a graphic content of this cell.
Cells cannot have two graphic contents, so image (the specific image of this cell) should
be cleared with this setting.
Parameters
img(external:HTMLImageElement) — The image dataimgClip(module:AWT.Shape) — A shape that clips the portion of image assigned to this content.animatedGifFile(string, optional) — Whenimgis an animated GIF, its file name
prepareMedia(playStation: module:JClicPlayer.JClicPlayer)
Prepares the media content
Parameters
playStation(module:JClicPlayer.JClicPlayer) — Usually a JClicPlayer
realizeContent(mediaBag: module:bags/MediaBag.MediaBag)
Reads and initializes the image associated to this content
Parameters
mediaBag(module:bags/MediaBag.MediaBag) — The media bag of the current project.
getDescription(): string
Gets a string representing this content, useful for checking if two different contents are
equivalent.
Returns
string
toString(): string
Overwrites the original Object.toString method, returning getDescription instead
Returns
string
Instance Fields
style: module:boxes/BoxBase.BoxBase
The BoxBase attribute of this content. Can be null, meaning ActiveBox will
try to find a suitable style scanning down through its own BoxBase, their parent's and, finally,
the default values defined in BoxBase.prototype.
dimension: module:AWT.Dimension
Optimal dimension of any ActiveBox taking this content.
border: boolean | null
The ActiveBox can have or not a border despite the settings of BoxBase.
The default value null means not to take in consideration this setting.
text: string
The text to display on the ActiveBox. It can have up to two paragraphs.
image: string
The name of the image file to display on the ActiveBox.
imgClip: module:AWT.Shape
An optional shape used to clip the image.
mediaContent: module:media/MediaContent.MediaContent
The media content associated with this object.
imgAlign: module:boxes/ActiveBoxContent.AlignType
The horizontal and vertical alignment of the image inside the cell.
txtAlign: module:boxes/ActiveBoxContent.AlignType
The horizontal and vertical alignment of the text inside the cell.
Valid values are: left, middle, right, top and bottom.
avoidOverlapping: boolean
Whether to avoid overlapping of image and text inside the cell when both are present.
id: number
Numeric identifier used in activities to resolve relationships between cells
item: number
Numeric identifier used in activities to resolve relationships between cells
img: external:HTMLImageElement
The realized image used by this box content.
animatedGifFile: string
When img is an animated GIF file, this field should contain its file name
innerHtmlText: string
When not null, this content should be treated as an HTML element
amp: module:media/ActiveMediaPlayer.ActiveMediaPlayer
The ActiveMediaPlayer associated with this content. Updated at run-time.
mbe: module:bags/MediaBagElement.MediaBagElement
The module:bads/MediaBagElement.MediaBagElement associated with this content, if any. Updated at run-time.
Static Fields
EMPTY_CONTENT: module:boxes/ActiveBoxContent.ActiveBoxContent
An empty ActiveBoxContent