Template Element (Data)
Context: HL Kit … Kit Reference … Data File Reference
The "template" Element
Templates are collection of related portals that are all linked to a common thing or pick. Each template is specified through the use of a "template" element. The complete list of attributes for this element is below.
id Id – Specifies the unique id of the template. This id is used in all references to the template. name Text – Public name associated with the template. Maximum length of 50 characters. compset Id – Specifies the unique id of the component set that things/picks shown within the template derive from. width (Optional) Integer – Specifies the initial width to be utilized for the template. If empty, the width is automatically determined by a set of rules. Default: Empty. height (Optional) Integer – Specifies the initial height to be utilized for the template. Default: "100". marginhorz (Optional) Integer – Specifies the margin gap included at both ends along the horizontal axis. The usable width of the template is the actual width minus double the horizontal margin. Default: "0". marginvert (Optional) Integer – Specifies the margin gap included at both ends along the vertical axis. The usable height of the template is the actual height minus double the vertical margin. Default: "0". istransaction (Optional) Boolean – Indicates whether this template is intended for use with buy or sell transactions. Default: "no".
The "template" element also possesses child elements that define various facets of the template. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.
live An optional "live" element may appear as defined by the given link. This element defines a Live Tag Expression that determines whether the template is shown to the user. portal One or more "portal" elements must appear as defined by the given link. This element specifies the individual portals which exist within the template. position An optional "position" element may appear as defined by the given link. This element defines a Position Script through which the portals are sized and positioned within the template. header An optional "header" element may appear as defined by the given link. This element defines a Header Script that coordinates the sizing and positioning of portals used within the header for the template.
The "live" Element
The "live" element defines a Live Tag Expression for the template, which determines whether the template is shown. The tag expression is compared against the tags assigned to the container associated with the template (e.g. the actor). If the tag expression is satisfied, the template is visible, else it is hidden. The complete list of attributes for this element is below.
PCDATA TagExpr – Specifies the code comprising the Live tag expression.
The "position" Element
The "position" element defines a Position Script for the template, which performs all the appropriate sizing and positioning of the contained portals within the region of the template. The complete list of attributes for this element is below.
PCDATA Script – Specifies the code comprising the Position script.
The "header" Element
The "header" element defines a Header Script for the template, which works exactly like the Position script, except for the portals it manipulates. This script is only used if the template is used as a dual header and contains specifically designated header portals. The complete list of attributes for this element is below.
PCDATA Script – Specifies the code comprising the Header script.
Example
The following example demonstrates what a "template" element might look like. All default values are assumed for optional attributes.
<template id="baAttrPick" name="Attribute Pick" compset="Attribute" marginhorz="18" marginvert="9"> <portal id="name" style="lblXLarge" showinvalid="yes"> <label field="name"/> </portal> <portal id="value" style="incrSimple"> <incrementer field="trtUser"/> <mouseinfo mousepos="middle+above"> @text = "Adjust attribute by clicking on the arrows." </mouseinfo> </portal> <portal id="info" style="actInfo"> <action action="info"/> </portal> <position><![CDATA[ ~set up our height based on our tallest portal height = portal[info].height ~if this is a "sizing" calculation, we're done if (issizing <> 0) then done endif ~position our tallest portal at the top portal[info].top = 0 ~center the other portals vertically perform portal[name].centervert perform portal[value].centervert ~position the info portal on the far right perform portal[info].alignedge[right,0] ~position the incrementer to the left of the info portal (plus a gap) perform portal[value].alignrel[rtol,info,-10] ~position the name on the left and limit its width to available space portal[name].left = 0 portal[name].width = minimum(portal[name].width,portal[value].left - portal[name].left - 10) </position> </template>