@interface name="KitEditors" alias="$ENV">
Extension point for defining kit editors
The editor element definition is a union of a variety of editor element types, classified as follows:
The editor element's definition is made of the following properties:
General | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
id | QName | ALL | Element's identifier. The identifier is required for data bound elements, and must be unique within the editor's scope. The identifier can also be optionally provided for static elements. | ||||||||||||
type | Enum | ALL | Element's type according to the available types listed above | ||||||||||||
priority | Number | ALL | Element's priority. The element will be positioned according to it's relative priority | ||||||||||||
Data | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
domain | @lib:Global!ENUM_DEF | INPUT, CHOICE | An enumeration that defines the allowed values domain. Dynamic enumerations are allowed only for INPUT elements. | ||||||||||||
domain | Array | TREE | A recursive array that contains the tree nodes data (or a function returning such an array). Each item in the array is an object {value, text, children} that represents a tree node, where ~value is the node's value, ~text is the node's display text label, and ~children is an nested array (with same structure) representing the child nodes (if any). | ||||||||||||
min | Number | INPUT, SLIDER | Minimum value for numeric data types | ||||||||||||
max | Number | INPUT, SLIDER | Maximum value for numeric data types | ||||||||||||
step | Number | INPUT, SLIDER | Stepping value for numeric data types | ||||||||||||
popup | String | INPUT | Urn of the custom popup for user-defined data types | ||||||||||||
Display | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
label | String | ALL | Label to display near the element | ||||||||||||
descr | String | ALL | Description to display in the element's tooltip | ||||||||||||
icon | String | ACTION, DRAG | Url of icon to display in the element. Typically, ACTION elements use small icons (16x16), and DRAG elements use large icons (32x32). | ||||||||||||
content | String | STATIC | Html content to display in the element | ||||||||||||
minLabel | String | SLIDER | Label to display for the minimum value | ||||||||||||
maxLabel | String | SLIDER | Label to display for the maximum value | ||||||||||||
expand | Number | TREE | Number of levels to expand when the tree is first displayed (default is 1) | ||||||||||||
Style | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
frame | Enum | CHOICE, DISPLAY, INPUT, TREE | The element's frame style, according to:
| ||||||||||||
flat | Bool | CHOICE, TOGGLE | Indicates whether to use flat or classic buttons style | ||||||||||||
arrow | Enum | INPUT | Indicates when the dropdown arrow should be displayed, according to:
| ||||||||||||
style | String | ALL | Custom styling rules to apply on the element | ||||||||||||
Layout | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
outer | Number | ACTION(link), CHOICE, DISPLAY, INPUT, SLIDER, STATIC, TOGGLE, TREE | The element's outer margin (gutter), in grid units. The outer margin defines the indentation of the element's label. | ||||||||||||
inner | Number | CHOICE, DISPLAY, INPUT, SLIDER, STATIC, TREE | The element's inner margin (indentation), in grid units. The outer margin defines the indentation of the element itself. If the inner margin is equal to or less than the outer margin, then the element will be placed below the label. | ||||||||||||
columns | Number | CHOICE | Number of displayed columns (default is 1; 0 implies no columns) | ||||||||||||
height | Enum | CHOICE, DISPLAY, STATIC, TREE | The element's height, if the element is inside a group with flow layout:
| ||||||||||||
width | Enum | ACTION | Element's width, if the element is inside a group with flow layout:
| ||||||||||||
left, top, width, height | Number | ALL | The element's bounding box, if the element is inside a group with absolute layout. Each of the values can be specified either as a fixed number of pixels (nnn), or as a percentage of the corresponding dimension of the containing group (nnn%). | ||||||||||||
Constraints | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
getter | Function | CHOICE, CUSTOM, DISPLAY, INPUT, SLIDER, TOGGLE, TREE |
Dynamic value getter for the editor element. If provided, this function will be called whenever a
value needs to be set in the element, using:
| ||||||||||||
setter | Function | CHOICE, CUSTOM, INPUT, SLIDER, TOGGLE, TREE |
Dynamic value setter for the editor element. If provided, this function will be called whenever
the element's value is changed, using:
Where ~value is the value to set, ~data is the editor's data object, and ~def is this element's definition. The ~setter function may carry out any required actions based on the new value. If these actions modify other members of the ~data object, then the ~sideEffects property must be set to indicate this fact to the system. If the ~setter function returns a value, then this value is considered to be the ~actualValue to use in place of the original ~value. This enables placing constraints on the values space of the editor element. If the ~setter function does not return any value, then the values space will not be constrained. | ||||||||||||
format | Function | DISPLAY, SLIDER |
Dynamic value formatter for the editor element. If provided, this function will be called whenever
the element's value is displayed, using:
| ||||||||||||
visible | Function | ALL |
Dynamic visibility state of the editor element:
| ||||||||||||
active | Function | ALL |
Dynamic activation state of the editor element:
| ||||||||||||
sideEffects | Boolean | CHOICE, CUSTOM, INPUT, SLIDER, TOGGLE, TREE | Indicates whether this editor element has side-effects that may require repainting other elements in the editor. | ||||||||||||
Events | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
signal | @lib:Global!SIGNAL_DEF | ACTION | The signal to raise when the button is clicked | ||||||||||||
ondrag | Function | DRAG |
This function will be called when the user starts to drag the element, using:
| ||||||||||||
ondrop | Function | DRAG |
This function will be called when the user drops the element, using:
| ||||||||||||
Rules | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
dragRule | String | DRAG | Holds the Rule name that can be executed from within the ondrag function implementation. | ||||||||||||
dropRule | String | DRAG | Holds the Rule name that can be executed from within the ondrop function implementation. | ||||||||||||
Owner Draw | |||||||||||||||
Property | Type | Applies%SP%to | Description | ||||||||||||
paint | Function | CUSTOM |
Custom paint function to use for building the element's HTML markup. This function will be called
when the element is first constructed, using:
| ||||||||||||
repaint | Function | CUSTOM |
Custom value repaint function for the element. This function will be called whenever
the element's value is changed, using:
| ||||||||||||
capture | Function | CUSTOM |
Custom capture function for the element. This function will be called whenever
the value stored in the element needs to be captured, using:
| ||||||||||||
setVisible | Function | CUSTOM |
Custom function for setting the element's visiblity state, in the form:
| ||||||||||||
setActive | Function | CUSTOM |
Custom function for setting the element's activation state, in the form:
|
Data binding is the mechanism by which data is read from or written to the different editor elements. The data type depends on the element type, according to the ~Datatype column in the element types table above (~N.A. indicates that the element does not support data binding).
Typically, the editor is bound to a data object which serves as the data source for its elements. Each editor element corresponds to a member of the data object with the same name. Whenever the value of an element is changed, the value of the corresponding member in the data object will be updated to reflect the change, and vice versa. The concrete mechanism by which the data binding is achieved depends on the implementation of the component that renders the editor (see, for example, @lib:SmartForm).
All dynamic constraints (~getter, ~setter, ~visible, and ~active) can be written as a JavaScript function with the specific parameters described above,
or as a string containing a simple JavaScript expression according to the following rules:
Use a single statement that evaluates to the expected return value, or use a statement block ending with an explicit ~return statement.
Access the parameters ~data, ~value, and ~definition directly by their names.
Access members of the data object by prefixing their names with the '\@' symbol (i.e., ~\@field is equivalent to ~data.field). Use \@\@ to access the current ~value parameter.
Dependencies created using the shortcut notation (3) above are detected by the system and thus do not need to be declared explicitly with the ~sideEffects property. For example:
LEGEND: + optional, ! required
All editor elements always belong to exactly one editor group. The elements that belong to a group start with the first element following the group, and continue until the next group, or until the last element in the editor definition. If the first element in an editor definition is not a group, then a default group will be implicitly created. The group definition is made of the following properties:
General | ||||||||||||||||||||
Property | Type | Description | ||||||||||||||||||
id | QName | Group identifier (optional) | ||||||||||||||||||
type | String | Always set to ~group | ||||||||||||||||||
sortBy | String | The sortBy holds the name of the attribute to sort the group's properties by. By default it is set to 'label'. | ||||||||||||||||||
Display | ||||||||||||||||||||
Property | Type | Description | ||||||||||||||||||
title | String | The text to display in the group's titlebar. If omitted, the group's titlebar will not be shown. | ||||||||||||||||||
descr | String | The description to display in the group's tooltip | ||||||||||||||||||
toggle | Enum | The group's toggle mode, according to:
| ||||||||||||||||||
Styles | ||||||||||||||||||||
Property | Type | Description | ||||||||||||||||||
color | Enum | The group's background color, according to:
| ||||||||||||||||||
frame | Enum | The group's frame style, according to:
| ||||||||||||||||||
palette | Enum | The group's palette style for defining how drag elements in the group will be displayed, according to:
| ||||||||||||||||||
divider | Enum | The type of divider(s) to add to the group, according to:
| ||||||||||||||||||
caption | Enum | The group's titlebar style, according to:
| ||||||||||||||||||
scroll | Enum | The group's scrolling options, according to:
| ||||||||||||||||||
style | String | Custom styling rules to apply on the group | ||||||||||||||||||
Layout | ||||||||||||||||||||
Property | Type | Description | ||||||||||||||||||
layout | Enum | The group's elements layout, according to:
|
||||||||||||||||||
height | Enum | The group's height, according to:
|
||||||||||||||||||
align | Enum | Indicates how to align floating elements (such as buttons or static content) within the group, according to:
| ||||||||||||||||||
outer | Number | The group's default outer margin (gutter), in grid units | ||||||||||||||||||
inner | Number | The group's default inner margin (indentation), in grid units | ||||||||||||||||||
Constraints | ||||||||||||||||||||
Property | Type | Description | ||||||||||||||||||
visible | Function |
Dynamic visibility state of the editor group:
| ||||||||||||||||||
active | Function |
Dynamic activation state of the editor group:
|
For best visual appearance, it is recommended to group editor elements by their type and cardinality.
flag = visible(data, definition)