unsetSetContext > Semantics of Dynamic View Type Specifications > View Specification > Main Origin and Propagation
 
Main Origin and Propagation
A dynamic-view type must define its main origin as well as the relations through which notification is propagated.
The main origin of a view is the Server object passed as an argument to the IlsMvView constructor. It can be changed using the member function IlsMvView::setMainOrigin.
In the code sample below, the dynamic-view type DomainView declares Domain as its main origin type. This means that the main origin of a DomainView instance must be of type Domain or of a derived type. Notification will be propagated from the Domain object through the nodes relation, and then from each Node object to the Line targets of the relations inputLines and outputLines. These relations must have been first declared as runtime-accessible using macros such as ILS_OWNS_X, ILS_USES_X, and other dynamic view-related macros designed to declare Server relations.
view DomainView:
subscribe origin Domain:
...
propagate nodes;
subscribe Node:
...
propagate inputLines;
propagate outputLines;
 
subscribe Line:...
After a view DomainView is created, it subscribes to its main origin, a Domain object, and to all the Server objects that are accessed through the relations nodes, inputLines, and outputLines —that is, Node and Line objects. Notification is propagated throughout the object structure. This generic member function implements the semantics that define how a view subscribes to Server relations and objects.
Similarly, notification can be propagated up through the inheritance relationship —that is, to the parent classes from which the current class is derived.
Assuming that the class MyNode derives from the class Node and that MyNode has a relation r, the following specification is correct:
subscribe Node:
propagate inputLines;
propagate outputLines;
subscribe MyNode:
propagate r;
propagate Node;
When an object of type MyNode is notified about events, this notification is propagated as follows:
*first to relation r,
*then to the parent class Node through the inheritance relation Node.
Rogue Wave Server then executes the specification given for type Node. Thus, notification is propagated to the relations inputLines and outputLines.
To allow propagation through the parent class Node, the class MyNode must have been declared using the appropriate macros. For instance, if Node derives from the class IlsObject, it should have been declared as follows:
ILS_OBJECT1_BEGIN(MyNode,Node)
If the specification of MyNode is omitted, the dynamic view interpreter automatically executes the specification for Node whenever an instance of MyNode needs to be notified in the view DomainView.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.