[Arp] arpx - > CommandControl

Grant Davies grant at bluetube.com
Thu Dec 21 07:40:09 PST 2006


I'm still around :)  Time is my problem I'm doing flex development right
now in cairngorm (spelling?) and a skinnable player in flash with arp
and arpx...  I have my own model class too inside my arpx package as we
needed something very simple.
 
I'll release what I have in january and it should have class diagrams
etc as I'm doing that for one of my clients.
 
Grant.
 
 
...........................................
> b l u e t u b e i n t e r a c t i v e.
.: grant davies
.: 404.428.6839 (c)
.: 708-983-1577 (F)
> grant at bluetube.com
> http://www.bluetube.com/bti <http://www.bluetube.com/bti> 
> A Tribal Chicken Designs Affiliate <http://www.tribalchicken.com/> 

 

________________________________

From: arp-bounces at ariaware.com [mailto:arp-bounces at ariaware.com] On
Behalf Of henrik weber (freemind-design)
Sent: Thursday, December 21, 2006 9:02 AM
To: General List for Ariaware RIA Platform users and developers
Subject: Re: [Arp] arpx - > CommandControl


agreed!  ;-) 

and maybe grant (are you still around?) can integrate this (really
clever approach) into
his arpx-package... if this is ok for you (sander).

@grant/christophe: do you still plan to merge your packages? or will the
next version
of arp assimilate both?

thx a lot for sharing your knowledge & greetings from germoney! :-D 

henrik

Michiel van der Ros wrote: 

	Totally agree. Studying the source of a working example is
probably the best way to understand concepts and patterns like this. I
couldn't have learned ARP without Aral's Pizza Service ;-)
	
	@Sander: Nice to see others in Amsterdam working with ARP!
	
	
	
	COLIN LIGHT wrote: 

		 Hi Guys,
		 
		It Would be nice to consolidate some of these ideas into
one working example like Aral's Pizza RIA. It would really help and
hopefully speed up understanding for people like myself.
		 
		Col. 



		Sander Wichers <sander at qi-ideas.com>
<mailto:sander at qi-ideas.com>  wrote:

			Nyls is talking about me :), so here is my
(grants) stripped
			commandcontroller:
			
			Adding mappings:
			
	
CommandController.getInstance().addEventMapping(EventNames.FOO_REQUEST,
			"com.foo.command.GetFooCommand",
com.foo.command.GetFooCommand);
			
			I prefer to use the commandcontroller instead of
the systemcontroller,
			so dispatching would be something like this:
	
