Title: Command dispatcher Post by: lulumOriss on December 07, 2011, 07:57:43 I often find myself having to manage a system of adding and editing data from the same interface. I have not found the right way to do it yet.
My first idea was to create a command that will check what other command has to be executed from a value in the body of the notification. It was, I think, the role of a macrocommand but it is not possible to override the execute method to retrieve the notification. What is the proper way to proceed? Thank you. lulu. Title: Re: Command dispatcher Post by: puremvc on December 07, 2011, 09:04:11 No pre-processing of the note is necessary if you make the user's intent clear through the event you send.
Send a different event from the view when you're adding than from when you are editing. Have the mediator listen for those events and send a different notification based on the event that was dispatched from the view. Then, an EditCommand or AddCommand will be triggered based on the notification that was sent from the mediator. The mediator does the translation of the user's intent into the notification that triggers correct logic. /** -=Cliff> Title: Re: Command dispatcher Post by: lulumOriss on December 07, 2011, 09:25:18 Hi Cliff,
Thank you for your answer. That's make sense. lulu. |