A checkbox input element which synchronizes with a target boolean value by executing specified getter and setter functions.

Because this is an Observer, you can connect it to a Subject; when the Subject broadcasts events, the observe method ensures that this control reflects the current target value.

Hierarchy (view full)

Implements

Constructors

  • Parameters

    • label: string

      the name shown in a label next to the checkbox

    • getter: (() => boolean)

      function that returns the current target state

        • (): boolean
        • Returns boolean

    • setter: ((value) => void)

      function to change the target state

        • (value): void
        • Parameters

          • value: boolean

          Returns void

    • Optional checkBox: HTMLInputElement

      the checkbox to use; if not provided, then a checkbox and label are created.

    Returns CheckBoxControlBase

Properties

getter_: (() => boolean)

function that returns the current target state

Type declaration

    • (): boolean
    • function that returns the current target state

      Returns boolean

label_: string

the name shown in a label next to the checkbox

setter_: ((value) => void)

function to change the target state

Type declaration

    • (value): void
    • function to change the target state

      Parameters

      • value: boolean

      Returns void

state_: boolean

The state of the user control (which might not match the state of the target)

Methods

  • Returns the top level Element of this control. For example, this might be a label Element that encloses an input Element.

    Returns HTMLElement

    the top level Element of this control

  • Returns the checked state of this control (which should match the target state if observe is being called).

    Returns boolean

    the checked state of this control

  • This callback fires when the button is clicked.

    Parameters

    • _event: Event

      the event that caused this callback to fire

    Returns void

  • Notifies this Observer that a change has occurred in the Subject.

    Parameters

    • _event: SubjectEvent

      contains information about what has changed in the Subject: typically either a one-time GenericEvent, or a change to the value of a Parameter

    Returns void

  • Sets the checked state of this control, and modifies the target if necessary.

    Parameters

    • newState: boolean

      the checked state to set the control to

    Returns void

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:

    DisplayShape{polygon:Polygon{'chain3'}}
    

    Returns string

    a minimal string representation of this object.

Generated using TypeDoc