[Arp] ModelLocator implementation (arpx)

Matt Brailsford matt at gradiation.co.uk
Sat Jan 7 02:51:32 PST 2006


PS My apologies to MM/Adobe if you read this, it was purely for inquisitive
purposes. But if there is one thing to be learnt from this, it is to
obfuscate your code.

-----Original Message-----
From: Arp-bounces at ariaware.com [mailto:Arp-bounces at ariaware.com] On Behalf
Of Matt Brailsford
Sent: 07 January 2006 10:46
To: 'General List for Ariaware RIA Platform users and developers'
Subject: Re: [Arp] ModelLocator implementation (arpx)

That'll teach me to reply to the wrong email, anyone got a noose?

And no I won't be sending anything out, so don't ask.

I think it's time for a trip to mexico.


-----Original Message-----
From: Arp-bounces at ariaware.com [mailto:Arp-bounces at ariaware.com] On Behalf
Of Matt Brailsford
Sent: 06 January 2006 20:07
To: 'General List for Ariaware RIA Platform users and developers'
Subject: Re: [Arp] SPAM-LOW: Re: ModelLocator implementation (arpx)

Hey,

Well it looks like MM didn't obfuscate the flashgateway.dll so I've managed
to decompile it and remove the bit that checks the license. Free .NET
remoting :)

Would you like me to send you a copy? (full source)


-----Original Message-----
From: Arp-bounces at ariaware.com [mailto:Arp-bounces at ariaware.com] On Behalf
Of Davies, Grant M.
Sent: 06 January 2006 14:52
To: 'General List for Ariaware RIA Platform users and developers'
Subject: SPAM-LOW: Re: [Arp] ModelLocator implementation (arpx)

Christophe, any chance of a 1 form example similar to what I did for the
arpx command controller/system event stuff ?  Maybe we could refactor my
example to use your model locator ?

Grant

-----Original Message-----
From: Arp-bounces at ariaware.com [mailto:Arp-bounces at ariaware.com] On Behalf
Of Christophe Herreman
Sent: Friday, January 06, 2006 7:54 AM
To: General List for Ariaware RIA Platform users and developers
Subject: [Arp] ModelLocator implementation (arpx)

Hi guys,

here's what I have so far. I have been testing it in an existing project 
and it works great so far. There are probably some things that might 
need to be added or changed, so please give feedback where possible.

The classes you need are in the org.osflash.arpx.model.* package. Note 
that arpx is not an official osflash project (yet? - I must talk to Aral 
when he's over the car crash -  hope you are ok !) but that was the most 
appropiate package name as we have been discussing earlier. I have 
several extensions, additions, fixes in this package but only released 
the model subpackage in the attached zipfile.

To use it, I suggest you subclass ModelLocator and add public [const] 
static's with the names of the models. Say you have a project called 
"doza", make a DozaModelLocator and add  public static var 
MODEL_USERS:String = "modelUsers"; in there.

Then, in the views that dispatch system events, create a binding between 
a component (most likely) and a model in the modelLocator.

There are 3 ways to do that:
- 1) 
DozaModelLocator.getInstance().addBinding(DozaModelLocator.MODEL_FIRSTNAMES,

firstNames_cb, "dataProvider"); //binds the dataProvider property of the 
firstNames_cb combobox to the model

- 2) 
DozaModelLocator.getInstance().addBindingWithFormatFunction(DozaModelLocator
.MODEL_FIRSTNAMES, 
firstNames_cb, formatFirstNames); //does the same but uses 
DataGlue.bindFormatFunction() behind the scenes

- 3) 
DozaModelLocator.getInstance().addBindingWithFormatStrings(DozaModelLocator.
MODEL_FIRSTNAMES, 
firstNames_cb, "#firstName#", "#firstName#"); //does the same but uses 
DataGlue.bindFormatStrings() behind the scenes

Then you need to set the model in the ModelLocator which will normally 
happen in a command. So in the onResult() handler of your command, write:

DozaModelLocator.getInstance().setModel(DozaModelLocator.MODEL_FIRSTNAMES, 
evt.result);

That's it. I haven't written anything for error handling yet.

Note that some of the implementation uses AS2LIB classes. Since I use it 
in every project, I decided to use it in the extensions I write too. If 
you haven't looked at AS2LIB then do so. You won't regret it.

regards,
Christophe

PS: I don't get paid by the AS2LIB guys !
       

_______________________________________________
Arp mailing list
Arp at ariaware.com
http://ariaware.com/mailman/listinfo/arp_ariaware.com


_______________________________________________
Arp mailing list
Arp at ariaware.com
http://ariaware.com/mailman/listinfo/arp_ariaware.com


_______________________________________________
Arp mailing list
Arp at ariaware.com
http://ariaware.com/mailman/listinfo/arp_ariaware.com




More information about the Arp mailing list