10 Replies Latest reply on Aug 31, 2010 9:03 AM by Ilya Shaikovsky

    Problem with rich:togglePanel and RichFaces 4.0.0.M1

    Nico Endter Newbie

      Hello Community,

       

      I have a little problem. If i used richt:togglePanel in my JSF 2.0-file i became follwoing exception from my glassfish-server:

       

       

      java.lang.UnsupportedOperationException
           at org.richfaces.component.AbstractTogglePanel.getValidators(AbstractTogglePanel.java:168)
           at com.sun.faces.component.validator.ComponentValidators.addValidatorsToComponent(ComponentValidators.java:276)
           at com.sun.faces.component.validator.ComponentValidators.addDefaultValidatorsToComponent(ComponentValidators.java:158)
           at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.processValidators(ComponentTagHandlerDelegateImpl.java:366)
           at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.privateOnComponentPopulated(ComponentTagHandlerDelegateImpl.java:347)
           at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:215)
           at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
           at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
           at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
           at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:57)
           at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
           at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
           at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
           at com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:149)
           at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
           at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
           at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
           at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:75)
           at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:145)
           at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:716)
           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
           at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
           at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
           at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
           at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
           at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
           at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
           at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
           at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
           at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
           at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
           at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
           at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
           at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
           at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
           at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
           at java.lang.Thread.run(Thread.java:619)
      
      
      
      

       

       

      My file looks like this:

       

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich"> 
      
          <h:head><title>Toggle Test</title>
          </h:head>
          <h:body>
              <rich:togglePanel id="layout" activeItem="short">
                   <rich:togglePanelItem id="short">
                      <h:commandButton>
                          <rich:toggleControl targetItem="details"/> // switches to details state
                      </h:commandButton>
                   </rich:togglePanelItem>
          
                   <rich:togglePanelItem id="details">
                        <h:commandButton>
                          <rich:toggleControl targetItem="short"/> //switches to short state
                        </h:commandButton>
                   </rich:togglePanelItem>
              </rich:togglePanel>
          
              <h:commandButton>
                   <rich:toggleControl activePanel="layout"/> // cycles through the states
              </h:commandButton>
          </h:body>
      </html>
      

       

      Whats wrong?

      Thanks and greets from Berlin(DE)

       

      Nachricht geändert durch Nico Endter

        • 2. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
          Nick Belaevski Master

          Hi Nico,

           

          That's a bug in M1. I see by source code that it should be fixed in the latest nightly build, can you please check with it?

          • 3. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
            Nico Endter Newbie

            Hi Nick,

             

            thanks for your answer, but can you tell me where I can download the nightly build?

            under http://www.jboss.org/richfaces/download/nightly.html it is not available

            • 4. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
              Ilya Shaikovsky Master

              if your project uses maven dependency management just use instructions from http://community.jboss.org/wiki/HowtoaddRichFaces4xtomavenbasedproject and define richfaces version as 4.0.0-SNAPSHOT.

              • 5. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
                Nico Endter Newbie

                Hi Ilya,

                 

                sorry, but i dont use maven dependency management. Can you tell me another way??

                • 7. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
                  Nico Endter Newbie

                  I have import the snapshot - jars from demo and use following xhtml:

                   

                   

                   

                  <h:head><title>Toggle Test</title>
                      </h:head>
                      <h:body>
                          <h:form id="container">
                              <rich:togglePanel id="layout" activeItem="short">
                                   <rich:togglePanelItem id="short">
                                      <h:commandButton>
                                          <rich:toggleControl targetItem="details"/> // switches to details state
                                      </h:commandButton>
                                   </rich:togglePanelItem>
                  
                                   <rich:togglePanelItem id="details">
                                        <h:commandButton>
                                          <rich:toggleControl targetItem="short"/> //switches to short state
                                        </h:commandButton>
                                   </rich:togglePanelItem>
                              </rich:togglePanel>
                  
                              <h:commandButton>
                                   <rich:toggleControl activePanel="layout"/> // cycles through the states
                              </h:commandButton>
                          </h:form>
                      </h:body>
                  </html>
                  

                   

                   

                  the Server displays the following exception:

                   

                   

                  SCHWERWIEGEND: /RF4Alpha.xhtml @28,60 activePanel="layout" Unhandled by MetaTagHandler for type org.richfaces.component.behavior.ToggleControl
                  WARNUNG: JSF1091: Für Datei skinning.ecss konnte kein Mime-Typ gefunden werden.  Fügen Sie eine Mime-Typ-Zuordnung zur web.xml der Anwendung hinzu, um dies aufzulösen.
                  SCHWERWIEGEND: Error Rendering View
                  
                  
                  java.lang.NullPointerException
                       at org.richfaces.component.AbstractTogglePanel.isActiveItem(AbstractTogglePanel.java:431)
                       at org.richfaces.component.AbstractTogglePanel.isActiveItem(AbstractTogglePanel.java:423)
                       at org.richfaces.component.AbstractTogglePanelItem.encodeAll(AbstractTogglePanelItem.java:68)
                       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:280)
                       at org.richfaces.renderkit.html.TogglePanelRenderer.doEncodeChildren(TogglePanelRenderer.java:131)
                       at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:159)
                       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
                       at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
                       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
                       at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
                       at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
                       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
                       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
                       at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
                       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
                       at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
                       at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
                       at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
                       at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
                       at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
                       at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
                       at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
                       at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
                       at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
                       at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
                       at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
                       at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
                       at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
                       at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
                       at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
                       at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
                       at java.lang.Thread.run(Thread.java:619)
                  
                  
                  

                   

                   

                  • 8. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
                    Ilya Shaikovsky Master

                    toggleContrl should be defined with

                    targetPanel - panel which will be switched.

                    targetItem - switching to state (optional)

                    • 9. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
                      Nico Endter Newbie

                      sorry Ilya,

                       

                      but I'm too stupid to do is yourself.

                       

                      i have change my file:

                       

                       

                      <h:form id="container">
                           <rich:togglePanel id="layout" activeItem="short">
                                <rich:togglePanelItem id="short">
                                     PANELITEM 1
                                     <h:commandButton value="switches to detail state">
                                          <rich:toggleControl targetPanel="layout" targetItem="details"/>
                                     </h:commandButton>
                                </rich:togglePanelItem>
                                <rich:togglePanelItem id="detail">
                                     PANELITEM 2
                                     <h:commandButton value="switches to short state">
                                          <rich:toggleControl targetPanel="layout" targetItem="short"/>
                                     </h:commandButton>
                                </rich:togglePanelItem>
                           </rich:togglePanel>
                      </h:form>
                      
                      
                      
                      

                       

                      but the exception is the same...

                       

                      can you help me again, please?

                      • 10. Re: Problem with rich:togglePanel and RichFaces 4.0.0.M1
                        Ilya Shaikovsky Master

                        1) define name and not id for togglePanelItem - the reason of the original exception.. Sorri didn't checked from the beginning. B.t.w. usage of id if name not defined and id does  -  already under implementation now

                        2) in order to use sequential switching - use targetItem="@next" (in nearest time we will supprot just skiping that attribute)

                        2.1) if need to go to first tab from the last if using sequentialswitching - add cycledSwitching="true" to panel component.