Reference Widget Description
ReferenceWidgetDescription displays and edits a reference in a form.
The reference determines whether the widget handles a single value or multiple values, and whether it is a containment reference.
1. Core Properties
-
name: IdentifierThe identifier of the widget description. -
labelExpression: InterpretedExpression Computes the widget label.
-
helpExpression: InterpretedExpression Computes the optional help text.
-
diagnosticsExpression: InterpretedExpression Inherited from
WidgetDescription, but currently unused by reference widgets.
2. Rendering
-
isEnabledExpression: InterpretedExpression Returns
falseto make the widget read-only. A blank expression leaves it enabled, unless its semantic target is read-only. -
referenceOwnerExpression: InterpretedExpression Computes the
EObjectthat owns the reference. Defaults toselfwhen blank. -
referenceNameExpression: InterpretedExpression Computes the name of the reference on its owner. This expression is required; for example,
children.
The current reference values and the available choices are obtained from the semantic model.
Core and rendering expressions, action preconditions, and style conditions use the current form context:
-
self: ObjectThe semantic target of the widget, which may differ from the reference owner. -
editingContext: IEditingContextThe current editing context. -
parentElementId: StringThe identifier of the parent form element.
Form variables and iterators introduced by enclosing FormElementFor elements are also available in this context.
3. Actions
The following optional children configure the widget’s actions:
-
set: ReferenceWidgetSetAssigns a value to a single-valued reference. -
add: ReferenceWidgetAddAdds values to a multivalued reference. -
remove: ReferenceWidgetRemoveRemoves a value from a reference. -
clearButton: ReferenceWidgetClearButtonDescriptionClears all values of the reference. -
createButton: ReferenceWidgetCreateButtonDescriptionCreates an object using the creation dialog.
Each child has two properties:
-
preconditionExpression: InterpretedExpression Controls whether the action is displayed and can be executed through the UI. A blank expression is equivalent to
true. -
body: List<Operation>Operations that replace the default behavior when the list is not empty.
An absent child disables the corresponding action.
With an empty body, set assigns the selected object, add appends the selected objects, remove unsets a single-valued reference or removes the selected value from a multivalued reference, clearButton unsets the reference or clears its values, and createButton uses the default object creation behavior.
Reordering multiple values uses the default reference update behavior.
When the create button has a custom behavior, the specifier is responsible for explicitly updating the reference to include the newly created object, if needed.
3.1. Operation Variables
All five action bodies have the following variables:
-
self: ObjectThe semantic target of the widget. -
editingContext: IEditingContextThe current editing context. -
referenceOwner: EObjectThe evaluated owner of the reference. -
reference: EReferenceThe reference being edited.
Additional variables depend on the action:
-
set-
newValue: ObjectThe selected object.
-
-
add-
newValues: List<Object>The selected objects. -
newValue: List<Object>Deprecated alias fornewValues.
-
-
remove-
valueToRemove: ObjectThe object to remove from the reference.
-
-
createButton-
creationContainer: ObjectThe selected parentEObject, or the selectedResourcefor root creation. -
creationReference: EReferenceThe containment reference used for child creation;nullfor root creation. -
creationType: EClassThe selected type to create.
-
Action bodies use a fresh context: form variables, enclosing iterators, and parentElementId are not carried over from rendering.
4. Styling
-
style: ReferenceWidgetDescriptionStyleThe default style. -
conditionalStyles: List<ConditionalReferenceWidgetDescriptionStyle>Ordered styles with a condition: InterpretedExpression. The first matching style is used; otherwise the default style applies.
Both styles configure the widget label:
-
color: UserColorA reference to aFixedColor. -
fontSize: LengthThe font size, defaulting to14. -
italic: boolean,bold: boolean,underline: boolean,strikeThrough: booleanFont decorations, all defaulting tofalse.