Showing posts with label bounded taskflow. Show all posts
Showing posts with label bounded taskflow. Show all posts

Saturday, 21 May 2016

Button actionListener with an actionEvent.queue() issue

The other day, I faced an issue with the programmatic taskflow navigation. At first, it seemed to be a simple task. The purpose was to click a button on a page and navigate to the next step in the bounded taskflow.

The environment is MS Windows 10, JDeveloper is 12.2.1 (Build JDEVADF_MAIN_GENERIC_151011.0031.S).

The code for the button is:
af:button text="button 1" id="b1" action="save" actionListener="#{viewScope.bean.validate}"


The code for the actionListener is:
public void validate(ActionEvent actionEvent) {
        RichButton saveButton = (RichButton) actionEvent.getComponent();
        ActionEvent action = new ActionEvent(saveButton);
        System.out.println("The listener has fired ########### ");
        action.queue();
}

When the button is clicked, the actionListener fires continuously, so the user sees that the application is hang. The Oracle Support has opened a bug 23325363 : TASKFLOW NAVIGATION USING ACTIONLISTENER IS FIRED CONTINUOUSLY, which is being worked on a priority.


Update, which works OK, but the question still remains. "save" is the name of action.

public void validate(ActionEvent actionEvent) {
//RichButton saveButton = (RichButton) actionEvent.getComponent();
//ActionEvent action = new ActionEvent(saveButton);
//action.queue();

NavigationHandler nvHndlr =
FacesContext.getCurrentInstance().getApplication().getNavigationHandler();
nvHndlr.handleNavigation(FacesContext.getCurrentInstance(),
null,"save");
}