Cafe Townsend

A port of the Cafe Townsend Cairngorm example created by Darren Houle. We modified the Cairngorm example to use Mate Framework. 

Run Example

View Source

Download Source

21 responses

  1. I'm a bit confused (and also fairly new to Flex).. Apologies if this isn't a Mate related question..

    In MainEventMap -> LoginEvent.LOGIN where does lastResult originate?

    Michael
  2. Michael,
    Regarding lastReturn, see:
    Using lastReturn and Using Smart Objects
  3. Hi Laura, I really like what I've learned so far, but am very new to Flex and as3 and Mate. Two questions please ...<br /><br />In the Mate version of this example, if we look at the event map for an employee delete, you wrote &quot;assume everything was ok ...&quot; 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?<br /><br />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?
  4. Emmett,<br />This is not a good example for that because there is no actual service call made.<br />If you want to handle service faults, you would use &lt;faultHandlers&gt;, see the documentation for handling service responses.<br /><br />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. <br /><br />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.
  5. Hi Laura, <br /><br />About Injectors: I shall watch that preso thanks, and you explained a bit for me already.<br /><br />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:<br />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.<br />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.
  6. Emmett,<br />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.<br />Also see <a rel="nofollow" href="AsyncMethodInvoker.html">http://mate.asfusion.com/api_docs/com/asfusion/mate/actions/builders/AsyncMethodInvoker.html</a>">http://mate.asfusion.com/api_docs/com/asfusion/mate/actions/builders/AsyncMethodInvoker.html">http://mate.asfusion.com/api_docs/com/asfusion/mate/actions/builders/AsyncMethodInvoker.html</a>;, it may be what you want.
  7. Thanks Laura, <a href="AsyncMethodInvoker</a>">http://mate.asfusion.com/page/documentation/tags/asyncmethodinvoker">AsyncMethodInvoker</a>; looks very interesting!
  8. In the code below, there is a bindable on the navigationPath() property, and an event is dispatched when 'updatePath' is called. Doesn't this mean the event is dispatched twice?<br /><br />[Bindable(Event=&quot;navigationChange&quot;)]<br /> public function get navigationPath():String<br /> {<br /> return _navigationPath;<br /> }<br /> <br /> public function updatePath( path:String ):void<br /> {<br /> _navigationPath = path;<br /> dispatchEvent( new Event( &quot;navigationChange&quot; ) );<br /> }
  9. I might have seen this wrong.<br /><br />Probably, the dispatchEvent() will trigger the binding again. Is this correct?
  10. Hi,<br /><br />I really like this implimentation, using the presentation model and such. Why is it that after ever function you added another event dispatched? For example;<br /><br />dispatchEvent( new Event(&quot;employeesChange&quot;) );<br /><br />What does this do? What purpose does it serve?<br /><br />Thanks...
  11. Frank,<br />dispatchEvent( new Event( &quot;xxxx&quot; ) ); exists to support the Bindable tag. See: <a rel="nofollow" href="http://www.adobe.com/livedocs/flex/3/html/databinding_8.html">http://www.adobe.com/livedocs/flex/3/html/databinding_8.html</a>;
  12. Thanks Laura,<br /><br />As you can tell I'm new to Flex. From what I gathered from your post variable binding will be delayed until the event is dispatched. <br /><br />Thanks <br /><br />Frank
  13. Hi,<br /><br />I wonder if it's possible to inject a view into a presentation model instead a presentation model to a view. Something similar to what is donde in this Swiz example ( <a rel="nofollow" href="http://www.webappsolution.com/wordpress/2010/01/06/swiz-passive-view-example-part-1/">http://www.webappsolution.com/wordpress/2010/01/06/swiz-passive-view-example-part-1/</a>; ) where the view is injected into the presenter.<br /><br />thanks<br />Polaco
  14. Hi Polaco,<br />See this post:<br /><a rel="nofollow" href="http://www.flexstuff.co.uk/2009/10/13/mate-examples-11-mediator-or-passive-view/">http://www.flexstuff.co.uk/2009/10/13/mate-examples-11-mediator-or-passive-view/</a>; <br />The key point is that you can pass the view to anything by using event.injectorTarget (ie: as a constructor argument, method argument, property, etc).
  15. Hi Laura,<br /><br />I'm trying to use this as a sample for a project that I'm working on. First I set this up to read an xml file local to my system and all works well. However, when I try to read from the database using Coldfusion, I have issues. <br /><br />After logging in, the datagrid does populate but when I click on an item in the datagrid, it comes up empty. My debugger shows that the RemoteObject is working okay, but it looks like the injector is failing to populate the detail view. When I click on the row, the debugger shows that it's passing in a null. When I change back to using the xml file however all works okay. Do you have an idea where I can start to fix this? Your help would be appreciated.<br /><br />Thanks<br /><br />Frank Gonzalez
  16. Hi Frank,<br />If it works for you with the xml file, then the injector is not the problem. I'd check that you are correctly setting the data in the manager.<br /><br />Please make further questions in the forums.<br />Thanks
  17. Thanks Laura,<br /><br />I've tried to post on the forums but was unable to both access and register a new account. I was able to solve my dilemma though. However I do have a question concerning this type of application. As coded, the application updates the array of objects loaded in memory. How does one, in particular using the Mate framework, update the database ? Do you have an example that I may use that updates to the database when the user clicks on the submit button? Thanks so much..this is great stuff!!<br /><br />Frank
  18. I'm still hoping to get a response from my last question.<br /><br />One would be very much appreciated.<br /><br />Frank
  19. Frank,<br />What happens on the server is beyond Flex and Mate, I would recommend you to look at any tutorial on how to handle forms and server-side integration with Flex.
  20. Brand new to Flex, Action Script and Mate. I'm looking over the example, namely Cafe Townsend.<br /><br />I'm having a hard time understanding what is going on when you declare [Bindable(Event=&quot;validationChange&quot;)] in the LoginPresentationModel.as.<br /><br />This is done various places in this class. Then near the bottom of the class you have ;<br /><br />dispatchEvent( new Event( &quot;validationChange&quot; ) );<br /><br /><br />What's this for and what exactly happens? My guess is that when the event is dispatched that all functions directly underneath are executed. Is this correct? If not <br />what happens when the event is dispatched and what is the signficance of all the functions directly <br />below the [Bindable(Event=&quot;clearFields&quot;)]?<br /><br />Thank so much..<br /><br />Frank
  21. I read up on using the bind metatag. I'm getting a picture of how by using the this tag that variables can be bound, but then what happens in the same class (LoginPresentationModel.as) when clearFields is dispatched? I see that the function returns &quot;&quot;. But to what? I'm confused. Please help.

Comments now closed