Specifying a Hyper-Reference
Let us introduce hyper-references in the CompanyTree view type.
Example
view CompanyTree:
subscribe origin Company:
represent TreeR root:
HyperRef linkName={this->CompanyMatrix,identifier};
propagate departments;
subscribe Department:
represent TreeItemR item:
Ref<TreeR> ownerTree=company->root;
HyperRef linkName={this->DepartmentTable,name};
propagate employees;
...
The two linkName attributes for the root and item representations are hyper-references. As for any hyper-reference, they are defined in two parts linked by an arrow.
The first part of the expression specifies the view that must be opened when the hyper-reference is selected. It includes a server relation path and the name of a view type.
The second part is an expression whose
string value is used to represent the hyper-reference on the component side.
In the code extract above, the view for the first linkName hyper-reference is the CompanyMatrix view of the company itself. The value represented is the identifier of the company. For the second linkName hyper-reference, the view is the DepartmentTable view of the department itself. The value represented is the department name.
Note that the specification
HyperRef linkName={this->CompanyMatrix,identifier};
is semantically equivalent to:
HyperRef linkName={CompanyMatrix,identifier};
Both linkName hyper-references are called local hyper-references, because their relation is explicitly or implicitly this. As with references, the relation path of a hyper-reference can be any transitive path of unary relations. For instance:
view DepartmentTable:
subscribe origin Department:
represent TableR table:
HyperRef title=
{company->CompanyTree,getFullName(company.identifier,name)};
...
In this example, the title attribute is a hyper-reference to the CompanyTree view defined on the target of the relation company of the Department object. Its label is the result returned by the function Department::getFullName. The hyper-reference attributes are declared to the representation model interpreter via a specific macro. For the title hyper-reference, the declaration is the following:
ILS_RP_OBJECT_BEGIN(TableR)
ILS_RP_ATTR_HREF(TableR,title,setTitle)
...
ILS_RP_OBJECT_END(TableR)
The function IlsSwRepresentation::setTitle declared to assign the hyper-reference is the same as the function declared to assign a string title. This is because the value of a hyper-reference attribute from the component point of view is its representation string.
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.