AutoContentProvider

Source: AutoContentProvider.js:40

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

AutoContentProvider constructor


Instance Methods

setProperties($xml: external:jQuery)

Loads the object settings from a specific jQuery XML element

Parameters

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

init()

Initializes the content provider

generateContent( nRows: number, nCols: number, content: Array.<module:boxes/ActiveBagContent.ActiveBagContent>, useIds: boolean, ): boolean

Builds an ActiveBagContentKit and generates the automatized content.

Parameters

Returns

  • boolean

process( _kit: module:automation/AutoContentProvider.ActiveBagContentKit, ): boolean

Generates the automatized content

Parameters

  • _kit (module:automation/AutoContentProvider.ActiveBagContentKit) — The objects to be filled with content

Returns

  • boolean

Static Methods

getProvider( $xml: external.jQuery, ): 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

  • $xml (external.jQuery) — The XML element to parse

Returns

factory( data: object, params: Array.<object>, ): module:shapers/Shaper.Shaper

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

Parameters

  • data (object) — The data object to be parsed
  • params (Array.<object>) — Optional parameters to be passed to setAttributes

Returns

registerClass( providerName: string, providerClass: function, ): module:automation/AutoContentProvider.AutoContentProvider

Registers a new type of AutoContentProvider

Parameters

  • providerName (string) — The name used to identify this AutoContentProvider
  • providerClass (function) — The activity class, usually extending AutoContentProvider

Returns

Instance Fields

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)

Static Fields

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.

Other

ActiveBagContentKit

Utility class used to encapsulate multiple sets of box contents

Parameters