Module: structure/pure/Switch

The switch widget shows two states (e.g. ON and OFF) and can toggle between them.

Since:
  • 0.8.0 (2012)
Author:
  • Christian Mayer
Source:

Example

Configuration example of a switch widget using mapping and styling

Switch turned on
Switch turned off

 ...
<meta>
 <mappings>
   <mapping name="OnOff">
     <entry value="0">O</entry>
     <entry value="1">I</entry>
   </mapping>
 </mappings>
 <stylings>
   <styling name="GreyGreen">
     <entry value="0">grey</entry>
     <entry value="1">green</entry>
   </styling>
 </stylings>
</meta>
...
<switch mapping="OnOff" styling="GreyGreen">
  <layout colspan="3"/>
  <label>Switch</label>
  <address transform="DPT:1.001" mode="readwrite">0/0/0</address>
</switch>

Requires

Methods


<inner> action(path, actor, isCanceled)

Action performed when the switch got clicked

Parameters:
Name Type Description
path String

Internal path of the widget

actor Element

DOMElement

isCanceled Boolean

If true the action does nothing

Source:

<inner> create(element, path, flavour, type)

Creates the widget HTML code

Parameters:
Name Type Description
element Element

DOM-Element

path String

internal path of the widget

flavour String

Flavour of the widget

type String

Page type (2d, 3d, ...)

Source:
Returns:

HTML code

Type
String

<inner> update(address, value)

Handles updates of incoming data for this widget

Parameters:
Name Type Description
address String

Source address of the incoming data

value String

Incoming data

Source: