0 Replies Latest reply on May 21, 2011 8:18 AM by Marcel K.

    CDI and custom listener sets

    Marcel K. Newbie
      Hello,

      imagine a wizard dialog that contains several steps whereas one of these steps is a file upload component.
      The wizard dialog is backed by a bean to manage the wizard configuration and the file upload component
      is also backed by a bean to manage file uploads.
      The file upload bean is injected into the wizard bean and contains a file upload handler method being called
      by the jsf ui component (Primefaces atm) when an upload occurs. In order to separate the generic file upload
      handler from the wizard bean I created an event/lister framework to get rid of any file upload events.

      So here's my approach: the wizard bean registers itself to the file upload bean. The file upload bean contains
      a Set<...> of upload listeners to be informed on any upload changes. The two beans are session scoped atm
      (just to make it simple first) and named. The wizard bean registers itself as a listener to the upload bean
      inside the @PostConstruct method of the wizard bean.

      Now my problem: When the jsf file upload component calls the file upload bean handler method for file uploads
      the set of registered upload listeners will always be empty. Is there a way to make it that way or do I have to
      call a wizard bean file upload handler that will redirect the event to the generic file upload handler?

      I just like the idea of events and listeners to be used that way but maybe this isn't appropriate here.
      Thanks for your help!
      - Marcel