Dynamically add region at runtime

1-      Create a .jspx page based on your template as usual  and leave it blank until this time
2-      Create  all the bounded taskflows  that you wants and create the page fragments as usual.
3-      Create a java bean class called"DhamanJavaBean"
Package org.dhaman
import oracle.adf.controller.TaskFlowId;
public class DhamanJavaBean {
    private String taskFlowId = "/WEB-INF/emp-flow.xml#emp-flow";
    public DhamanJavaBean () {
        super();
    }
     public TaskFlowId getDynamicTaskFlowId() {
      return TaskFlowId.parse(taskFlowId);
  }
At this moment the calss contains only one attribute " taskFlowId" and only one method " getDynamicTaskFlowId()"
1-      Double click the "adfc-conf.xml" unbound taskflow and click on overview tab to add a new managed ben as follow:
-          Name:          dhamaBean
-          Class :          org.dhaman .DhamanJavaBean
-          Scope:          pageflow

2-      Now return to the  ".jspx" page and click on "Bindins" tab at the button of the page to open the  page definition bindings page.
3-      Under executable click add and select "adf task flow bindings" and select "task flow"

1-      Click ok  - the dialog will appear
1-      Id: region   " or you can write any name you like"
2-      taskFlowId: #{pageFlowScope.dhamanBean.dynamicTaskFlowId}   " this is the the method in the managed bean that will return the taskflow Id"
3-      click ok and return to the source of the page " I mean the jsf source"
4-      add a region tag under the facetRef  like this

         
                     value="#{bindings.region.regionModel}"/>
          >




1-      save all
2-      go to DataBindings.cpx and click on it and go to the structure window
  
1-      you will  add a "definition factory" in the databindings structure by right click on the Databindings and select "insert inside databinding" and select definition factory.
2-      A new folder will be created as "definitionFactories"
3-      Right click on that folder and select "insert inside" and select factory

-          Namespace:    http://xmlns.oracle.com/adf/controller/binding
-          className:   oracle.adf.controller.internal.binding.TaskFlowBindingDefFactoryImpl

1-      save all
1-      for testing add a default value for the " taskFlowId" in the java class. The default value is the task flow file  name followed by "#" and taskflow id as show in the example
2-      now run the .jspx file

Comments

Popular posts from this blog

Another user has changed the row with primary key oracle.jbo.Key[12 ].

Working With File Throgh WebUtill

Reading From File