Dynamic View Services > Specifying Dynamic View Types > Representation and Propagation Conditions > Representation Status
 
Representation Status
For each server runtime type, a runtime attribute rpStatus of type integer is implicitly declared by Rogue Wave® Server. A particular feature of this attribute is that its value is defined within the scope of each view. This means that an object can have a different representation status in different views. The representation status is very useful for controlling the way each object is notified in a view. For instance, in the CompanyTree view type, the representation status can be used to expand or shrink the tree for a given Department object:
view CompanyTree:
subscribe origin Company:
represent TreeR root:
string label=identifier;
propagate departments;
subscribe Department:
represent TreeItemR item:
Ref<TreeR> ownerTree=company->root;
string label=name;
propagate employees when (rpStatus==2);
subscribe Employee:
represent TreeItemR subItem:
Ref<TreeItemR> ownerItem=department->item;
string label=name;
By default, the representation status of a server object is:
*0 if the view does not subscribe to this object
*1 if it does.
This means that when opening a view CompanyTree, only the list of the departments making up the company appear in the tree. If you want to expand or shrink the tree for a given department, you must change the representation status of the department. One way to do this is to have the callback function TreeItemR::onSelection called when a double-click event occurs on the tree gadget item. This function uses a new data member defined by the user on TreeItemR to locally store the last representation status set.
After updating the status, the function IlsRpObject::setRpStatus is called, as shown in the code sample below:
void TreeItemR::onSelection()
{
_rpStatus=(_rpStatus==1)?2:1;
setRpStatus(_rpStatus);
}

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