CommandController.getInstance().dispatchEvent({type:
			EventNames.FOO_REQUEST, target: this});
			
			
			-- Sander
			
			
			
			import mx.utils.Delegate;
			import mx.events.EventDispatcher;
			
			import com.ariaware.arp.CommandTemplate;
			
			class com.foo.CommandController
			{
			private static var instance : CommandController
= null;
			
			private var eventCommandMap : Object;
			
			public var addEventListener : Function;
			public var removeEventListener : Function;
			public var dispatchEvent : Function;
			
			private function CommandController() 
			{
			EventDispatcher.initialize(this);
			
			this.eventCommandMap = new Object();
			}
			
			public static function getInstance() :
CommandController 
			{
			if (!instance)
			{
			instance = new CommandController();
			}
			return instance;
			}
			
			public function addEventMapping(event : String,
cmd : String,
			classRef : Function) : Void
			{
			// dynamically create a command:
			var command : Function = eval("_global." + cmd);
			
			if (command == null)
			{
			trace("CommandController:addEventMapping() Could
			not create instance for command [" + cmd + "]
make sure the command is
			FORCED into your swf file.");
			}
			
			if (!this.eventCommandMap [ event ])
			{
			this.eventCommandMap [ event ] = command;
			this.addEventListener(event, this);
			}
			}
			
			private function handleEvent(event:Object) :
Void
			{
			var cmd : CommandTemplate;
			
			if ((cmd = this.eventCommandMap[event.type]) !=
null)
			{
			var theCommand : Object = new cmd();
			
			// Execute the command 
			theCommand.execute( event.target );
			}
			else
			{
			trace("CommandController:handleEvent() Could not
			find command for event " + event.type); 
			}
			}
			
			} 
			
			
			
			
			________________________________
			
			From: arp-bounces at ariaware.com [
mailto:arp-bounces at ariaware.com] On
			Behalf Of henrik weber (freemind-design)
			Sent: donderdag 21 december 2006 11:25
			To: General List for Ariaware RIA Platform users
and developers
			Subject: [Arp] arpx - > CommandControl
			
			
			hi nyls,
			
			this sounds really interesting; totally failed
to notice the
			CommandControl-class.
			your college absolutely has a point... could
someone sketch how we could
			use it this way?
			
			@colin: grant explained his thoughts about arpx
pretty detailed here ->
			
http://theresidentalien.typepad.com/ginormous/2005/10/extending_arp.html
			
			hth
			
			henrik
			
			--
			_______freemind design_______
			MediaDesign & FlashDevelopment
			home: www.freemind-design.de
			
			
			nyls wrote: 
			
			Yeps, 
			
			I use the CommandControl class, it just binds
commands
			to events .. I think it is more elegant then the
original ARP controller
			.. speaking with my new upcoming college :> he
made his point that it is
			maybe a little overkill to use an external XML
file for mapping commands
			to events, why not do the 'binding' in the
command controller class
			itself. You need to 'import' the commands anyway
(forceImport for
			compiling) 
			
			nyls
			
			
			________________________________
			
			Van: arp-bounces at ariaware.com
			[mailto:arp-bounces at ariaware.com] Namens COLIN
LIGHT
			Verzonden: Wednesday, December 20, 2006 5:32 PM
			Aan: General List for Ariaware RIA Platform
users and developers
			Onderwerp: Re: [Arp] Another ModelLocator
Question
			
			Hi Nyls,
			
			I've just been looking at Grants arpx classes.
Can you
			tell me do you use his CommandControl class?
from what I can make out
			brings in commands from the 'command-config.xml'
			
			Col.
			
			
			COLIN LIGHT 
			wrote:
			
			Hi Nyls,
			
			Thanks again for getting back to me.
			
			Yeah this does make sense. I've been
			getting a little muddled up cos I downloaded
Grants arpx (which doesn't
			seem to contain a ModelLocator) and christophes
version which seems
			slightly different with a modelLocator with
binding etc.
			
			Col.
			
			
			
			nyls wrote:
			
			Hey,
			
			The modellocator (ML) is
			a singleton so there is only one instance of it
in your app. This is
			your single entry point to your data/ models
from everywhere in your
			app. 
			
			I tend to use the ARPX
			-systemcontroller from Grant , So I let views
listen to the
			systemcontroller for 'update' events.
			
			So when a command get's
			it's result it fills a model through the ML and
dispatches an
			systemEvent
			
			
	
ModelLocator.getInstance().setModel(ModelNames.NAVIGATION_MODEL,OCLiteVO
			(response.ocliteVO));
			
			
	
SystemController.getInstance().dispatchEvent({type:EventNames.NAVIGATION
			_MODEL_CHANGE})
			
			And in the appropriate
			views I listen for thos system events and grab
the model from the
			modellocator
			
			
	
SystemController.getInstance().addEventListener(EventNames.NAVIGATION_MO
			DEL_CHANGE, Proxy.create(this,
navigationModelChanged));
			
			var navModel =
	
ModelLocator.getInstance().getModel(ModelNames.NAVIGATION_MODEL).getValu
			e();
			
			That's how I do it,
			
			Is this of help ??
			
			nyls
			
			
			________________________________
			
			Van:
			arp-bounces at ariaware.com [
mailto:arp-bounces at ariaware.com] Namens COLIN
			LIGHT
			Verzonden: Wednesday, December 20, 2006 2:37 PM
			Aan: arp at ariaware.com
			Onderwerp: [Arp] Another ModelLocator Question
			
			Hi List, 
			
			I'm (as ever) hoping
			someone can help me out with an ARP issue. I've
been using arp for a few
			months now and just when I think I'm get it
something else comes along
			and I question my own understanding :(
			
			I've been looking at the
			ModelLocator pattern, I have read previous
post's about this and found
			some sample files although it does seem a little
confusing. I downloaded
			the arpx classes 
http://www.herrodius.com/upload/arp_extensions.zip
			which contain quite a comprehensive version with
databinding etc, I've
			also seen and much simpler single class version
which I have been trying
			to use.
			
			I have a number of
			ArpForms which compose my views. Within these
forms are other Arpforms
			which effectively are like components.
			
			What I'm struggling with
			is how to populate mx components in my component
forms, is it good
			practice to import my modelLocator class and
then have an update method
			which gets called from the main application
class when the model gets
			populate or create a listener on each form for
update events from the
			modelLocator? 
			
			Col.
			
			_______________________________________________
			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
			
			
			
			_______________________________________________
			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
		  


	-- 
	
	[ weblog ][ http://michiel.vanderros.nl ]
	  
	
________________________________


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/arp_ariaware.com/attachments/20061221/6b4ee621/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 1518 bytes
Desc: small.jpg
Url : /pipermail/arp_ariaware.com/attachments/20061221/6b4ee621/attachment-0001.jpe 


More information about the Arp mailing list