Results 1 to 6 of 6

Thread: Passing data from Command to Model

  1. #1

    Default Passing data from Command to Model

    I think it is a good idea to decouple Command and Model. Wondering what is the best way to pass data from Command to Listeners (could be any number of Models )?

    Thought of creating custom events to include the result and original event. Is this an overkill?

  2. #2

    Default

    What do you mean by "command" in this case? If you are referring to the command object used in the following...

    Code:
    <form:form commandName="myCommand">
    ...then the command is the model.

  3. #3

    Default actionscript Commnad

    No I mean actionscript Command, implementation of ICommand

  4. #4

    Default

    Oh, I haven't done Flash coding for eight years, and I suspect they might have changed it since then!

  5. #5
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    I'm not sure if I understand your question correctly but I'll try to answer anyway.

    In Spring ActionScript the ICommand interface is used in 2 scenarios:

    1. synchronous: in that case the resulting data of your command can be made available by returning it in the execute() method, since the methods return type is * (any type).
    2. asynchronous: in that case it is encouraged to implement IOperation (extends AbstractOperation). The result data can be made available via the result property of the COMPLETE event. You need to dispatch this yourself though. If you extend AbstractOperation, there is a convenience method that lets you pass in the result.

    Code:
    dispatchCompleteEvent(result);
    You can then listen for that event and read the result from the OperationEvent.

    regards,
    Christophe
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  6. #6
    Join Date
    Oct 2009
    Posts
    4

    Default

    Are you looking for something like this: http://www.gridlinked.info/cairngorm...notifications/?

    The idea is that view passes its own IResponder (called view responder) and passes it to the ICommand+IResponder through the CairngormEvent. Then after the IResponder handles the result/fault, it calls the result/fault of the view responder.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •