7 Replies Latest reply on Jul 16, 2010 1:36 PM by nbelaevski

    Tree click event is fired out of sequence

    scorsagg

      Hi,

      I am using Richfaces 3.3.1 and the component in discussion is Rich:Tree. I use a dynamic way of building the tree and am using a custom view handler extending the FaceletViewHandler. I use java classes to create the component and provide the viewroot to JSF to render the components.

       

      Scenario: I select a node on the tree and show the relevant screen on the same page. Then I click on an ajaxCommandButton on the newly rendered screen.

       

      Problem: The click on the button is also calling the click event on the tree. Due to this an IllegalStateException exception is generated as I am trying to retrieve the rowdata in this method.

       

      I have a method expression created and set as the NodeSelectListener on the tree. I do not have a custom nodeslectionlistener.

       

      Could you explain why the tree click event is called out of sequence?

       

      Any help appreciated.

       

      Regards,

      Srikanth

        • 1. Re: Tree click event is fired out of sequence
          nbelaevski

          Hi Srikanth,

           

          ...Then I click on an ajaxCommandButton on the newly rendered screen.

           

          Problem: The click on the button is also calling the click event on the tree

          Is button located inside tree component or outside of it?

          • 2. Re: Tree click event is fired out of sequence
            scorsagg

            Hi Nick,

             

            The button is outside the tree component. The layout is something like this. There is a main body panel which has the left and the right panels under it. The tree component is in the left panel whereas the screens from the tree actions will be shown in the right panel. The problem is occuring when I click on the buttons present in the right panel. (All panels are rich:panel).

             

            I could actually get away from this situation by changing the state saving method to client in the web.xml.

             

            The problem still occurs if the state saving method is server and that is what we would like to use outside development area.

             

            Another thing that I tried was tree.setAjaxSubmitSelection(false); But this too did not help.

             

            Regards,

            Srikanth

            • 3. Re: Tree click event is fired out of sequence
              nbelaevski

              Ok, I see. Can you please try upgrading to 3.3.3.Final and check?

              • 4. Re: Tree click event is fired out of sequence
                scorsagg

                Hi Nick,

                 

                Upgrading to 3.3.3.Final did not help. The behaviour is still the same.

                 

                Any other suggestion please.

                 

                Regards,

                Srikanth

                • 5. Re: Tree click event is fired out of sequence
                  nbelaevski

                  Please post exception stack trace.

                  • 6. Re: Tree click event is fired out of sequence
                    scorsagg

                    java.lang.IllegalStateException: No tree element available or row key not set!
                    at org.richfaces.model.TreeDataModel.getRowData(TreeDataModel.java:284)
                    at org.ajax4jsf.component.UIDataAdaptor.getRowData(UIDataAdaptor.java:257)
                    at com.misys.liq.ui.controller.jsf.NavigationUIController.onNavigationGroup1Field1Click(NavigationUIController.java:212)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:597)
                    at org.apache.el.parser.AstValue.invoke(AstValue.java:152)
                    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                    at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
                    at org.richfaces.component.events.TreeEvents.invokeListenerBindings(TreeEvents.java:77)
                    at org.richfaces.component.UITree.broadcast(UITree.java:604)
                    at org.ajax4jsf.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:1364)
                    at org.richfaces.component.UITree.broadcast(UITree.java:586)
                    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
                    at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
                    at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
                    at org.ajax4jsf.component.AjaxViewRoot.processUpdates(AjaxViewRoot.java:432)
                    at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:102)
                    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
                    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
                    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    at com.misys.liq.servlet.filter.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:70)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                    at java.lang.Thread.run(Thread.java:619)

                     

                     

                     

                     

                    Here is another thread that is still waiting to execute, in the same method (Hence the exception occurs twice)

                     

                     

                     

                    Daemon Thread [http-8091-3] (Suspended (breakpoint at line 212 in NavigationUIController))
                    NavigationUIController.onNavigationGroup1Field1Click(NodeSelectedEvent) line: 212
                    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
                    NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
                    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
                    Method.invoke(Object, Object...) line: 597
                    AstValue.invoke(EvaluationContext, Class[], Object[]) line: 152
                    MethodExpressionImpl.invoke(ELContext, Object[]) line: 276
                    MethodBindingMethodExpressionAdapter.invoke(FacesContext, Object[]) line: 71
                    TreeEvents.invokeListenerBindings(TreeListenerEventsProducer, FacesEvent, FacesContext) line: 77
                    HtmlTree(UITree).broadcast(FacesEvent) line: 604
                    HtmlTree(UIDataAdaptor).broadcast(FacesEvent) line: 1364
                    HtmlTree(UITree).broadcast(FacesEvent) line: 586
                    AjaxViewRoot.processEvents(FacesContext, EventsQueue, boolean) line: 321
                    AjaxViewRoot.broadcastEvents(FacesContext, PhaseId) line: 296
                    AjaxViewRoot.processPhase(FacesContext, PhaseId, InvokerCallback) line: 253
                    AjaxViewRoot.processUpdates(FacesContext) line: 432
                    UpdateModelValuesPhase.execute(FacesContext) line: 102
                    LifecycleImpl.phase(PhaseId, Phase, FacesContext) line: 266
                    LifecycleImpl.execute(FacesContext) line: 132
                    FacesServlet.service(ServletRequest, ServletResponse) line: 244
                    ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 290
                    ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
                    ConfigurableXMLFilter(BaseXMLFilter).doXmlFilter(FilterChain, HttpServletRequest, HttpServletResponse) line: 178
                    Filter(BaseFilter).handleRequest(HttpServletRequest, HttpServletResponse, FilterChain) line: 290
                    Filter(BaseFilter).processUploadsAndHandleRequest(HttpServletRequest, HttpServletResponse, FilterChain) line: 368
                    Filter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 495
                    ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
                    ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
                    SessionTimeoutFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 70
                    ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
                    ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
                    StandardWrapperValve.invoke(Request, Response) line: 233
                    StandardContextValve.invoke(Request, Response) line: 175
                    StandardHostValve.invoke(Request, Response) line: 128
                    ErrorReportValve.invoke(Request, Response) line: 102
                    StandardEngineValve.invoke(Request, Response) line: 109
                    CoyoteAdapter.service(Request, Response) line: 286
                    Http11Processor.process(Socket) line: 844
                    Http11Protocol$Http11ConnectionHandler.process(Socket) line: 583
                    JIoEndpoint$Worker.run() line: 447
                    Thread.run() line: 619

                    • 7. Re: Tree click event is fired out of sequence
                      nbelaevski

                      Looks like issue caused by concurrent access to tree. Can you please add a4j:queue to the page and check if this helps?