Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1047

Myfaces example PanelNavigation Item toggles activ/open depending on ViewId (with Trinidad)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1.7
    • Panel Navigation2
    • None

    Description

      When you mix tomahawk and trinidad, and you use <t:panelNavigation2> with
      Item toggles activ/open depending on ViewId (like in the example in myfaces-simple-example)
      throws the following error:

      2007-07-04 20:19:29,790 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/myfaces-skins].[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.ClassCastException: org.apache.myfaces.component.html.ext.HtmlOutputText cannot be cast to org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlCommandNavigationItem
      at org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlPanelNavigationMenu.restoreOpenActiveStates(HtmlPanelNavigationMenu.java:93)
      at org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlPanelNavigationMenu.restoreOpenActiveStates(HtmlPanelNavigationMenu.java:105)
      at org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlPanelNavigationMenu.encodeBegin(HtmlPanelNavigationMenu.java:71)
      at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467)

      The solution that I have probed is this:

      Class HtmlPanelNavigationMenu

      public void restoreOpenActiveStates(FacesContext facesContext,
      UIViewRoot previousRoot,
      List children)
      {
      for (Iterator it = children.iterator(); it.hasNext(); )
      {
      UIComponent child = (UIComponent)it.next();
      if (child instanceof HtmlCommandNavigationItem)
      {
      HtmlCommandNavigationItem previousItem = (HtmlCommandNavigationItem)previousRoot.findComponent(child.getClientId(facesContext));

      The last line get the same component instance as child.

      I have replace the last line with this:

      HtmlCommandNavigationItem previousItem = null;

      try

      { previousItem = (HtmlCommandNavigationItem)previousRoot.findComponent(child.getClientId(facesContext)); }

      catch (ClassCastException ex)

      { previousItem = (HtmlCommandNavigationItem) child; }

      Works the same, but in case of error, cast directly.

      Attachments

        1. patch8.patch
          1 kB
          Leonardo Uribe

        Activity

          People

            grantsmith Grant Smith
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: