Wednesday, September 9, 2009

How to skip entity level validations until the transaction is submtted?

When there are entity level validations in your EO, those validations get fired in your pages for every action say for example, on switching a tab or clicking on a button etc. But, many times you want to prevent these validations until you submit the transaction. i.e., you want to get these validations only when you're submitting/committing the transaction.

For that, you need to goto the page definition of main jspx page(if you're having jsff pages, there will be one main jspx that contains the template i.e, that accommodates these jsffs) and then, in the main tag, add property skipValidation='true'. This will suppress all entity level validations until u submit the transaction. And, all attribute level validations will be working as it is. Example pageDefinition tag is given below:

<pagedefinition xmlns=""> version="" id="CarDecorsHomePageDef" Package="" SkipValidation="true"> </pagedefinition>

How to execute a method before the jsf page gets loaded?

If you want to execute a method just before entering a page(jsff or jspx) in a task flow, just follow the below steps.

1. Go to page definition of the jsf page. In the bindings section, add the methodAction to the method which you want to execute.

2. In the executables section, add 'invokeAction' and then, in the dialog specify some id and select the method action which you added in bindings for the 'Binds' property.

3. Now, select the added action and click 'Edit' icon and specify the 'Refresh' property as 'ifNeeded' ( By default the value for 'Refresh' will be 'deferred').

Thats it. When you run the page, the method will be executed just before the actual page loads. So, if you want to execute some method(s) before loading a page, you can follow these steps.

How to make ADF <af:train> component center aligned?

As you can see the <af:train> component has no 'align' property and so we can't align it at the center of the page as we wanted.

So, you need to put it <af:train> in <af:panelGroupLayout> and set the halign="center" and inlineStyle="width:30%;halign:center;".

<af:panelgrouplayout inlinestyle="width:30%;halign:center;"> halign="center" layout="horizontal" id="trainPnlGrpLyt"> <af:train value="#{controllerContext.currentViewPort.taskFlowContext.trainModel}"> id="train"/> </af:train> </af:panelgrouplayout>

The inlineStyle's width can be changed to 40%, 50%, etc. depending on the number of stops in the train. But, generally a value between 30-40% will suffice your requirement( The lesser the value is the train stops will be truncated and the more the value, the alignment will be incorrect).
Related Posts with Thumbnails