IoSvComponent Reference

Table of Contents


Introduction

The IoSvComponent class is intended as a superclass for components returned by user input and output state variables. It has no defined string. It implements some standard setup and methods for all user inputs and outputs.

The IoSvComponent class provides default setValue() and setDisabled() methods. These methods are intended for parent components (e.g., the state variable component implementations) to set input or output DOM element properties dynamically without having to remount the child component with different attributes. The default implementation makes some assumptions about how any child components or nodes are rendered and should be overridden by subclasses as appropriate.

Attributes

Constructor

class: IoSvComponent

Syntax

super(parent, template)

The IoSvComponent constructor sets up the following component instance properties:

Parameters


Instance methods

These methods are intended to be used by parent components to dynamically change the properties of the rendered components without re-rendering.

Inherited methods

onUserChange()

Syntax

onUserChange(value)

A method to be called by subclasses when a user changes an input. It calls the sVar state variable's the userChange() method with the value and forces a synchronization that will reset the value of the input to the state variable value if the userChange() rejects or modifies the value the user input.

Parameters


sync()

Syntax

sync()

This overrides the default Component sync() method. It calls the setValue() method when the sVar state variable's value has changed since the last call to sync(). It also calls the setDisabled() method when the sVar state variable's childSv.isDisabled state variable value has changed since the last call to sync().


setValue()

Syntax

setValue(value)

By default, setValue() will set the value property of the first component node to value, if this component has no child components. When this component has child components, it will call the setValue() method of the first child component. A component subclass can override this method to do something more specific to the subclass' implementation.

Parameters


setDisabled()

Syntax

setDisabled(disabled)

By default, setDisabled() will set the disabled property of the first component node to disabled, if this component has no child components. When this component has child components, it will call the setDisabled() method of the first child component. A component subclass can override this method to do something more specific to the subclass' implementation.

Parameters


Instance properties

sVar

The input or output state variable that this component is associated with.

Value

An object.


_mon.sVar

An SvMonitor instance for sVar.

Value

An SvMonitor.


_mon.isDisabled

If the sVar state variable is an input (isInput) and this component's valueOnly attribute is falsey, the _mon.isDisabled is an SvMonitor instance for sVar.childSv.isDisabled.

Value

An SvMonitor.


DOM element properties

This component does not render any DOM elements itself. That is left up to the subclass implementation.