Skip to content
Browse files

Updated to keep in sync with ongoing Robotlegs 2 development

  • Loading branch information...
1 parent ba702c6 commit 5568572e36012d2c0dbf96935f4c733f10fd0f34 @pixels4nickels committed Jan 25, 2012
View
12 .project
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>SignalCommandMap</name>
+ <comment></comment>
+ <projects>
+ <project>robotlegs-framework</project>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
View
24 src/robotlegs/bender/extensions/signalCommandMap/SignalCommandMapExtension.as
@@ -7,21 +7,33 @@
package robotlegs.bender.extensions.signalCommandMap
{
- import robotlegs.bender.core.api.IContext;
- import robotlegs.bender.core.api.IContextExtension;
import robotlegs.bender.extensions.signalCommandMap.api.ISignalCommandMap;
import robotlegs.bender.extensions.signalCommandMap.impl.SignalCommandMap;
+ import robotlegs.bender.framework.context.api.IContext;
+ import robotlegs.bender.framework.context.api.IContextConfig;
- public class SignalCommandMapExtension implements IContextExtension
+ public class SignalCommandMapExtension implements IContextConfig
{
private var context:IContext;
- public function install(context:IContext):void
+ public function configureContext(context:IContext):void
{
this.context = context;
context.injector.map(ISignalCommandMap).toSingleton(SignalCommandMap);
}
-
+
+ private function handleContextPreInitialize(step:String, callback:Function):void
+ {
+ //trace("Doing some things before the context self initializes...");
+ //setTimeout(callback, 1000);
+ }
+
+ private function handleContextPostInitialize():void
+ {
+ trace("Doing some things now that the context is initialized...");
+ context.injector.getInstance(ISignalCommandMap);
+ }
+/*
public function initialize():void
{
context.injector.getInstance(ISignalCommandMap);
@@ -30,6 +42,6 @@ package robotlegs.bender.extensions.signalCommandMap
public function uninstall():void
{
context.injector.unmap(ISignalCommandMap);
- }
+ }*/
}
}
View
6 src/robotlegs/bender/extensions/signalCommandMap/api/ISignalCommandMap.as
@@ -7,9 +7,9 @@
package robotlegs.bender.extensions.signalCommandMap.api
{
- import robotlegs.bender.extensions.commandMap.api.ICommandMapper;
- import robotlegs.bender.extensions.commandMap.api.ICommandMappingFinder;
- import robotlegs.bender.extensions.commandMap.api.ICommandUnmapper;
+ import robotlegs.bender.extensions.commandMap.dsl.ICommandMapper;
+ import robotlegs.bender.extensions.commandMap.dsl.ICommandMappingFinder;
+ import robotlegs.bender.extensions.commandMap.dsl.ICommandUnmapper;
public interface ISignalCommandMap
{
View
6 src/robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandMap.as
@@ -13,10 +13,10 @@ package robotlegs.bender.extensions.signalCommandMap.impl
import org.swiftsuspenders.Injector;
import robotlegs.bender.extensions.commandMap.api.ICommandMap;
- import robotlegs.bender.extensions.commandMap.api.ICommandMapper;
- import robotlegs.bender.extensions.commandMap.api.ICommandMappingFinder;
+ import robotlegs.bender.extensions.commandMap.dsl.ICommandMapper;
+ import robotlegs.bender.extensions.commandMap.dsl.ICommandMappingFinder;
+ import robotlegs.bender.extensions.commandMap.dsl.ICommandUnmapper;
import robotlegs.bender.extensions.commandMap.api.ICommandTrigger;
- import robotlegs.bender.extensions.commandMap.api.ICommandUnmapper;
import robotlegs.bender.extensions.signalCommandMap.api.ISignalCommandMap;
public class SignalCommandMap implements ISignalCommandMap
View
13 src/robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandTrigger.as
@@ -11,12 +11,14 @@ package robotlegs.bender.extensions.signalCommandMap.impl
import org.osflash.signals.ISignal;
import org.osflash.signals.Signal;
- import org.robotlegs.core.IInjector;
import org.swiftsuspenders.Injector;
-
+
import robotlegs.bender.extensions.commandMap.api.ICommandMapping;
import robotlegs.bender.extensions.commandMap.api.ICommandTrigger;
+ import robotlegs.bender.framework.guard.impl.guardsApprove;
+ import robotlegs.bender.framework.hook.impl.applyHooks;
+
public class SignalCommandTrigger implements ICommandTrigger
{
@@ -104,16 +106,17 @@ package robotlegs.bender.extensions.signalCommandMap.impl
private function routeSignalToCommand(signal:ISignal, valueObjects:Array, commandClass:Class, oneshot:Boolean):void
{
- var command:Object = createCommandInstance(signal.valueClasses, valueObjects, commandClass);
+
// run past the guards and hooks, and execute
const mappings:Vector.<ICommandMapping> = mappings.concat();
for each (var mapping:ICommandMapping in mappings)
{
- if (mapping.guards.approve())
+ if (guardsApprove(mapping.guards, _injector))
{
once && removeMapping(mapping);
_injector.map(mapping.commandClass).asSingleton();
- mapping.hooks.hook();
+ const command:Object = createCommandInstance(signal.valueClasses, valueObjects, commandClass);
+ applyHooks(mapping.hooks, _injector);
_injector.unmap(mapping.commandClass);
command.execute();
}

0 comments on commit 5568572

Please sign in to comment.
Something went wrong with that request. Please try again.