boxes/TextGridContent. TextGridContent

This class encapsulates the content of TextGrid objects.

It implements methods to set and retrieve individual characters on the grid, and parsing of
XML objects. It also contains information about the optimal size and other graphic properties
(fonts, colors, etc.) of the grid.

Constructor

new TextGridContent()

TextGridContent constructor

Members

border :boolean

Whether the cells must be surrounded by a border or not

Type:
  • boolean

h :number

Height of cells

Type:
  • number

nch :number

Grid rows

Type:
  • number

ncw :number

Grid columns

Type:
  • number

randomChars :string

A String with the chars to take as source when randomly filling empty cells

Type:
  • string

style :module:boxes/BoxBase.BoxBase

The BoxBase object with visual settings of the text grid

text :Array.<string>

An array of String objects textning the chars of cells. One string per row, one character of
this string per cell.

Type:
  • Array.<string>

w :number

Width of cells

Type:
  • number

wild :string

The letter used as wildcardtext

Type:
  • string

Methods

countWildChars() → {number}

Counts the number of wildcard characters present in this TextGrid

Returns:
Type: 
number

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

getNumChars() → {number}

Counts the total number of characters, including wildcard characters.

Returns:
Type: 
number

setAttributes(data) → {module:boxes/TextGridContent.TextGridContent}

Reads the properties of this TextGridContent from a data object

Parameters:
NameTypeDescription
dataobject | string

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

setCharAt(x, y, ch)

Sets the specified character as a content of the cell located at specific coordinates

Parameters:
NameTypeDescription
xnumber

The X coordinate of the cell

ynumber

The X coordinate of the cell

chstring

The character to be placed on the specified cell

setProperties($xml)

Loads the object settings from a specific JQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery