Transient Attribute

A transient attribute in the XML DataControl is a lot like the transient attributes in the ADF Business Components layer. 

On the page we want the user to be able to toggle between showing jobs information or not. So we will introduce an transient attribute called 'showJobInfo'.
We create this again with a simple annotation on a method in the same EmployeeCust Java class.   

A TransientAttr will always be an 'init' method with the annotation '@TransientAttr', after adding the annotation you should see an import appear from the class: 'org.adfemg.datacontrol.xml.annotation.TransientAttr'.
The return type, boolean in this case, determines of which type the attribute will be. 
The name of the attribute will be based on the method name, the prefix init will be stripped and there will be an attribute with the name 'showJobInfo'.
The XMLDCElement is the mandatory first argument of the method, which represents the actual element we are customizing (Employee).
The result of the method will be the initial value of the transient attribute.

Do not forget to rebuild your Java class and refresh your Data Controls panel, after this you should see an extra element in the Employee:

Now we are ready to continue building on the interface.
First we add the Element showJobInfo to the bottom of the page:
  

Add this to the page as an ADF Select Boolean Checkbox:

Don't forget to add the property autoSubmit="true" on the selectBooleanCheckbox.
Next we are going to add a read only form with information about the job of the employee:
 

Now all we need to do is add the rendered expression 

After this run the page to look at the result. 
 
Notice the showJobInfo with the initial value set to true (as we returned in the java method).
The layout of the JobInfo form doesn't look too good, but that's for an other time (smile)
Now lets try to toggle the checkbox and see what happens:

 
You see the formLayout with the job information disappear.