Here is an example of the result. Employee and Departments are menu items, the rest are menu nodes. For this demo I had to build two bounded task flows Employees and Departments. I will be using these task flow url's in the adf menu tree and pass this value to the dynamic region bean.
This is the menu table I used for this example.
I made two viewobjects based on this menu table, the first vo has the main menu records ( highest leve) and the second vo has the sub menu or menu items records. Main menu has a viewlink to the second vo and the second vo has a viewlink to itself. Here you can see my application module
Now we can drag the main menu vo to the page where we will select ADF Tree option
Configure the Tree Binding where we need to select the following attributes. Label, Type and TaskflowUrl
When you drag one of the bounded task flows to the jsf page you will get the option to create a dynamic region. This will also create a backing bean what looks like this.
I add the setTaskFlowId method to this bean and changed the scope of this backing bean to application.
package nl.ordina.view.backing;
import oracle.adf.controller.TaskFlowId;
public class TreeMenu {
private String taskFlowId = "/WEB-INF/employee-task-flow-definition.xml#employee-task-flow-definition";
public TreeMenu() {
}
public void setTaskFlowId(String taskFlow) {
this.taskFlowId = taskFlow;
}
public TaskFlowId getDynamicTaskFlowId() {
return TaskFlowId.parse(taskFlowId);
}
}
The JSF Tree page code looks like this. When the menu is a item then I will render a image and when you click on a label the taskflowurl value is passed on to the dynamic region bean and the page will show this task flow
<af:tree value="#{bindings.MainMenuView.treeModel}" var="node"
selectionListener="#{bindings.MainMenuView.treeModel.makeCurrent}"
rowSelection="single">
<f:facet name="nodeStamp">
<af:group>
<af:image source="/images/item.gif"
rendered="#{node.Type eq 'item' }" id="im"/>
<af:commandLink text="#{node.Label}">
<af:setActionListener from="#{node.TaskflowUrl}" to="#{TreeMenu.taskFlowId}"/>
</af:commandLink>
</af:group>
</f:facet>
</af:tree>
Here is the example workspace and the menu table script
Thank you!!! It helps me really a lot!!!
ReplyDeleteHi Edwin,
ReplyDeleteNice article. Thanks for sharing with us. Could you please let your idea about the UI arrangement in ADF.
I need to have a navationmenu for level0 and the rest of the levels in Tree. How can i use the XMLMenuModel to design this. I couldn't get much info about the Tree Menus using XMLMenuModel (May be i am looking in the wrong direction).
Thank you in advanced.
Ok,
ReplyDeleteI don't know exactly what you mean but I made a blog about a adf menu.xml which you in your jsf template. Then it can generate tabs, buttons or bullets. Not so fancy
do you have a example on the net so I know what you mean of send me a drawing
thanks Edwin
Hi Edwin thanks for the effort ,I appreciate if you can relate the tree menu with user role,same as you did with dynamic menu in previous blog ,i.e the tree menu will be according the previlages.
ReplyDeleteThanks
Bashir
Hi Edwin,
ReplyDeleteAbout a year ago, i've done a navigation system as it is in your example.
Actually it wasn't very reliable.
Have you met any problems with it ?
Regards,
Hristo
Hi Hristo,
ReplyDeleteIt is now very stable with the production version of 11g and WLS 10.3
And now you have support on this
thanks Edwin
Hi Edwin,
ReplyDeleteI am developing an ADF BC Application in JDev 10.1.3.3.
Can we develop a similar menu in this version of JDev as I mentioned or is it taskflows just something new with JDev 11?
Actually, I have tried developing your example in my application. The tree displays fine but the problem is that the leaf nodes also have a + sign, i.e., they're also treated as nodes.
My Menu Table:
MENU_ID NOT NULL NUMBER(10)
MENU_MENU_ID NUMBER(10)
COM_SHORT_NAME VARCHAR2(20)
NAME VARCHAR2(40)
SEQ NUMBER(8)
COMPONENT_TYPE NOT NULL VARCHAR2(3)
NON_ACTIVE VARCHAR2(1)
You have item type difend as Node or Item but I don't have that information currently with me.
My action URLs are stored in another child table.
Can you please guide how to handle this leaf nodes problem in JDev 10?
Regards,
Amir
Hi Amir,
ReplyDeleteTask flow is new in 11G but Oracle is thinking about donating this in to Trinidad.
Please check this blog of Lucas http://technology.amis.nl/blog/1298/fixing-the-adf-faces-tree-model-binding-leaf-nodes-without-folder-icon
or this http://technology.amis.nl/blog/?p=2116
thanks Edwin
Hi Edwin thanks for the effort ,I appreciate if you can relate the tree menu with user role,same as you did with dynamic menu in previous blog ,i.e the tree menu will be according the previlages.
ReplyDeleteThanks
Bashir
Iam waiting for your answer
Hi Bashir ,
ReplyDeletedo you mean to combine Dynamic Tree menu and Task Flow Regions and Dynamic Menu based on Roles ( Database)
http://biemond.blogspot.com/2008/11/dynamic-menu-based-on-roles-database.html
thanks Edwin
Hi Edwin,
ReplyDeleteI need a sample application with step by step instruction on Dynamic tree menu with Task flow regions so that when i click the department menu the department region is displayed and when i click the employee menu, the employee region is displayed.I need the explanation of the stuff so that i can go ahead and modify it.
I don't need the tree to be binded with the database tables etc.If a static hard coded menu is there or menu being driven by xml file that would be fine
Hi Edwin,
ReplyDeleteIt was very useful.. I have to provide different icons for parent and child nodes... i tried my best but could get none.. can you pl help me with a sample so that i can achieve it...
vini.gopal@gmail.com...
waiting for your help
Hi
ReplyDeleteyou have two options, use the rendered attribute to display which images/ icon
or use a switcher to see what the base class is
<f:facet name="tree">
<af:tree value="#{bindings.MainMenuView.treeModel}" var="node"
selectionListener="#{bindings.MainMenuView.treeModel.makeCurrent}"
rowSelection="single">
<f:facet name="nodeStamp">
<af:group>
<af:image source="/images/item.gif"
rendered="#{node.Type eq 'item' }" id="im"/>
<af:commandLink text="#{node.Label}">
<af:setActionListener from="#{node.TaskflowUrl}" to="#{TreeMenu.taskFlowId}"/>
</af:commandLink>
</af:group>
</f:facet>
</af:tree>
the switcher example
<af:tree value="#{bindings.DeptView1.treeModel}" var="node">
<f:facet name="nodeStamp">
<af:switcher facetName="#{node.hierType.viewDefName}">
<f:facet name="nl.ordina.model.DeptView">
<af:commandLink text="#{node}"
action="#{Dept.deptRegionLayout}">
<af:setActionListener from="#{node.Deptno}"
to="#{Dept.keyNo}"/>
</af:commandLink>
</f:facet>
<f:facet name="nl.ordina.model.EmpView">
<af:commandLink text="#{node}"
action="#{Dept.empRegionLayout}">
<af:setActionListener from="#{node.Empno}"
to="#{Dept.keyNo}"/>
</af:commandLink>
</f:facet>
</af:switcher>
</f:facet>
</af:tree>
Hi Edwin,
ReplyDeleteThanks for the wonderful article.
I am a novice in ADF and need to use it to create a menu tree where each item points to a detailed item on the right for my college project.
I would like to humbly request if you could provide step by step procedure on how to make the above application.
I would be indebted for this help.
Thanks & Regards,
Raghav
Hi Edwin - thanks for your very helpful blog posts. I'm just starting to work with ADF and your posts have been very helpful.
ReplyDeleteI have a problem similar to one described in a comment left in Dec. 2008. I'm using the XMLMenuModel with 5 layers of navigation. It works well and looks nice. However, I need to add three more layers of navigation in the form of a dynamic tree menu. I'm confused about how I integrate the two.
Thanks in advance.
[01:40:52 PM] Deployment cancelled.
ReplyDelete[01:40:52 PM] ---- Deployment incomplete ----.
[01:40:52 PM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)
#### Cannot run application TaskFlow_DynamicRegions due to error deploying to IntegratedWebLogicServer.
[Application TaskFlow_DynamicRegions stopped and undeployed from Server Instance IntegratedWebLogicServer]
Hi Edwin,
ReplyDeleteGood Post.Can yu please let me know how you relating the task flow url from table to page.