Reusable Accessible Mapping Platform

API Docs for: 5.2.0
Show:

OkCancelButtonBrick Class

Extends MultiBrick
Module: Bricks
Parent Module: Utils

The OkCancelButtonBrick prototype. A MultiBrick with two ButtonBricks displayed side by side and styled as OK and Cancel buttons. To instantiate, call new on the OkCancelButtonBrick prototype.

Imports RAMP Modules:

Util
TmplHelper
Array
Dictionary

Uses RAMP Templates:

templates/bricks_template.json

Methods

clear

() MultiBrick chainable

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:614

Clears the MultiBrick by clearing of the individual bricks inside the MultiBrick using their specific clear methods.

Returns:

MultiBrick:

itself

disable

(
  • disable
  • force
)
Brick chainable

Disables or re-enables the Brick.

Parameters:

  • disable Boolean

    true to disable; false to enable

  • force Boolean

    if true, disables the brick even if it's frozen

Returns:

Brick:

itself

displayNotice

(
  • notice
  • [noticeTemplate]
)
Brick chainable

Display a (error) notice on the brick.

Parameters:

  • notice Object

    object with notice data to be passed to the template

  • [noticeTemplate] String optional

    notice template name

Returns:

Brick:

itself

getData

(
  • [wrap]
)
Object

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:661

Returns MultiBrick's data by mixing together data of the individual bricks inside using their specific getData methods and then passing it to the Brick's getData method for potential wrapping.

Parameters:

  • [wrap] Boolean optional

    indicates of the payload should be wrapped with a Brick's id; useful when collection information from several Bricks at once.

Returns:

Object:

MultiBrick's data

isValid

() Boolean

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:629

Checks if the MultiBrick is valid. It's valid only if all individual bricks inside it are valid.

Returns:

Boolean:

true if valid; false if not

new

(
  • id
  • config
)
OkCancelButtonBrick chainable

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:936

Initializes the OkCancelButtonBrick by generating a specified template and setting defaults. Also sets a click listener on the template button. OkCancelButtonBrick is a brick with two preset buttons: OK and Cancel. Button container classes are predefined as "ok-button-brick-container" and "cancel-button-brick-container"

Parameters:

  • id String

    specified id of the Brick

  • config Object

    a configuration object for the Brick

    • [header] String optional

      a Brick header

    • [instructions] String optional

      a configuration object for the Brick

    • [required] Array | Object optional

      collection of rules specifying what external conditions must be valid for the Brick to be enabled

    • [freezeStates] Array optional

      a set of rules specifying states Brick should be frozen

    • [baseTemplate] String optional

      a base template name to be used

    • [noticeTemplate] String optional

      a notice template name to be used

    • [containerClass] String optional

      a CSS class of the specific brick container

    • [template] String optional

      a name of the specific Brick template

    • [buttonClass] String optional

      a CSS class of the button in the OkCancelButtonBrick

    • [okLabel] String optional

      an OK button label

    • [cancelLabel] String optional

      a Cancel button label

    • [okButtonClass] String optional

      an OK button CSS class

    • [cancelButtonClass] String optional

      a Cancel button CSS class

    • [okFreezeStates] String optional

      an OK button freeze states

    • [cancelFreezeStates] String optional

      a Cancel button freeze states

    • [reverseOrder] String optional

      reverses the default visual order of OK, Cancel button to Cancel, OK.

notify

(
  • eventName
  • data
)
Brick private chainable

Notifies a listener of a Brick event.

Parameters:

  • eventName String

    an eventName that should be reported

  • data Object

    a payload object to be passed along with the @event

Returns:

Brick:

itself

on

(
  • eventName
  • listener
)
Brick chainable

Sets a listener on the Brick for a specified eventName.

Parameters:

  • eventName String

    an eventName to listen for

  • listener Function

    a callback function to be called

Returns:

Brick:

itself

setData

(
  • data
)
MultiBrick chainable

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:645

Sets MultiBrick's data by setting data to the individual bricks inside it. Uses their own specific setData functions. *

Parameters:

Returns:

MultiBrick:

itself

setState

(
  • state
)
MultiBrick chainable

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:598

Sets the state of the MultiBrick by setting states of the individual bricks inside the MultiBrick using their specific setState methods.

Parameters:

  • state String

    a name of the state to set

Returns:

MultiBrick:

itself

Properties

_isFrozen

Boolean private

Indicates if the Brick is frozen and cannot be interacted with.

Default: false

_listeners

Object private

A collection of listeners to be notified of specified Brick events.

Default: {}

baseTemplate

String private

A default base template name.

Default: "default_base_template"

cancelButtonId

String private

Default id of the cancel button of the Brick, cannot be changed.

Default: "cancelButton"

cancelButtonId

String private

Default id of the cancel button of the Brick, cannot be changed.

Default: "cancelButton"

containerClass

String private

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:888

A CSS class of the OkCancelButtonBrick container node.

Default: "okcancelbutton-brick-container"

content

Array private

A collection of Brick objects to be displayed side by side in the MultiBrick.

Default: []

contentBricks

Object private

A dictionary of the initialized content Brick objects for easy lookup.

event

Object

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:852

A dictionary of possible OkCancelButtonBrick events. Adds a OK_CLICK and CANCEL_CLICK events to the default ButtonBrick events.

Example:

 event: {
                         CHANGE: "brick/change",
                         CLICK: "buttonBrick/click",
                         OK_CLICK: "okCancelButtonBrick/okClick",
                         CANCEL_CLICK: "okCancelButtonBrick/cancelClick"
                     }
                    

freezeStates

Array private

A set of rules specifying states Brick should be frozen.

Default: []

Example:

 [
                          Bricks.Brick.state.SUCCESS,
                          Bricks.Brick.state.ERROR
                      ],
                    

header

String private

A Brick header.

Default: ""

instructions

String private

An instructional text to be displayed.

Default: ""

multiContainer

Object private

A MultiBrick container node.

noticeTemplate

String private

A default notice template name.

Default: "default_brick_notice"

okButtonId

String private

Default id of the OK button of the Brick, cannot be changed.

Default: "okButton"

required

Array

A collection of rules specifying what external conditions must be valid for the Brick to be enabled. This is not used directly by the Brick itself, but instead by the external object manipulating a collection of Bricks. Two types of rules possible: "all" and "any". Any additional properties needed can be specified.

Default: null

Example:

 [
                          {
                              type: "all",
                              check: ["serviceType", "serviceURL"]
                          }
                     ]
                    

reverseOrder

Boolean private

Reverses the default visual order of OK, Cancel button to Cancel, OK.

Default: "false"

state

Object

A dictionary of Brick events.

Example:

state: {
                      SUCCESS: "brick/success",
                      ERROR: "brick/error",
                      DEFAULT: "brick/default"
                     }
                    

template

String private

Inherited from Brick but overwritten in src\js\RAMP\Utils\bricks.js:508

A name of the default MultiBrick template.

Default: "default_multi_brick_template"

Events

Bricks.Brick.event.CHANGE

Published whenever a Brick undergoes some change.

Event Payload:

  • data Object

    anything, usually result of calling getData() on the Brick

Bricks.OkCancelButtonBrick.event.CANCEL_CLICK

Published whenever an Cancel button of the OkCancelButtonBrick is clicked

Event Payload:

  • data Object

    anything, usually result of calling getData() on the Brick

Bricks.OkCancelButtonBrick.event.OK_CLICK

Published whenever an OK button of the OkCancelButtonBrick is clicked.

Event Payload:

  • data Object

    anything, usually result of calling getData() on the Brick