Class: JSONFileLoader

JSONFileLoader(gui, name, labelStr, valueCallback, setupCallbackopt)

Loader for JSON files.

Constructor

new JSONFileLoader(gui, name, labelStr, valueCallback, setupCallbackopt)

Constructor for JSONFileLoader.

Parameters:
Name Type Attributes Description
gui GUI
name string
labelStr string
valueCallback function
setupCallback function <optional>
Source:

Extends

Members

_doUpdateChangeSet :boolean

Static flag to control whether the change set should be updated.

Type:
  • boolean
Overrides:
Source:

console :p5.Element

The console div element for displaying messages.

Type:
  • p5.Element
Overrides:
Source:

consoleText :string

The current console text.

Type:
  • string
Overrides:
Source:

controllerElement :p5.Element|HTMLElement

The HTML element representing the controller.

Type:
  • p5.Element | HTMLElement
Overrides:
Source:

controllerWrapper :p5.Element

The wrapper div for the controller.

Type:
  • p5.Element
Overrides:
Source:

die :DieIcon

The die icon for randomization.

Type:
Overrides:
Source:

doRandomize :boolean

Flag to control whether the controller should randomize its value.

Type:
  • boolean
Overrides:
Source:

file :*

The file object.

Type:
  • *
Overrides:
Source:

fileName :string

The file name.

Type:
  • string
Overrides:
Source:

fileType :string

The file type accepted.

Type:
  • string
Overrides:
Source:

gui :GUIForP5

The GUIForP5 instance this controller belongs to.

Type:
Overrides:
Source:

label :string

The label for the controller.

Type:
  • string
Overrides:
Source:

name :string

The name of the controller.

Type:
  • string
Overrides:
Source:

setupCallback :function

Optional setup callback.

Type:
  • function
Overrides:
Source:

Methods

addDie(die)

Adds a die to the controller.

Parameters:
Name Type Description
die DieIcon

The die to add.

Overrides:
Source:

addToRandomizer(randomizer)

Adds this controller to a randomizer.

Parameters:
Name Type Description
randomizer Randomizer

The randomizer to add this controller to.

Overrides:
Source:

click()

Simulates a button click.

Overrides:
Source:

createConsole()

Creates the console element for the controller.

Overrides:
Source:

disable()

Disables the controller.

Overrides:
Source:

doUpdateChangeSet() → {boolean}

Checks if the change set should be updated.

Overrides:
Source:
Returns:
  • True if the change set should be updated, false otherwise.
Type
boolean

enable()

Enables the controller.

Overrides:
Source:

hide()

Hides this field by setting its display to 'none'.

Overrides:
Source:

isDisabled() → {boolean}

Checks if the controller is disabled.

Overrides:
Source:
Returns:
  • True if the controller is disabled, false otherwise.
Type
boolean

isHidden() → {boolean}

Checks if this field is currently hidden.

Overrides:
Source:
Returns:

True if the field is hidden, false otherwise.

Type
boolean

setConsole(text, typeopt)

Sets the console text and type.

Parameters:
Name Type Attributes Description
text string

The text to display in the console.

type string <optional>

The type of message ('error', 'warning', etc.).

Overrides:
Source:

setDisabled(doSetDisabled)

Sets the disabled state of the controller.

Parameters:
Name Type Description
doSetDisabled boolean

True to disable the controller, false to enable it.

Overrides:
Source:

setError(text)

Sets the error message in the console.

Parameters:
Name Type Description
text string

The error message to display.

Overrides:
Source:

setText(text)

Sets the text content of this field.

Parameters:
Name Type Description
text string

The new text content for the field.

Overrides:
Source:

setTooltip(tooltip)

Sets the tooltip text for this field.

Parameters:
Name Type Description
tooltip string

The tooltip text to set.

Overrides:
Source:

setWarning(text)

Sets the warning message in the console.

Parameters:
Name Type Description
text string

The warning message to display.

Overrides:
Source:

setup()

Setup for the controller.

Overrides:
Source:

show()

Shows this field by setting its display to '' (default).

Overrides:
Source: