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


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 


About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.

Comments are closed.