Values of Representation Attributes
The value of a representation attribute is an expression that can contain:
Literal values;
Access paths to runtime attributes and relations attached to Server object types;
Access paths to runtime attributes, relations, or parameters attached to dynamic-view types.
An access path must always be defined starting from the represented Server object.
For example:
subscribe Line:
represent MatrixItem item:
string column[1]=name;
string column[2]=input.name;
The value of the representation attribute column[1] is the value of the runtime attribute name of the runtime type Line, whereas the value of the representation attribute column[2] is the value of the runtime attribute name declared in the target type of the runtime relation input, that is, Node.
The first column attribute of an item representation associated with an object of type Line is automatically updated when the value of line.name is modified.
The second column attribute of this item representation is automatically updated when:
the target of
line.input is modified.
the entry
line.input.name is modified.
In the above example, the representation attributes column[1] and column[2] are directly associated with Server object attributes. Thus, they can be edited (see the member function IlsRpAttrModel::isEditable), provided that the related Server data members are associated with an editing function (see the macros ILS_ENTRY_XXX, ILS_W_ENTRY_XXX, ILS_RW_ATTRIBUTE_XXX and other dynamic view-related macros that declare data members and attributes as accessible at runtime). The updating of one of these attributes in the component must be notified to the server by calling one of the member functions IlsRpObject::onUpdate. As a consequence of the update, the corresponding Server attribute is modified.
The value of a representation attribute can be defined by more complex expressions containing logical, conditional, and relational operators (see
Appendix F, Grammar of Dynamic View Type Specifications). In this case, the attribute should not be updated directly by the component. Actually, the component may modify the attribute locally, but it cannot notify this modification to the server.
For example:
subscribe Node:
represent TreeItem item:
string color=
(inputCapacity>outputCapacity)
?"red"
:(inputCapacity<outputCapacity)
?"cyan"
:"green";
Such expressions can also contain calls to C++ functions, provided these functions have been previously defined as runtime-accessible by means of the macro ILS_MEMBER_FUNCTION or ILS_GLOBAL_FUNCTION. For example:
subscribe Node:
represent TreeItem item:
string color==GetNodeColor(inputCapacity,outputCapacity);
When parameters of the GetNodeColor function are modified, the function is automatically reevaluated and the color attribute of the concerned representation object is updated.
Important: This shows that the attributes used to compute the attribute color and likely to be modified must appear as parameters passed to the function. This remark is especially important for data member functions that can directly access the data members of the object and, therefore, do not usually need to specify them as parameters. |
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.