3 Replies Latest reply on Jul 19, 2007 12:57 PM by maku01

    panelBar snapshot 3.0.2 (20070718) selectedItem ignored

    andyredhead

      Hi,

      I'm quite new to JSF/Facelets and very new to RichFaces, so this might be a stupid question...

      I'm trying to use a panelBar as part of the navigation for an application (in a similar style to the left-hand "option bar" in outlook).

      I'm using Facelets and the latest snapshot version of RichFaces 3.0.2 20070718 (and Seam 2.0.0.BETA1).

      The idea is that the relevant templates will define an area for a left-nav component, I create a "nav component" for the left-nav (using the panelBar) and then each view will fill the left-nav area by including the "nav component" and setting a param that sets the appropriate panelBarItem for that page as the selectedItem on the panelBar.

      The problem is that no matter what value I set selectedItem to, the first panelBarItem is always the selected one when the page is rendered (the other elements are included and the panelBar shows the panelBarItems when the items are clicked on the rendered page, so I reckon the basic config is ok).

      So, the "nav component" xhtml looks like:

      <ui:component id="admin-leftnav-component">
       <rich:panelBar selectedPanel="#{active-nav-panel}" width="300">
       <rich:panelBarItem label="Home">
       <ui:include src="left-nav-home.xhtml"/>
       </rich:panelBarItem>
       <rich:panelBarItem label="Entity Admin">
       <h:outputText value="flobber"/>
       </rich:panelBarItem>
       </rich:panelBar>
      </ui:component>
      
      


      Including the "nav component" along with setting the selected item name looks like:

      <ui:define name="leftnav-area">
       <ui:include src="../left-nav-panel.xhtml">
       <ui:param name="active-nav-panel" value="Entity Admin" />
       </ui:include>
      </ui:define>
      


      I'd appreciate it if anyone can tell if I'm doing something silly or if this just isn't going to work...

      I started using the snapshot version of RichFaces because I stumbled upon:
      http://jira.jboss.com/jira/browse/RF-20
      Which looks like it should allow the kind of thing I'm trying to do.

      Thanks,

      Andy

        • 1. Re: panelBar snapshot 3.0.2 (20070718) selectedItem ignored
          andyredhead

          I had a look at the updated javadoc for the panelBarItem and noticed a "name" attribute...

          I changed the "nav component" definition to look like:

           <ui:component id="admin-leftnav-component">
           <rich:panelBar selectedPanel="#{active-nav-panel}" width="300">
           <rich:panelBarItem label="Home" name="Home">
           <ui:include src="left-nav-home.xhtml"/>
           </rich:panelBarItem>
           <rich:panelBarItem label="Entity Admin" name="EntityAdmin">
           <h:outputText value="flobber"/>
           </rich:panelBarItem>
           </rich:panelBar>
           </ui:component>
          


          Unfortunately, this has made no difference :(

          • 2. Re: panelBar snapshot 3.0.2 (20070718) selectedItem ignored
            andyredhead

            Looks like I missed this post in my trawl through the contents of this forum:

            http://jboss.com/index.html?module=bb&op=viewtopic&t=104275

            I think they are asking for the same thing - ability to open panelBar with a selected panel showing (rather than the first panel).

            The jira issue:

            http://jira.jboss.com/jira/browse/RF-20

            is show as closed though :(

            • 3. Re: panelBar snapshot 3.0.2 (20070718) selectedItem ignored
              maku01

              I've the same problem.

              Than I tried the approach with binding but I got an Exception


              java.lang.IllegalArgumentException: Component j_id3 not instance of org.richfaces.component.UIPanelBar
               at org.ajax4jsf.framework.renderer.RendererBase.encodeBegin(RendererBase.java:94)
               at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:785)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
               at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
               at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
               at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
               at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
               at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
               at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
              

              Could anybody give us a hint what's going on? (and why the jira issue is closed)


              TIA

              Martin