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

Share this on .. Tweet about this on TwitterShare on LinkedIn0Share on Facebook0Share on Google+0Email this to someoneShare on Tumblr0Buffer this page

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})<br />           onmouseover=&quot;showToolTip(this,'${subRegion.templateBindingsContainer.templateBindings.DATA_PAGE}','${subRegion.templateBindingsContainer.templateBindings.LOV_PAGE}');&quot; <br />           onmouseout=&quot;hideToolTip()&quot;               <br />        #end<br />&nbsp;

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:

   &lt;af:panelGroup id=&quot;EmpInDeptRegionsPanelGroup&quot;&gt;<br />      &lt;af:panelHeader text=&quot;#{nls['FINANCIAL_TITLE']}&quot;<br />                      id=&quot;EmpInDeptRegionsfinancialPanelHeader&quot;<br />                      onmouseover=&quot;showToolTip(this,'Region Tooltip Title','Region Tooltip Text');&quot;<br />                      onmouseout=&quot;hideToolTip()&quot;&gt;<br />      &lt;amis:PlainDiv styleClass=&quot;contentRuler&quot;/&gt;<br />&nbsp;




JHeadstart Developer’s Guide

Apache Velocity User’s Guide 


Share this on .. Tweet about this on TwitterShare on LinkedIn0Share on Facebook0Share on Google+0Email this to someoneShare on Tumblr0Buffer this page

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PL/SQL), Service Oriented Architecture, BPM, ADF, JavaScript, Java in various shapes and forms and many other things. Author of the Oracle Press books: Oracle SOA Suite 11g Handbook and Oracle SOA Suite 12c Handbook. Frequent presenter on conferences such as JavaOne and Oracle OpenWorld. Presenter for Oracle University Celebrity specials.

Comments are closed.