3 Replies Latest reply on Jul 3, 2006 11:38 AM by Gavin King

    Seam Events

    Istikhar Ahmad Newbie

      Seam component model is focussing on Event driven applications. so the following types of events are there.

      JSF events
      jBPM transition events
      Seam page actions
      Seam component-driven events.

      My question is in real application scenario what role Seam Component-driven events are playing, what kind of their useage would be?

      Can some one please provide some details?


        • 1. Re: Seam Events
          Istikhar Ahmad Newbie

          In JSF we simply associtate the JSF page actions by using the commands ( Combo box selects, Command Buttions clicks etc) and the backing bean populates with the required values from the page. I am assuming in Seam component-driven events model components can call actions of each others. How the data is availabe in backing bean to the respective component?

          • 2. Re: Seam Events
            Norman Richards Master

            Look at the booking app for an example of what a component driven event looks like. Components can raise events when you want to completely uncouple the interaction between components. Obviously any component can inject another component and call a method on it, but that action of calling the other component might not really be core to function of that component.

            In the booking app, a bookingConfirmed event is raised. The bookingListAction listens for this event and acts on it by refreshing its data. Why should the actually booking code have the code to call out and tell the other components what to do? That's a mix of concerns. If you want to make your components as pure as possible, you can model this type of interaction with events. Any component that might need to change its state can listen to the event. (maybe even none) It's a very flexible way to go about doing things.

            Hope that gives you some ideas...

            • 3. Re: Seam Events
              Gavin King Master

              Right, one of the things that Seam can really do is allow you to write _very_ loosely coupled components. It's hard to explain exactly what it is about this model that makes that easier than in other architectures, but its somehow to do with:

              * events bound to components via EL +
              * contextual state

              Well, anyway, that is what I have observed. I wonder what other people think about that.