Friday, November 29, 2013

Hierarchical ADF XML Menu Model

Create two unbounded task flows

xml_menu_tf1

xml_menu_tf2
Create ADF menu model right clicking the task flows
root_menu.xml 

<?xml version="1.0" encoding="windows-1252" ?>
<menu xmlns="http://myfaces.apache.org/trinidad/menu">
    <groupNode id="itemNode_m1_view1" label="label_m1_view1" idref="itemNode_m1_view2">
        <itemNode id="itemNode_m1_view2" label="label_m1_view2" action="m1_view2" focusViewId="/m1_view2">
            <sharedNode ref="#{root_menu2}"/>
        </itemNode>
        <itemNode id="itemNode_m1_view3" label="label_m1_view3" action="m1_view3" focusViewId="/m1_view3"/>
    </groupNode>

</menu>

root_menu2.xml 

<?xml version="1.0" encoding="windows-1252" ?>
<menu xmlns="http://myfaces.apache.org/trinidad/menu">
    <itemNode id="itemNode_m2_view1" label="label_m2_view1" action="m2_view1" focusViewId="/m2_view1"/>
    <itemNode id="itemNode_m2_view2" label="label_m2_view2" action="m2_view2" focusViewId="/m2_view2"/>
    <itemNode id="itemNode_m2_view3" label="label_m2_view3" action="m2_view3" focusViewId="/m2_view3"/>
</menu>
create adf template 

<?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"
          xmlns:f="http://java.sun.com/jsf/core">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <af:pageTemplateDef var="attrs" definition="private">
        <af:xmlContent>
            <component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
                <description/>
                <display-name>templateDef2</display-name>
                <attribute>
                    <attribute-name>attr1</attribute-name>
                    <attribute-class>java.lang.String</attribute-class>
                </attribute>
            </component>
        </af:xmlContent>
        <af:panelGridLayout id="pt_pgl1">
            <af:gridRow height="100%" id="pt_gr1">
                <af:gridCell width="100%" halign="stretch" valign="stretch" id="pt_gc1">
                    <!-- Content -->
                    <af:panelBox id="pt_pb1">
                        <f:facet name="toolbar">
                            <af:navigationPane id="pt_np1" value="#{root_menu}" var="n">
                                <f:facet name="nodeStamp">
                                    <af:commandNavigationItem text="#{n.label}" id="pt_cni1" action="#{n.doAction}"/>
                                </f:facet>
                            </af:navigationPane>
                        </f:facet>
                    </af:panelBox>
                    <af:decorativeBox id="pt_db1">
                        <f:facet name="center">
                            <af:decorativeBox id="pt_db2">
                                <f:facet name="center"/>
                                <f:facet name="top">
                                    <af:navigationPane id="pt_np3" level="2" value="#{root_menu}" var="o">
                                        <f:facet name="nodeStamp">
                                            <af:commandNavigationItem text="#{o.label}" id="pt_cni3" action="#{o.doAction}"/>
                                        </f:facet>
                                    </af:navigationPane>
                                </f:facet>
                            </af:decorativeBox>
                        </f:facet>
                        <f:facet name="top">
                            <af:navigationPane id="pt_np2" level="1" value="#{root_menu}" var="m">
                                <f:facet name="nodeStamp">
                                    <af:commandNavigationItem text="#{m.label}" id="pt_cni2" action="#{m.doAction}"/>
                                </f:facet>
                            </af:navigationPane>
                        </f:facet>
                    </af:decorativeBox>
                </af:gridCell>
            </af:gridRow>
        </af:panelGridLayout>
    </af:pageTemplateDef>
</jsp:root>

-          All the pages in the task flows should use the template created
 Run any of the page 

No comments:

Post a Comment