Control flow rules decides the rule of navigation from one activity to another activity .Following are the activities and control flow elements in ADF task flow
You can drag and drop the activities to the task flow diagram and join them using the control flows.Shown below is a simple task flow with two view activities connected through a control flow case.Pictorial representation of the control flow can be viewed from the structure tab in the left bottom corner. We will go through the xml source of it later in the blog.
If you click on the overview tab of the editor it will display as below.
The jsff pages used for the task flow cf_view1.jsff and cf_view2.jsff
cf_view1:
You can drag and drop the activities to the task flow diagram and join them using the control flows.Shown below is a simple task flow with two view activities connected through a control flow case.Pictorial representation of the control flow can be viewed from the structure tab in the left bottom corner. We will go through the xml source of it later in the blog.
If you click on the overview tab of the editor it will display as below.
The jsff pages used for the task flow cf_view1.jsff and cf_view2.jsff
cf_view1:
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="CF
View1" id="ot1"/>
<af:button text="button 1"
id="b1" action="tocfView2"/>
</af:panelGroupLayout>
</jsp:root>
cf_view2.jsff:
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="CF View2"
id="ot1"/>
</af:panelGroupLayout>
</jsp:root>
Created a managed bean in the backing bean scope
package test.view;
public class TestBean {
private boolean check=true;
public void setCheck(boolean check) {
this.check = check;
}
public boolean isCheck() {
System.out.println(" Check returns "+ check);
//check=false;
return check;
}
public TestBean() {
}
public void test() {
// Add event code here...
System.out.println("Test ..................");
}
public String fromActionTest() {
System.out.println("From fromActionTest.... ");
String ret="tocfView2";
return ret;
}
public String testingMethBinding() {
System.out.println("testingMethBinding");
// Add event code here...
return "tocfView2";
}
}
Create a page ctTest.jspx and drag and drop the taskflow as region.In the task flow set the from-action and if property of the control flow as below
Depending on the check property and return type of testingMethBinding() the flow will go to the next activity. The return string should be the from-outcome to go to the next view activity in this case.Please closely look at the xml source of the task flow.
<?xml
version="1.0" encoding="windows-1252" ?>
<adfc-config
xmlns="http://xmlns.oracle.com/adf/controller"
version="1.2">
<task-flow-definition
id="controlFlow">
<default-activity>cf_view1</default-activity>
<managed-bean id="__3">
<managed-bean-name>TestBean</managed-bean-name>
<managed-bean-class>test.view.TestBean</managed-bean-class>
<managed-bean-scope>backingBean</managed-bean-scope>
</managed-bean>
<view id="cf_view1">
<page>/cf_view1.jsff</page>
</view>
<view id="cf_view2">
<page>/cf_view2.jsff</page>
</view>
<control-flow-rule
id="__1">
<from-activity-id>cf_view1</from-activity-id>
<control-flow-case
id="__2">
<from-action>#{backingBeanScope.TestBean.testingMethBinding}</from-action>
<from-outcome>tocfView2</from-outcome>
<to-activity-id>cf_view2</to-activity-id>
<if>#{backingBeanScope.TestBean.check}</if>
</control-flow-case>
</control-flow-rule>
<use-page-fragments/>
</task-flow-definition>
</adfc-config>
The priority of the evaluation of the control flow rule is as below
1) from-activity-id,from-action,from-outcome
2) from-activity,from-outcome
3)from-activity
No comments:
Post a Comment