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

    Events and support for remove listener

    Kenneth Christensen Novice

      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?