JHeadstart ADF Generation with Custom Templates – using custom properties when none are available

Lucas Jellema

Most our ADF application is generated. For many reasons, including an easier upgrade to 11g later on. That means a lot of fiddling with custom generator templates – the Velocity files. Occasionally I we have to make use of the JHeadstart Custom Properties to achieve advanced functionality. In our extensions to the standard templates we can refer to those custom properties and generate this functionality, driven by their values.

However, JHeadstart does not offer custom properties for Regions. I have requested them before, but the release that came out a couple of weeks ago does not have them. That means that my new advanced functionality for regions cannot be generated. Or can it?

Time for a dirty trick, a workaround in the truest sense of the word:....

We would like to be able to show a tooltip when the mouse hovers over the Region Title. That is not such a problem, just a matter of setting the onmouseover and onmouseout attributes on the panelHeader. However, where to get the title and text for the tooltip from. Unfortunately, a Region does not have Custom Properties.

That is where the really dirty workaround comes in: we abuse the template properties.

Instead of using Custom Properties – that we do not have for Regions – we use the Template Properties DATA_PAGE and LOV_PAGE (those do not apply to Regions anyway) for the Tooltip Title and Tooltip Text respectively.


In the custom version of the verticalRegionContainer.vm template, I have added the lines that will generate the onmouseout and onmouseover attributes to the panelHeader element generated for the sub-regions:

        #if (${subRegion.templateBindingsContainer.templateBindings.DATA_PAGE})

The challenge for me was to find the correct syntax for extracting the Template properties. We can get to the Template Properties through the templateBindingsContainer.templateBindings property on the subRegion; that returns a Map of all Template Properties. 

The result of generating our region with the custom template using the ‘custom properties’ set on the region:

   <af:panelGroup id="EmpInDeptRegionsPanelGroup">
<af:panelHeader text="#{nls['FINANCIAL_TITLE']}"
onmouseover="showToolTip(this,'Region Tooltip Title','Region Tooltip Text');"
<amis:PlainDiv styleClass="contentRuler"/>




JHeadstart Developer’s Guide

Apache Velocity User’s Guide 


Next Post

The Great Oracle SQL Quiz - your chance to get grilled at Open World (S290735) - two sample questions

Next week, I am doing two presentations at Oracle Open World, both on Thursday. One is on ADF – more on that later. The other one is The Great Oracle SQL Quiz, with 15 brain teasers, mind warpers and soul searching questions on SQL and PL/SQL. It’s the Quiz that […]
%d bloggers like this: