Showing posts with label af:train. Show all posts
Showing posts with label af:train. Show all posts

Thursday, October 28, 2010

ADF UI - How to specify actionlistener for train buttons (i.e., 'Back' and 'Next' buttons in <af:trainButtonBar>)

The most common requirement for the applications that use ADF train component is to specify the actionlistener for the train navigation buttons 'Back' and 'Next'. But, generally we use <af:trainbuttonbar> to render 'Back' and 'Next' buttons which doesn't have the property 'actionListener'. So, here I'll show to achieve the same 'Back', 'Next' train navigation using normal command buttons or command toolbar buttons so that we can specify action listener and other properties like 'immediate' to supress validations on clicking 'Back' or 'Next' buttons.

Just use the below code instead of <af:trainbuttonbar> in your page to achieve the same navigation effect along with the properties you require from the commandButton.


<af:commandButton id="back" text="Back" action="#{controllerContext.currentViewPort.taskFlowContext.trainModel.getPrevious}" immediate="true"/> <af:commandButton id="next" text="Next" action="#{controllerContext.currentViewPort.taskFlowContext.trainModel.getNext}" immediate="true"/>


Here, we're actually getting trainModel from trainFlowContext and navigating back and forth using 'getPrevious' and 'getNext' methods. That's it! Enjoy :) !

Wednesday, September 9, 2009

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