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 so far

  1. "Cairngorm style with injectors" has two problems:

    View source - broken

    Download source - return source for cairngorm basic example
  2. MainUI.xml has an extra container, which might confuse Flex noobs. The app works fine without the following HBox (delete lines 26 & 32):
       <mx:HBox styleName="mainBody" width="700" height="100%">
  3. 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?

  4. Michael,
    Regarding lastReturn, see:
    Using lastReturn and Using Smart Objects
  5. Laura,

    Sorry for not having been clear. I was trying to say that the 'download source' link misdirects to the Cairgorm Basic example, not the Cairngorm Style with Injectors example.
  6. Hi Laura, I really like what I've learned so far, but am very new to Flex and as3 and Mate. Two questions please ...

    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?
  7. Emmett,
    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.
  8. Hi Laura,

    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.
  9. Emmett,
    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, it may be what you want.
  10. Thanks Laura, AsyncMethodInvoker looks very interesting!
  11. Hi,

    I am new to ColdFusion and was wondering whether someone could point me in the right direction. I have been reviewing the full solution for the Cafe Townsend system and cannot work out where in the code the system uses a switch to either show the floating div CMS menu or hide it. I've found the JS script that reveals the menu and can see that it is controlled by the administrator ip variable set in the application.ini file but cannot find the if statement that checks the current ip to evaluate whether the user has access to the admin menu. Any pointers gratefully received.


    JT UK
  12. I'm wondering about when one might choose to use a view listener (e.g. in this example mate:Listener is in mainUI.mxml ) rather than on one of the maps. Seems like a cool thing. I'm just not clear when I might choose one over another.
  13. John,
    Both listener tags serve the same purpose, but ListenerInjector in the map is the preferred way. This example was created when that tag was not available.

Leave a Reply

Leave this field empty