A port of the Cafe Townsend Cairngorm example created by Darren Houle. We modified the Cairngorm example to use Mate Framework.
A port of the Cafe Townsend Cairngorm example created by Darren Houle. We modified the Cairngorm example to use Mate Framework.
In MainEventMap -> LoginEvent.LOGIN where does lastResult originate?
Michael
Regarding lastReturn, see:
Using lastReturn and Using Smart Objects
In the Mate version of this example, if we look at the event map for an employee delete, you wrote "assume everything was ok ..." then dispatch an event to the view to it updates. But in a more complex application, my question is, what are the coding options if the delete (or whatever complex operation needs be done to the model data) does not succeed, and the view(s) need to be notified differently according the outcome of the model operation? In other words, how would I introduce some fault related logic into a controller map?
On the topic of the verbosity of injectors, but still relevant to the different versions of this example app: I notice the Cairngorm example does not use injectors but the same function is achieved via direct view/model data binding. Is the use of PropertyInjectors intended for, or limited to, clearly defining/decoupling data binding mappings or can PropertyInjectors or other Injector inner tags be used to inject data into a view without using binding? More generally speaking I suppose I'm wondering is injectors mostly used for code clarity/readability?
This is not a good example for that because there is no actual service call made.
If you want to handle service faults, you would use <faultHandlers>, see the documentation for handling service responses.
Regarding the benefits of Injectors, I would recommend you to watch the 360Flex presentation where I go through the benefits and drawbacks of each approach, if you have an hour to spare. The short answer is that they help us a lot with decoupling.
Injectors can be used to set data once, with no binding established between the source and the target, but it depends on the use case.
About Injectors: I shall watch that preso thanks, and you explained a bit for me already.
Having no service call in this Mate example, is actually why I was wondering how to handle a locally thrown fault after a MethodInvoker. Confusing words by me I suppose. Maybe I am thinking of Mate in the wrong way, but pls let me give two perspectives:
1) Why should a called method always succeed? Honestly I don't know how complex the called methods are assumed to be in the Mate fashion, so ask this as a real question. Today I learned about the lastReturn value. Assuming called methods might often fail, using any return value for errors instead of exceptions can get very messy if an error type and error info needs to be passed back to the caller. The usual selling point for using exceptions instead.
2) Conceptually I see no difference between a remote method call throwing an exception or a local method call doing the same thing. Despite me never seeing an example of this yet, upon a UI event in a client/server app, I see no reason why an event map should always consult a remote data model before a local model. eg. The local model could store a current working copy of a server's master model data, and the local model manager decides to make remote calls to the server when required. In such an app (which I want to build) I visualize the event maps for calls to local managers would look very different to those for remote service calls.
I welcome your questions, but I am the only one that monitors the doc comments here. I suggest that we take this conversation to the forums.
Also see http://mate.asfusion.com/api_docs/com/asfusion/mate/actions/builders/AsyncMethodInvoker.html, it may be what you want.
[Bindable(Event="navigationChange")]
public function get navigationPath():String
{
return _navigationPath;
}
public function updatePath( path:String ):void
{
_navigationPath = path;
dispatchEvent( new Event( "navigationChange" ) );
}
Probably, the dispatchEvent() will trigger the binding again. Is this correct?