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 10.1.3.2 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:
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:
onmouseover="showToolTip(this,'Region Tooltip Title','Region Tooltip Text');"
JHeadstart Developer’s Guide