Introducing Rogue Wave Server > Introducing Dynamic View Services > Dynamic Views > Dynamic View Type Specification
 
Dynamic View Type Specification
Dynamic view type specification uses a dedicated language with which you can declare:
*which server object types the view is interested in,
*the representation object types associated with the server object types interesting the view,
*the server object types designated as the view origin(s), and
*recursive propagation through server relations from a main origin type to other relevant server object types.
If you define your views using the standard Server/Views mapping, the Rogue Wave Server Studio graphic editor makes this language transparent to the user.
Specification Sample
Since this manual is dedicated to the Server/Views mapping, the syntax of a dynamic-view type specification will not be discussed any further. However, below is a code sample illustrating the specification of a TreeView dynamic view. This specification uses the network application model containing the classes Network, Domain, Node, and Line, as well as a representation model using the Tree class as the tree root and the TreeItem class to represent the network nodes as twigs. Both representation classes have a label. In addition, any TreeItem must reference the Tree or any other TreeItem to which it must be attached.
view TreeView :
subscribe origin Network:
represent Tree root:
string label=name;
propagate domains;
subscribe Domain:
represent TreeItem item:
Ref<Tree> owner=network->root;
string label=name;
propagate nodes
subscribe Node:
represent TreeItem item:
Ref<TreeItem> owner=domain->item;
string label=name;
The above code sample can be commented as follows:
*The TreeView view has a server object of type Network as its origin.
*A representation object of type Tree, named root, is associated with the (main) origin type.
*The label value for the Tree representation object is given by the name attribute of the Network object.
*Notification propagates from the origin to each of its domains via the domains relation.
*Each Domain object is represented by a TreeItem object. This representation is called an Item. The owner attribute for a TreeItem expresses how this TreeItem is related to the tree root. The type of this attribute is a reference to a Tree object. In this example, the reference object is the root representation associated with the network to which the domain belongs.
*Domains in turn propagate notification to their nodes through the nodes relation and a TreeItem representation is associated with each node.
Representation Object Attributes
The value of representation object attributes can be expressed using relational or logical operators, or conditional expressions. However, when determining the value of an attribute requires more complex operations, the expressions used can also contain calls to C++ functions.
View specifications are not only used to create new representations, but also to modify existing ones while maintaining consistency with the underlying server object structure.
A representation object is automatically updated when the values of the expressions of its attribute are modified. For example, when a domain name is changed, the associated label attribute for TreeItem is automatically updated. Likewise, if a node is attached to a new domain, its associated TreeItem representation is automatically deleted within the Tree representation of its former domain and created in that of its new domain.
See “Defining the DomainsOfNetwork View”. and “Defining the DomainNodes View”. to learn two ways of defining a view in Rogue Wave Server Studio.

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