ha, I was just kidding around about the freaking out thing.  So, you're
getting close, but I would do it this way:

First, you only need a userManager.  It is the model, so you don't need
a userModel.   The userManager would have a currentUser property.  In
your CFC result handler, call a method in the userManager that sets that
currentUser to the lastResult.  Next, create another currentUser
property in any presentationModel that needs the data.  Now, in your
userMap, simply inject the currentUser from the userManager into the
presentationModels.  When a new user is set, to the currentUser in the
manager, the presentationModels will be automatically refreshed; through
injection.

<Injectors targets="{  [ UserPresentationModel, AnotherPresetationModel
] }">
      <PropertyInjector targetKey="currentUser" source="{  UserManager }"
sourceKey="currentUser" />
</Injectors>

-TH

--- In flexcoders@yahoogroups.com, Seona Bellamy <se...@...> wrote:
>
> *grin* Thanks. I guess I was freaking out a little - I'd finally
thought I
> was getting a handle on the whole Mate thing, and then I hit this
problem
> and realised I was much further away from understanding than I
thought.
>
> So let me see if I understand how this works, based on the examples
I've
> seen:
>
> - I create a UserModel class which extends the InjectorTarget class.
It has
> all of the user-related variables I want to pass around as bindable
public
> variables, plus get and set functions.
>
> - As well as my regular Event Maps, I create a Model Event Map which
has all
> of the different injectors that put data into the various models
>
> - When I perform the login function in the AuthorisationManager, the
CFC
> returns me the details of the user who is logging in. I somehow call
this
> UserModel and put all the data into the model's variables.
>
> - In the UserManager, when I want to run the GetKeywords function, for
> example, I can call on the data stored in the model to get the user's
ID and
> pass it to the service I'm calling.
>
> Is that right? If it is, I think I need some help making the linkages
> between them all. I won't bother posting any code until I find out if
I'm
> barking up the wrong tree, though. :)
>
> Thanks,
>
> Seona.
>
> 2009/4/15 Tim Hoff timh...@...
>
> > Hi Seona,
> >
> > Let's start by taking a deep breath and don't freak out. Ok, wheeew!
> >
> > Mate is a little different than typical MVC; in that it seperates
the
> > model into managers and presentation models (a manager holds data
and a
> > presentation model holds an instance of the needed data and controls
> > constituant views). Let me elaborate a little, in that these two
> > factions of the model are also "smart" models; they don't just sit
by
> > and hold data., they can also manipulate data/state as well. Yes,
both
> > managers and presentation models are singletons; thus they persist.
If
> > you place your user data in a userManager, then you can easily
inject
> > that data into whatever object you want, be it a view or a
presentation
> > model, via a map.
> >
> > I know that there aren't a lot of mate examples out there yet. But,
> > please be patient; more are coming......
> >
> > -TH
> >
>


Reply via email to