boxes/ActiveBoxContent. ActiveBoxContent

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(idopt)

ActiveBoxContent constructor

Parameters:
NameTypeAttributesDescription
idstring<optional>

An optional identifier.

Members

amp :module:media/ActiveMediaPlayer.ActiveMediaPlayer

The ActiveMediaPlayer associated with this content. Updated at run-time.

animatedGifFile :string

When img is an animated GIF file, this field should contain its file name

Type:
  • string

avoidOverlapping :boolean

Whether to avoid overlapping of image and text inside the cell when both are present.

Type:
  • boolean

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.

Type:
  • boolean | null

dimension :module:AWT.Dimension

Optimal dimension of any ActiveBox taking this content.

id :number

Numeric identifier used in activities to resolve relationships between cells

Type:
  • number

image :string

The name of the image file to display on the ActiveBox.

Type:
  • string

img :external:HTMLImageElement

The realized image used by this box content.

imgAlign :module:boxes/ActiveBoxContent.AlignType

The horizontal and vertical alignment of the image inside the cell.

imgClip :module:AWT.Shape

An optional shape used to clip the image.

innerHtmlText :string

When not null, this content should be treated as an HTML element

Type:
  • string

item :number

Numeric identifier used in activities to resolve relationships between cells

Type:
  • number

mbe :module:bags/MediaBagElement.MediaBagElement

The module:bads/MediaBagElement.MediaBagElement associated with this content, if any. Updated at run-time.

mediaContent :module:media/MediaContent.MediaContent

The media content associated with this object.

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.

text :string

The text to display on the ActiveBox. It can have up to two paragraphs.

Type:
  • string

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.

(static) EMPTY_CONTENT :module:boxes/ActiveBoxContent.ActiveBoxContent

An empty ActiveBoxContent

Methods

checkHtmlText()

Checks if cell's text uses HTML, initializing the innerHtmlText member as needed.

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:
  • The resulting object, with minimal attrributes
Type: 
object

getDescription() → {string}

Gets a string representing this content, useful for checking if two different contents are
equivalent.

Returns:
Type: 
string

isEmpty()

Checks if this is an empty content (text and img are null)

isEquivalent(abc, checkCase) → {boolean}

Checks if two contents are equivalent

Parameters:
NameTypeDescription
abcmodule:boxes/ActiveBoxContent.ActiveBoxContent

The content to compare with this.

checkCaseboolean

When true the comparing will be case-sensitive.

Returns:
Type: 
boolean

prepareMedia(playStation)

Prepares the media content

Parameters:
NameTypeDescription
playStationmodule:JClicPlayer.JClicPlayer

Usually a JClicPlayer

readAlign(str) → {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:
NameTypeDescription
strstring

The string to parse

Returns:
Type: 
module:boxes/ActiveBoxContent.ActiveBoxContent~alignType

realizeContent(mediaBag)

Reads and initializes the image associated to this content

Parameters:
NameTypeDescription
mediaBagmodule:bags/MediaBag.MediaBag

The media bag of the current project.

setAttributes(data, mediaBag) → {module:boxes/ActiveBoxContent.ActiveBoxContent}

Reads the properties of this ActiveBoxContent from a data object

Parameters:
NameTypeDescription
dataobject | string

The data object to be parsed, or just the text content

mediaBagmodule:bags/MediaBag.MediaBag

The media bag used to retrieve images and other media

setImgContent(img, imgClip, animatedGifFileopt)

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:
NameTypeAttributesDescription
imgexternal:HTMLImageElement

The image data

imgClipmodule:AWT.Shape

A shape that clips the portion of image assigned to this content.

animatedGifFilestring<optional>

When img is an animated GIF, its file name

setProperties($xml, mediaBag)

Loads settings from a specific JQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element to be parsed

mediaBagmodule:bags/MediaBag.MediaBag

The media bag used to retrieve images and other media

setTextContent(tx)

Sets the text content of this ActiveBox

Parameters:
NameTypeDescription
txstring

toString() → {string}

Overwrites the original Object.toString method, returning getDescription instead

Returns:
Type: 
string