Widget data elements elements are addressed by using the relative path of the element from the widget where the request or answer was specified. The relative path is a sequence of widget object names separated by dots ('.'). Only atomic element references are specified in request/answer structure.
The grouping of elements into structures is done by the biggest common ancestor path of all atomic element references in a structure. It is assumed that this biggest common ancestor is addressing the structure. If for example a structure has the atomic widget element references "home.user.name" and "home.user.id" then we assume that "home.user" is adressing the structure containing "name" and "id" in the widget data.
Table 4.8. Basic elements of request/answer
Description | Syntax |
---|---|
Constant (server request only) | string with single (') or double (") quotes or numeric integral constant |
Mandatory attribute | name={variablepath} |
Mandatory content value | name{{variablepath}} |
Optional attribute | name={variablepath:?} |
Optional content value | name{{variablepath:?}} |
Optional attribute with default | name={variablepath:default} |
Optional content with default value | name{{variablepath:default}} |
Ignored attribute | name={?} |
Ignored content value | name{{?}} |
Ignored sub structure | name{?} |
Variable references can address other widgets than sub widgets of the current widget.
A dynamic property with the prefix 'link:' followed by an identifier as name declares the widget with the widget id as dynamic property value of the link definition to be referencable by name. The referencing name is the identifier after the prefix 'link:'. So if we for example define a dynamic property 'link:myform' with a widget id as value, then we can use the variable 'myform' in a widget path to address the widget.
The mechanism of widget links is mainly used for implementing form/sub-form relationships. A form opens a subform and passes its widget id to it with the form parameter 'widgetid=..'. A link is defined to the sub-form with the widget id passed to it. The subform signals some action to the parent that can address the data entered in the subform via this link.
Structure elements are separated by semicolon ';' and put into '{' brackets '}' with the name of the structure in front.
Arrays are marked with opened and closed square brackets '[' ']' without specifying dimension (arbitrary size or empty when missing).
Table 4.9. Types of arrays
Description | Syntax |
---|---|
Arbitrary Size Array of Content Values | name[]{{variablepath}} |
Arbitrary Size Array of Structures | name[]{structure definition} |
The following example shows an array of addresses:
address[]{ surname{{address.surname}}; prename{{address.prename}}; street{{address.street}} }
The widget element paths used to address the widget elements have to have a common ancestor path. In our example this would be 'address'. The common ancestor path is determining how elements are grouped together in the widget. It tells what belongs together to the same array element in the widget. Without common common ancestor path it would be impossible to determine what is forming a structure in the widget data. It distinguishes the case of having an array of adresses and the case of having an array of surnames, and array of prenames and an array of streets. The later makes not much sense here. With the common prefix we state how entities are grouped together to structures in the representation in the widget.
Indirection allows to define recursive structures. Indirection means that an element is specified as reference that is expanded when the element appears in the data structure to map. The grouping element of the indirection elements is the common ancestor of all non indirection elements in the structure containing the indirection.
Table 4.10. Types of indirections
Description | Syntax (name equals ancestor name) | Syntax (name differs from ancestor name) |
---|---|---|
Single Element Indirection | ^ancestor | ^item:ancestor |
Multiple Indirection | ^ancestor[] | ^item:ancestor[] |
Example representing a tree with arbitrary number of children per node:
item{ id={treewidget.id}; name{{treewidget.name}}; ^item[] }
Copyright © 2014 - Project Wolframe - All Rights Reserved