الجمعة، 17 أبريل 2020

ADF | Button Action or ActionListener queuing through bean programatically.

ADF | Button Action or ActionListener queuing through bean programatically.



During development sometimes we have to call several button events at a time. In ADF Button event listeners or we can say Action or ActionListeners can be called programmatically. There is a concept of action queuing in ADF. But i found a much easier and better way of doing it. As we call methods in java, we can call the Action or ActionListener too by passing the suitable parameters. In the given example I am simply using print statements to demonstrate. Follow the simple steps :


  1. Create an ADF application in JDeveloper and define a task flow and then create a view and add 3 buttons on the view. Nae them differently so that you can identify them. Here I have used names "Button 1" , "Button 2" , "Button 3". I have defined ActionListeners for all three buttons.
     
  2. Now go to bean and just write print statements in the actionListeners just to make sure that the control came to it.
  3. Now run the application and click on the "Button 3". Now look on the console, the print statements off the other two actionListeners are also printed. Thus our task is complete.
  4. Am attaching the sample application for this, You can download by clicking here.QueueingDemo.rar
  5. Note: This procedure will not work if you are using the ActionEvent's object i.e. passed in the method. If you are using the ActionEvent then you have to call the method by initializing the ActionEvent with the appropriate button.
    • First, create a binding of the component in the bean whose actionLister is to be called.
    • And then use :
      ActionEvent event = new ActionEvent(this.componentBinding);

      ** Here "componentBinding" is the binding of the button component in the bean.
      To initialize the ActionEvent and then use the object " event " to call the ActionListener

ليست هناك تعليقات:

إرسال تعليق

ADF: Programmatic View Object Using Ref Cursor.

ADF: Programmatic View Object Using Ref Cursor. Posted by:  Manish Pandey   April 25, 2013   in  ADF   Leave a comment   3758 Views Sometime...