2 Replies Latest reply on Apr 1, 2008 1:23 PM by vace117

    panelMenu bug?

    vace117

      Hello, developers. First of all, I would like to say - great work with RichFaces. It's awesome.

      I just started using RichFaces and I think I found a small bug in panelMenuGroup component. However, since I am really new to the framework, I am not sure that this is bug, instead of just me being stupid. If someone could corroborate either the former or the latter, I would appreciate it :).

      Here is what I am trying to do:

      <rich:panelMenu mode="server" binding="#{menuBackingBean.htmlPanelMenu}">
       <rich:panelMenuGroup expandMode="server" label='Home' action="#{menuBackingBean.homeMenuAction}" />
       ...etc...
      


      Essentially I am trying to get a group to act like an item that looks like a top level group. Since panelMenuGroup has an action attribute, I assumed it was possible.

      However, there is a problem. UIPanelMenuGroup class implements ActionSource, which allows it to be a source of ActionEvents. So if I specify an action="" attribute for my panelMenuGroup the ActionEvent is queued as it should, except that UIInput from which UIPanelMenuGroup inherits doesn't know how to process ActionEvents! I am talking about this line in UIInput:

       public void broadcast(FacesEvent event)
       throws AbortProcessingException
       {
       if (!(event instanceof ValueChangeEvent))
       {
       throw new IllegalArgumentException("FacesEvent of class " + event.getClass().getName() + " not supported by UIInput");
       }
      


      Since event is an ActionEvent, the above code blows up. How can this possibly work? It is, however, difficult to believe that no one ever tested the action attribute on panelMenuGroup :), so I am probably doing something wrong. Can anyone comment?

      Thanks.

        • 1. Re: panelMenu bug?
          ilya_shaikovsky

          action in panelGroup works fine for me in 3.2.0 GA.

          • 2. Re: panelMenu bug?
            vace117

            Thanks for checking, Ilya.

            When you told me that it works for you I tried it with JSF-RI and it worked for me too. The key to it working is this code in UIComponentBase.broadcast():

             if(event.isAppropriateListener(listener)) event.processListener(listener);
            


            MyFaces implementation lacks this sort of check in UIInput.broadcast(), which is why it doesn't work.

            Since RichFaces is supposed to work with MyFaces, the event type check should probably be added to UIPanelGroup.broadcast() just as a work around to be compatible with MyFaces. Of course this is clearly MyFaces' fault, so perhaps a bug report to them would be in order as well...


            Val