Sunday, February 27, 2011

PageFlowScope variables

Drag and drop Set Property lister from operations pallette onto any component on your page. This gives flexibility to assign values to variables on the go whithout declaring them anywhere.

The value "test" will be assigned to variable demo, note the demo variable is not declated anywhere.

This can be used in many places e.g in menuitems create command menu items and you can drag and drop property listener on each of them. On clicking any of the items you assign different values to just one variable everywhere say #{pageFlowScope.menuClicked} and values as user defined.

Now in bounded taskflow say adfc-config.xml you can define controlflow for each of these values

You can also programmatically access pageFlowScope variables:
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("user_var","value" );
System.out.println("value"+AdfFacesContext.getCurrentInstance().getPageFlowScope().get("user_var")); //user defined variables as first argument.

This can be used in lot of places e.g. if you three tabs add, update, delete you can use single interface with all the buttons setting the buttons rendered property to values of this variable like this:

#{pageFlowScope.selectedTab == 'addTab'}