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

                 Key: TOMAHAWK-1047
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1047
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Panel Navigation2
            Reporter: Leonardo Uribe
         Attachments: patch5.patch

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.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to