3 Replies Latest reply on Feb 25, 2008 11:59 PM by pmuir

    Events and support for remove listener

    msystems

      I have a case where I want to add and remove an event programmatic. Events have an addListener() (and addListener() support only methodBindingExpression) but a removeListener() is missing, why?


      A solution is to use:


      Init.instance().addObserverMethod()
      



      and


      Init.instance().removeObserverMethods()
      



      But removeObserverMethods() removes all observers from a component - not useful every time.


      removeObserverMethods() javadoc/comment:


         /**
          * Remove any observer methods registered on the component. Needed to clean
          * out old observer methods on hot deploy
          * @param component
          */
      



      Looks like this is internal Seam stuff :-)
      And I guess Init is supposed to be used by Seam and not the users of the Seam framework !?


      But at the moment, I need to use


      Init.instance().addObserverMethod()
      Init.instance().removeObserverMethods()
      



      if I want to solve my issue.


      Would it be possible to expand Events with above functionality? Should I create a JIRA?

        • 1. Re: Events and support for remove listener
          msystems

          Events are application scoped. In my case, I need support for session scoped events.


          Would it be possible to support session scoped events?

          • 2. Re: Events and support for remove listener
            msystems

            Kenneth Christensen wrote on Feb 23, 2008 12:17 PM:


            Events are application scoped. In my case, I need support for session scoped events.

            Would it be possible to support session scoped events?



            Ups! That's wrong. Events are not only application scoped - they are processed in the current context.

            • 3. Re: Events and support for remove listener
              pmuir

              Kenneth Christensen wrote on Feb 23, 2008 11:55 AM:


              Looks like this is internal Seam stuff :-)
              And I guess Init is supposed to be used by Seam and not the users of the Seam framework !?


              It's not really public API, but you can use it :-)


              Would it be possible to expand Events with above functionality? Should I create a JIRA?


              Yes, we can expose a public API for this. Create a feature request in JIRA.