boxes/ActiveBagContent. ActiveBagContent

This class packs a collection of ActiveBoxContent objects and provides methods to access
and manage it. The two main members of ActiveBagContent are the Shaper, responsible for
determining the position and shape of each ActiveBox, and the BoxBase (field style),
provider of a common visual style.

Constructor

new ActiveBagContent(idopt, ncw, nch)

ActiveBagContent constructor

Parameters:
NameTypeAttributesDescription
idstring<optional>

An optional text tag identifying this ActiveBagContent

ncwnumber

In grid-based distributions, number of columns.

nchnumber

In grid-based distributions, number of rows.

Members

animatedGifFile :string

Name of the img source when is an animated GIF

Type:
  • string

backgroundContent :module:boxes/ActiveBoxContent.ActiveBoxContent

An optional ActiveBoxContent object with background settings.

border :boolean

Whether the cells must have a border or not

Type:
  • boolean

cells :Array.<module:boxes/ActiveBoxContent.ActiveBoxContent>

The main Array of ActiveBoxContent objects

defaultIdValue :number

The default value to be assigned at the 'id' field of children

Type:
  • number

h :number

Optimal cell height

Type:
  • number

id :string

The global identifier of this object: primary, secondary...

Type:
  • string

ids :string

Used in special cases where all cells have empty content with only numeric identifiers

Type:
  • string

image :string

The name of the image file used as a common image of this bag

Type:
  • string

img :external:HTMLImageElement

The built image object

nch :number

Number of rows when cells are distributed in a grid

Type:
  • number

ncw :number

Number of columns when cells are distributed in a grid

Type:
  • number

shaper :module:shapers/Shaper.Shaper

The Shaper used to define the specific shape of each cell

style :module:boxes/BoxBase.BoxBase

The BoxBase used for this bag of cell contents

w :number

Optimal cell width

Type:
  • number

Methods

addActiveBoxContent(ab)

Adds a new ActiveBoxContent to this bag

Parameters:
NameTypeDescription
abmodule:boxes/ActiveBoxContent.ActiveBoxContent

The ActiveBoxContent to add

avoidAllIdsNull(maxId)

Cheks if the id values of all ActiveBoxContent objects are -1 and, if true,
sets new ids to them, with values between 0 and maxId

Parameters:
NameTypeDescription
maxIdnumber

The maximum value of identifiers

getActiveBoxContent(i) → {module:boxes/ActiveBoxContent.ActiveBoxContent}

Gets the nth ActiveBoxContent in cells

Parameters:
NameTypeDescription
inumber

The index of the content to be retrieved

getActiveBoxContentWith(id, item) → {module:boxes/ActiveBoxContent.ActiveBoxContent}

Finds the ActiveBoxContent with specific id and item values

Parameters:
NameTypeDescription
idnumber
itemnumber

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

getBoxBase() → {module:boxes/BoxBase.BoxBase}

Retrieves the BoxBase of this bag, creating a new one if it was null

getNumCells() → {number}

Gets the total number of cells of this bag

Returns:
Type: 
number

getShaper() → {module:shapers/Shaper.Shaper}

Retrieves the Shaper of this bag, creating a new one if it was null

getTotalHeight() → {number}

Gets the estimated total height of this bag

Returns:
Type: 
number

getTotalWidth() → {number}

Gets the estimated total width of this content bag

Returns:
Type: 
number

isEmpty() → {boolean}

Checks if the bag is empty

Returns:
Type: 
boolean

prepareMedia(playStation)

Prepares the media content of all elements

Parameters:
NameTypeDescription
playStationmodule:JClicPlayer.JClicPlayer

The JClicPlayer

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

Reads the properties of this ActiveBagContent from a data object

Parameters:
NameTypeDescription
dataobject

The data object to be parsed

mediaBagmodule:bags/MediaBag.MediaBag

The project's MediaBag

setCellsAttribute(key, value)

Sets value to the key attribute of all cells

Parameters:
NameTypeDescription
keystring

The key where the value will be stored

valueany

The supplied value. Can be of any type.

setIds(ids)

Sets id values to a all the ActiveBoxContent elements of his bag.

Parameters:
NameTypeDescription
idsArray.<number>

Array of numeric identifiers

setImgContent(mb, sh, roundSizes)

Sets the content of the cells based on a image spliced by a shaper

Parameters:
NameTypeDescription
mbmodule:bags/MediaBag.MediaBag

The MediaBag used to retrieve the image

shmodule:shapers/Shaper.Shaper

The Shaper used to splice the image

roundSizesboolean

When true, the size and coordinates of cells will be rounded
to the nearest integer values.

setProperties($xml, mediaBag)

Loads the object settings from a specific JQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element to parse

mediaBagmodule:bags/MediaBag.MediaBag

The project's MediaBag

setTextContent(txt, setNcw, setNch)

Sets the content of this bag based on an array of strings

Parameters:
NameTypeDescription
txtArray.<string>

The array of strings to be used as content.

setNcwnumber

Number of columns

setNchnumber

Number of rows