Dynamic View Services > Specifying Dynamic View Types > Hyper-References > Editing the Target of a Hyper-Reference
 
Editing the Target of a Hyper-Reference
The semantics used for editing the target of hyper-references is very similar to that used for editing references (see Editing a Reference). In particular, a hyper-reference attribute is not editable unless it is mapped to a runtime server relation path in which the last relation declares a modifier.
In the previous examples, the linkName hyper-references are not editable because they are mapped to the relation this, which has no modifier.
On the contrary, the title hyper-reference is editable because it is mapped to the inverted relation company, whose direct relation Company::departments is editable.
Let us consider now a ProjectTable view type which lists the properties of the contributions to a project in a TableR:
view ProjectTable:
subscribe origin Project:
represent TableR table:
....
propagate contributions
subscribe Contribution:
represent RowR row:
...
HyperRef column[1]={employee->EmployeeDataSheet,employee.name};
The hyper-reference attribute column[1] is mapped to the direct relation employee which has a modifier. Therefore, it can be edited.
Just as for references, editing the target of a hyper-reference means modifying the target of the corresponding relation path (see Editing a Reference).
*To nullify the target, use the following callback function:
IlsRpObject::onNullifyRef(IlsRpAttributelId);
*To replace the target, use the following function:
virtual IlsBoolean onUpdate(IlsRpAttributeId editedHyperRef,
const IlsRpObject& targetOwner,
IlsRpAttributeId targetHyperRef);
An employee contributing to a project can be replaced through reference editing or through hyper-reference editing with the same result.
Let us assume that the table gadget allows to drag and drop the row hyper-references, both within a table and between two different tables. Let us also assume that this operation executes the RowR callback function onHrefDragDrop on the destination row, taking as parameters:
*the column index of the destination row;
*the origin row;
*the column index of the origin row.
Here is the body of this callback:
RowR::onHRefDragDrop(int destColumn,
RowR& originRow,
int origColumn)
{
    onUpdate(getAttributeId("row",destColumn),
originRow,
getAttributeId("row",origColumn));
}
On the server side, the relation to be edited is determined first. In other words, the employee contributing to the project is represented by the destination row. This relation is assigned a new target object. This means that the employee contributing to the project is represented by the origin row.
The function IlsRpObject::isMatchingHRef checks whether a hyper-reference can be used to update another hyper-reference.
Note:  The onUpdate function used above can also be used to edit references when the new target is identified by a hyper-reference. Conversely, the onUpdate function that takes a representation object as a parameter (used in this code sample) can also be used to edit hyper-references.

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.