Wednesday, March 12, 2014

Get the button pressed on af:dialog in the managed bean in ADF?

For this scenario let us assume that we are handling a dialog with three buttons Yes, No and Cancel as shown below













Step1

In this step bind the DialogListener of the af:dialog to the managed bean method which will be executed on clicking any button on the dialog. This can be configured as shown below from the property inspector.








Step2

get the button pressed as shown in the below code and perform the respective action.

import oracle.adf.view.rich.event.DialogEvent.Outcome;
import oracle.adf.view.rich.event.DialogEvent;

public void onDialogButtonPress(DialogEvent dialogEvent) {
Outcome dialogOutcome = dialogEvent.getOutcome();

if(dialogOutcome == Outcome.yes) {

}
else if (dialogOutcome == Outcome.no) {

}
else if (dialogOutcome == Outcome.cancel) {

}
}

Note:  The cancel event is deprecated and should be handled at the client side or invoke the server side event from client side. I shall explain this in another post.

No comments:

Post a Comment