automation/AutoContentProvider. AutoContentProvider

This abstract class is the base for classes that create on-time automatic content for JClic
activities, usually using random parameters to assure different content in each session.

Activities with AutoContentProvider objects rely on them to build new content on every start.

Constructor

new AutoContentProvider()

AutoContentProvider constructor

Classes

ActiveBagContentKit

Members

numericContent :boolean

This AutoContentProvider manages numeric expressions, so text literals should be
converted to numbers for comparisions, taking in account the
number format of the current locale (dot or comma as decimal separator)

Type:
  • boolean

(static) CLASSES :object

Contains the current list of classes derived from AutoContentProvider.
This object should be updated by real automation classes at declaration time.
Currently, only two types of "AutoContentProvider" are defined: Arith and TagReplace.

Type:
  • object

Methods

generateContent(nRows, nCols, content, useIds) → {boolean}

Builds an ActiveBagContentKit and generates the automatized content.

Parameters:
NameTypeDescription
nRowsnumber

Number of rows to be processed

nColsnumber

Number of columns to be processed

contentArray.<module:boxes/ActiveBagContent.ActiveBagContent>

Array with one or more containers of ActiveBoxContent
objects to be filled with new content.

useIdsboolean

When true, the id field of ActiveBoxContent objects is significant

Returns:
  • true if the process was OK. false otherwise.
Type: 
boolean

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

init()

Initializes the content provider

process(_kit) → {boolean}

Generates the automatized content

Parameters:
NameTypeDescription
_kitmodule:automation/AutoContentProvider.ActiveBagContentKit

The objects to be filled with content

Returns:
  • true if the process was OK. false otherwise.
Type: 
boolean

setProperties($xml)

Loads the object settings from a specific jQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element to parse

(static) factory(data, params) → {module:shapers/Shaper.Shaper}

Builds a new AutoContentProvider, based on the properties specified in a data object

Parameters:
NameTypeDescription
dataobject

The data object to be parsed

paramsArray.<object>

Optional parameters to be passed to setAttributes

(static) getProvider($xml) → {module:automation/AutoContentProvider.AutoContentProvider}

Dynamic constructor that returns a specific type of AutoContentProvider based on the class
attribute declared on an $xml element.
It should be called only from Activity.setProperties

Parameters:
NameTypeDescription
$xmlexternal.jQuery

The XML element to parse

(static) registerClass(providerName, providerClass) → {module:automation/AutoContentProvider.AutoContentProvider}

Registers a new type of AutoContentProvider

Parameters:
NameTypeDescription
providerNamestring

The name used to identify this AutoContentProvider

providerClassfunction

The activity class, usually extending AutoContentProvider