Unofficial Content

ViewGenerator.dkt

Now we will explain some important points of this template that will be useful as a guide to understand how it is implemented and how it works. 
At the same time, it may be useful for the rest of the templates, since all of them follow the same structure: 

The parameters received by the template are indicated here. 
FileName - Instance name

<%@ Property Name="FileName" Type="System.String"%>
It takes the information from the folder where the objects will be generated.  
string folder = General.AttributeValue(instanceNode, "folder");
It starts scanning the instance and reads the Level node.
The template processes the instance xml by node.
foreach(XmlNode objectNode in instanceNode.SelectNodes("level")) 
The KB information is obtained (objects names, descriptions, etc.) using templatehelpers.dll (General.NodeName(objectNode) accesses templatehelpers.dll).
string objName = General.NodeName(objectNode);
string objDescription = General.NodeDescription(objectNode);
string descriptionAttribute = General.NodeName(objectNode.SelectSingleNode("descriptionAttribute"));
Calls the ViewTemplate sub-template to generate the View Tabs with all data transferred as parameter.  
<%@ CallSubTemplate ViewTemplate ViewNode='viewNode' ViewObjName='viewName' Folder='folder' SelectionLink='selectionLink' SelectionDescription='selectionDescription' ObjName='objName' Parm='parameterList' DescriptionAttribute='descriptionAttribute' %>
TabularTemplate and GridTemplate are called for each node in Tabs\Tab, depending on whether a component will be generated with tabular or with grid (Type property of Tab node).

foreach (XmlNode node in viewNode.SelectNodes("tabs/tab"))

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant