Skip to content

Commit b603386

Browse files
committed
cleaned out experimental code.
1 parent 18580c7 commit b603386

File tree

6 files changed

+25
-442
lines changed

6 files changed

+25
-442
lines changed

src/org/mvcexpress/core/CommandMap.as

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -87,73 +87,6 @@ public class CommandMap {
8787
}
8888
}
8989

90-
/*
91-
* Map a class to be executed then message with type provied is sent from remote module.
92-
* @param type Message type for command class to react to.
93-
* @param commandClass Command class that will bi instantiated and executed.
94-
* @param remoteModuleName module name that will be sending a message, for this command to trigger.
95-
*/
96-
//
97-
/*
98-
// EXPERIMENTAL
99-
100-
public function mapRemote(type:String, commandClass:Class, remoteModuleName:String):void {
101-
// check if command has execute function, parameter, and store type of parameter object for future checks on execute.
102-
use namespace pureLegsCore;
103-
// debug this action
104-
CONFIG::debug {
105-
if (MvcExpress.debugFunction != null) {
106-
MvcExpress.debugFunction("©©©+ CommandMap.mapRemote > type : " + type + ", commandClass : " + commandClass);
107-
}
108-
validateCommandClass(commandClass);
109-
if (!Boolean(type) || type == "null" || type == "undefined") {
110-
throw Error("Message type:[" + type + "] can not be empty or 'null' or 'undefined'. (You are trying to map command:" + commandClass + ")");
111-
}
112-
}
113-
var messageId:String = type + ModuleManager.MESSAGE_MODULE_SEPARATOR + moduleName;
114-
if (!classRegistry[messageId]) {
115-
classRegistry[messageId] = new Vector.<Class>();
116-
}
117-
ModuleManager.addRemoteHandler(type, handleCommandExecute, moduleName, remoteModuleName, commandClass);
118-
// TODO : check if command is already added. (in DEBUG mode only?.)
119-
classRegistry[messageId].push(commandClass);
120-
}
121-
122-
//*/
123-
124-
/*
125-
* Unmap a class to be executed then message with type provied is sent from remote module.
126-
* @param type Message type for command class to react to.
127-
* @param commandClass Command class that will bi instantiated and executed.
128-
* @param remoteModuleName module name that should be sendng a message, for this command to be triggered.
129-
*/
130-
//
131-
/*
132-
133-
// EXPERIMENTAL
134-
135-
public function unmapRemote(type:String, commandClass:Class, remoteModuleName:String):void {
136-
trace("CommandMap.unmapRemote > type : " + type + ", commandClass : " + commandClass + ", remoteModuleName : " + remoteModuleName);
137-
// debug this action
138-
CONFIG::debug {
139-
if (MvcExpress.debugFunction != null) {
140-
MvcExpress.debugFunction("©©©- CommandMap.unmapRemote > type : " + type + ", commandClass : " + commandClass + ", remoteModuleName : " + remoteModuleName);
141-
}
142-
}
143-
var messageId:String = type + ModuleManager.MESSAGE_MODULE_SEPARATOR + moduleName;
144-
var commandList:Vector.<Class> = classRegistry[messageId];
145-
if (commandList) {
146-
for (var i:int = 0; i < commandList.length; i++) {
147-
if (commandClass == commandList[i]) {
148-
commandList.splice(i, 1);
149-
break;
150-
}
151-
}
152-
}
153-
//ModuleManager.removeRemoteHandler(type, handleCommandExecute, moduleName, remoteModuleName, commandClass);
154-
}
155-
//*/
156-
15790
/**
15891
* Instantiates and executes provided command class, and sends params to it.
15992
* @param commandClass Command class to be instantiated and executed.

src/org/mvcexpress/core/ModuleManager.as

Lines changed: 1 addition & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ public class ModuleManager {
2323
/* TODO : comment */
2424
static private var allModules:Vector.<ModuleBase> = new Vector.<ModuleBase>();
2525

26-
/* TODO : comment */
27-
// EXPERIMENTAL
28-
//static private var remoteHandlerRegistry:Dictionary = new Dictionary();
29-
30-
/* pending handrels stored by module name */
31-
// EXPERIMENTAL
32-
//static private var pendingRemoteHandlers:Dictionary = new Dictionary(); /* of Vector.<PendingRemoteHandler> by String */
33-
3426
/** CONSTRUCTOR */
3527
public function ModuleManager() {
3628
throw Error("ModuleFactory is static framework class for internal use. Not meant to be instantiated.");
@@ -104,16 +96,6 @@ public class ModuleManager {
10496
} else {
10597
throw Error("Module with moduleName:" + moduleName + " doesn't exist.");
10698
}
107-
// EXPERIMENTAL
108-
//if (remoteHandlerRegistry[moduleName]) {
109-
//for each (var remotes:Dictionary in remoteHandlerRegistry[moduleName]) {
110-
//for each (var handlers:Vector.<HandlerVO>in remotes) {
111-
//for (var i:int = 0; i < handlers.length; i++) {
112-
//handlers[i].handler = null;
113-
//}
114-
//}
115-
//}
116-
//}
11799
}
118100

119101
/**
@@ -129,76 +111,6 @@ public class ModuleManager {
129111
}
130112
}
131113

132-
/*
133-
* TODO : COMMENT
134-
* @param type
135-
* @param handler
136-
* @param remoteModuleName
137-
*/
138-
//
139-
/*
140-
// EXPERIMENTAL
141-
static pureLegsCore function addRemoteHandler(type:String, handler:Function, handlerModuleName:String, remoteModuleName:String, commandClass:Class = null):HandlerVO {
142-
143-
trace("ModuleManager.addRemoteHandler > type : " + type + ", handler : " + handler + ", remoteModuleName : " + remoteModuleName + ", commandClass : " + commandClass);
144-
use namespace pureLegsCore;
145-
if (!remoteHandlerRegistry[handlerModuleName]) {
146-
remoteHandlerRegistry[handlerModuleName] = new Dictionary();
147-
}
148-
if (!remoteHandlerRegistry[handlerModuleName][remoteModuleName]) {
149-
remoteHandlerRegistry[handlerModuleName][remoteModuleName] = new Dictionary();
150-
}
151-
if (!remoteHandlerRegistry[handlerModuleName][remoteModuleName][type]) {
152-
remoteHandlerRegistry[handlerModuleName][remoteModuleName][type] = new Vector.<HandlerVO>();
153-
}
154-
155-
//
156-
var handlerVo:HandlerVO;
157-
if (commandClass) {
158-
if (moduleRegistry[remoteModuleName]) {
159-
handlerVo = moduleRegistry[remoteModuleName].messenger.addCommandHandler(type, handler, commandClass);
160-
} else {
161-
if (!pendingRemoteHandlers[remoteModuleName]) {
162-
pendingRemoteHandlers[remoteModuleName] = new Vector.<PendingRemoteHandler>();
163-
}
164-
pendingRemoteHandlers[remoteModuleName].push(new PendingRemoteHandler(type, handler, handlerModuleName, remoteModuleName, commandClass));
165-
}
166-
} else {
167-
if (moduleRegistry[remoteModuleName]) {
168-
use namespace pureLegsCore;
169-
handlerVo = moduleRegistry[remoteModuleName].messenger.addHandler(type, handler);
170-
} else {
171-
if (!pendingRemoteHandlers[remoteModuleName]) {
172-
pendingRemoteHandlers[remoteModuleName] = new Vector.<PendingRemoteHandler>();
173-
}
174-
pendingRemoteHandlers[remoteModuleName].push(new PendingRemoteHandler(type, handler, handlerModuleName, remoteModuleName, commandClass));
175-
}
176-
}
177-
//
178-
if (handlerVo) {
179-
handlerVo.remoteModule = handlerModuleName;
180-
remoteHandlerRegistry[handlerModuleName][remoteModuleName][type].push(handlerVo);
181-
}
182-
return handlerVo;
183-
}
184-
//*/
185-
186-
// EXPERIMENTAL
187-
/*
188-
static pureLegsCore function removeRemoteHandler(type:String, handler:Function, handlerModuleName:String, remoteModuleName:String, commandClass:Class = null):void {
189-
if (commandClass) {
190-
if (moduleRegistry[remoteModuleName]) {
191-
//moduleRegistry[remoteModuleName].messenger.(type, handler, commandClass);
192-
}
193-
} else {
194-
if (moduleRegistry[remoteModuleName]) {
195-
use namespace pureLegsCore;
196-
moduleRegistry[remoteModuleName].messenger.removeHandler(type, handler);
197-
}
198-
}
199-
}
200-
//*/
201-
202114
//----------------------------------
203115
// DEBUG
204116
//----------------------------------
@@ -281,21 +193,4 @@ public class ModuleManager {
281193
}
282194

283195
}
284-
} /*
285-
class PendingRemoteHandler {
286-
287-
public var type:String;
288-
public var handler:Function;
289-
public var handlerModuleName:String;
290-
public var remoteModuleName:String;
291-
public var commandClass:Object;
292-
293-
public function PendingRemoteHandler(type:String, handler:Function, handlerModuleName:String, remoteModuleName:String, commandClass:Class) {
294-
this.type = type;
295-
this.handler = handler;
296-
this.handlerModuleName = handlerModuleName;
297-
this.remoteModuleName = remoteModuleName;
298-
this.commandClass = commandClass;
299-
}
300-
}
301-
//*/
196+
}

0 commit comments

Comments
 (0)