You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Daniel Matriccino - Solid Cactus <Da...@solidcactus.com> on 2007/10/24 19:48:17 UTC

[Trinidad] XMLMenuModel Help

Hi,

I have a question on using the Trinidad navigationPane with
XMLMenuModel.  The top level of the tree I built is shown ( Home  |
Reports)  .. however when I click on any of the top level menu items,
it's children aren't shown. Instead the top level menu is shown again.
Here is the current code that I have:
 
menu.xml: 
<?xml version="1.0" encoding="iso-8859-1"?>
<menu xmlns="http://myfaces.apache.org/trinidad/menu">
  <itemNode id="home" label="Home" action="home"
focusViewId="/project/home/accountHome.faces">
    <itemNode id="config" label="Config" action="config"
focusViewId="/project/config/index.faces" />
    <itemNode id="addstore" label="Add Store" action="addStore"
focusViewId="/project/home/addStore.faces" />
  </itemNode>
    
  <itemNode id="top_menu_reports" label="Reports" action="reports"
focusViewId="/project/reports/index.faces">  
  </itemNode>
</menu>
 
faces-config.xml:

  <managed-bean>
    <managed-bean-name>xmlMenu</managed-bean-name>
    <managed-bean-class>
      org.apache.myfaces.trinidad.model.XMLMenuModel
    </managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
      <property-name>source</property-name>
      <property-class>java.lang.String</property-class>
      <value>/WEB-INF/menu.xml</value>
    </managed-property>    
  </managed-bean> 

jsf page:

  <!-- This Menu Renders ( Home  |   Reports) -->
  <div class="header">
 <tr:navigationPane value="#{xmlMenu}" level="0" var="item" hint="bar">
  <f:facet name="nodeStamp">
                    <tr:commandNavigationItem text="#{item.label}"
action="#{item.doAction}"/>
  </f:facet> 
 </tr:navigationPane>
  </div>
 

  <!-- This renders the top level menu as well ( Home  |   Reports)
... If Home is selected it SHOULD render  "Config"  and "Add Store" -->
  <div class="leftmenu">
 <tr:navigationPane value="#{xmlMenu}" level="1" var="item" hint="list">
  <f:facet name="nodeStamp">
   <tr:commandNavigationItem text="#{item.label}"
action="#{item.doAction}"/>
  </f:facet> 
 </tr:navigationPane>
  </div>


If I use a navigationTree with the startLevel of 0 and the value as my
xmlMenu, it will render the entire tree correctly. Do I need to tell the
navigationPane which top level Item that is selected? If so, how would I
go about doing this?
 
Thank you in advanced for your help.
 
Danny

Best Regards,

  
Daniel Matriccino
Application Developer
 

1.888.361.9814 x7027
570.991.0635
570.208.1948
 Did Daniel provide you with excellent service?
Let us know