28 Sep 2014

Groovy Support for attribute UI hints

In one of my previous posts I showed how we can use Groovy expressions in custom properties of Entity and VO attributes. The technique allows custom property values to be evaluated at runtime and in order to use it we had to assign a Groovy expression to a custom property programmatically as it is not possible to do that declaratively at design time.

There is a new feature in JDeveloper 12.1.3 which allows to declaratively set up Groovy expressions for UI hints of entity and view attributes.  For example the UI hint "Display" of the Returndate attribute is defined as an expression "Roundtrip==Y":  


So, the Returndate attribute is supposed to be displayed only if it is a round trip, and this is achieved by using the visible attribute of the UI component:
<af:inputDate value="#{bindings.Returndate.inputValue}"
              label="#{bindings.Returndate.hints.label}"
              required="#{bindings.Returndate.hints.mandatory}"
              columns="#{bindings.Returndate.hints.displayWidth}"
              shortDesc="#{bindings.Returndate.hints.tooltip}"
              visible="#{bindings.Returndate.hints.DISPLAYHINT}"
              id="id2" partialTriggers="sor1">
 
The sample application for this post requires JDeveloper 12.1.3 and it is available for download here.

That's it!