Skip to content

Commit 81f40ee

Browse files
committed
Revert "Module to module channeling with tests."
This reverts commit f83083c.
1 parent 9953768 commit 81f40ee

File tree

23 files changed

+23
-689
lines changed

23 files changed

+23
-689
lines changed

mvcExpressLogger/com/mindscriptact/mvcExpressLogger/visualizer/VisualizerManager.as

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,17 @@ public class VisualizerManager {
176176
}
177177
break;
178178
case MvcTraceActions.MODULEBASE_SENDMESSAGE:
179-
case MvcTraceActions.MODULEBASE_SENDCHANNELMESSAGE:
180179
case MvcTraceActions.MEDIATOR_SENDMESSAGE:
181-
case MvcTraceActions.MEDIATOR_SENDCHANNELMESSAGE:
182180
case MvcTraceActions.PROXY_SENDMESSAGE:
183181
case MvcTraceActions.COMMAND_SENDMESSAGE:
184182
case MvcTraceActions.MESSENGER_SENDTOALL:
185183
sendMessageStack.push(logObj);
186184
break;
187185
case MvcTraceActions.MODULEBASE_SENDMESSAGE_CLEAN:
188-
case MvcTraceActions.MODULEBASE_SENDCHANNELMESSAGE_CLEAN:
189186
case MvcTraceActions.MEDIATOR_SENDMESSAGE_CLEAN:
190-
case MvcTraceActions.MEDIATOR_SENDCHANNELMESSAGE_CLEAN:
191187
case MvcTraceActions.PROXY_SENDMESSAGE_CLEAN:
192188
case MvcTraceActions.COMMAND_SENDMESSAGE_CLEAN:
193-
case MvcTraceActions.MESSENGER_SENDTOALL_CLEAN:
189+
case MvcTraceActions.MESSENGER_SENDTOALL_CLEAN:
194190
topObject = sendMessageStack.pop();
195191
if (logObj.type != topObject.type) {
196192
CONFIG::debug {

sampleProjects/com/mindScriptAct/modularSample/constants/ScopeNames.as

Lines changed: 0 additions & 13 deletions
This file was deleted.

sampleProjects/com/mindScriptAct/modularSample/view/ModularSampleMediator.as

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.mindScriptAct.modularSample.view {
22
import com.bit101.components.PushButton;
3-
import com.mindScriptAct.modularSample.constants.ScopeNames;
43
import com.mindScriptAct.modularSample.ModularSample;
54
import com.mindScriptAct.modules.console.Console;
65
import com.mindScriptAct.modules.console.msg.ConsoleMsg;
@@ -107,15 +106,15 @@ public class ModularSampleMediator extends Mediator {
107106
}
108107

109108
public function handleMessageToFirst(event:MouseEvent):void {
110-
sendChannelMessage(GlobalMessage.SEND_TARGETED_INPUT_MESSAGE, new ConsoleParams("Message to FIRST module!!!", [1]), ScopeNames.FIRST_SCOPE);
109+
sendMessageToAll(GlobalMessage.SEND_TARGETED_INPUT_MESSAGE, new ConsoleParams("Message to FIRST module!!!", [1]));
111110
}
112111

113112
public function handleMessageToEven(event:MouseEvent):void {
114-
sendChannelMessage(GlobalMessage.SEND_TARGETED_INPUT_MESSAGE, new ConsoleParams("Message to even modules!!! (2 and 4)", [2, 4]), ScopeNames.EVEN_SCOPE);
113+
sendMessageToAll(GlobalMessage.SEND_TARGETED_INPUT_MESSAGE, new ConsoleParams("Message to even modules!!! (2 and 4)", [2, 4]));
115114
}
116115

117116
public function handleMessageToAll(event:MouseEvent):void {
118-
sendChannelMessage(GlobalMessage.SEND_INPUT_MESSAGE_TO_ALL, "Global message to all modules!!!");
117+
sendMessageToAll(GlobalMessage.SEND_INPUT_MESSAGE_TO_ALL, "Global message to all modules!!!");
119118
}
120119

121120
//public function handleMessageToAllNoStore(event:MouseEvent):void {

sampleProjects/com/mindScriptAct/modules/console/Console.as

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public class Console extends ModuleSprite {
4747
//commandMap.mapRemote(GlobalMessage.SEND_TARGETED_INPUT_MESSAGE, HandleTargetedMessageCommand, ModuleNames.SHELL);
4848
//commandMap.mapRemote(GlobalMessage.SEND_INPUT_MESSAGE_TO_ALL, HandleInputCommand, ModuleNames.SHELL);
4949
commandMap.map(ConsoleViewMsg.INPUT_MESSAGE, HandleInputCommand);
50-
5150
commandMap.map(GlobalMessage.SEND_INPUT_MESSAGE_TO_ALL, HandleInputCommand);
5251
commandMap.map(GlobalMessage.SEND_TARGETED_INPUT_MESSAGE, HandleTargetedMessageCommand);
5352

sampleProjects/com/mindScriptAct/modules/console/view/ConsoleMediator.as

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
package com.mindScriptAct.modules.console.view {
2-
import com.mindScriptAct.modularSample.constants.ScopeNames;
32
import com.mindScriptAct.modules.console.Console;
43
import com.mindScriptAct.modules.console.msg.ConsoleDataMsg;
54
import com.mindScriptAct.modules.console.msg.ConsoleViewMsg;
@@ -24,13 +23,6 @@ public class ConsoleMediator extends Mediator {
2423
addHandler(ConsoleDataMsg.MESSAGE_ADDED, handleMessageAdded);
2524
//addRemoteHandler(GlobalMessage.SEND_INPUT_MESSAGE_TO_ALL_DONT_STORE, handleMessageAdded, ModuleNames.SHELL);
2625

27-
addChannelHandler(GlobalMessage.SEND_TARGETED_INPUT_MESSAGE, handleTargeterMessage, ScopeNames.FIRST_SCOPE);
28-
29-
}
30-
31-
private function handleTargeterMessage(params:ConsoleParams):void {
32-
trace( "ConsoleMediator.handleTargeterMessage > params : " + params );
33-
3426
}
3527

3628
override public function onRemove():void {

src/org/mvcexpress/MvcExpress.as

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public class MvcExpress {
1515
/** Current framework major version */
1616
public static const MAJOR_VERSION:uint = 1;
1717
/** Current framework minor version */
18-
public static const MINOR_VERSION:uint = 1;
18+
public static const MINOR_VERSION:uint = 0;
1919
/** Current framework revision version */
20-
public static const REVISION:uint = 0;
20+
public static const REVISION:uint = 1;
2121

2222
/** Current framework version */
2323
public static function get VERSION():String {

src/org/mvcexpress/core/CommandMap.as

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -134,30 +134,8 @@ public class CommandMap {
134134
//////////////////////////////////////////////
135135
}
136136

137-
//----------------------------------
138-
// CHANNELING
139-
//----------------------------------
140-
141-
public function channelMap(type:String, commandClass:Class, scopeName:String = "global"):void {
142-
trace("CommandMap.channelMap > type : " + type + ", commandClass : " + commandClass + ", scopeName : " + scopeName);
143-
use namespace pureLegsCore;
144-
//
145-
var scopedType:String = scopeName + "_«¬_" + type;
146-
if (!classRegistry[scopedType]) {
147-
classRegistry[scopedType] = new Vector.<Class>();
148-
// TODO : check if chonnelCommandMap must be here...
149-
ModuleManager.channelCommandMap(handleCommandExecute, type, commandClass, scopeName);
150-
}
151-
// TODO : check if command is already added. (in DEBUG mode only?.)
152-
classRegistry[scopedType].push(commandClass);
153-
}
154-
155-
//----------------------------------
156-
// INTERNAL
157-
//----------------------------------
158-
159137
/** function to be called by messenger on needed message type sent */
160-
pureLegsCore function handleCommandExecute(messageType:String, params:Object):void {
138+
private function handleCommandExecute(messageType:String, params:Object):void {
161139
var commandList:Vector.<Class>;
162140
commandList = classRegistry[messageType];
163141

src/org/mvcexpress/core/ModuleBase.as

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import org.mvcexpress.core.ModuleManager;
99
import org.mvcexpress.core.namespace.pureLegsCore;
1010
import org.mvcexpress.core.ProxyMap;
1111
import org.mvcexpress.core.traceObjects.MvcTraceActions;
12-
import org.mvcexpress.core.traceObjects.TraceModuleBase_sendChannelMessage;
1312
import org.mvcexpress.core.traceObjects.TraceModuleBase_sendMessage;
1413
import org.mvcexpress.core.traceObjects.TraceObj;
1514
import org.mvcexpress.MvcExpress;
@@ -159,28 +158,6 @@ public class ModuleBase {
159158
_messenger.sendToAll(type, params);
160159
}
161160

162-
/**
163-
* TODO : comment
164-
* @param type
165-
* @param params
166-
* @param scopeName
167-
*/
168-
public function sendChannelMessage(type:String, params:Object, scopeName:String):void {
169-
use namespace pureLegsCore;
170-
// log the action
171-
CONFIG::debug {
172-
use namespace pureLegsCore;
173-
MvcExpress.debug(new TraceModuleBase_sendChannelMessage(MvcTraceActions.MODULEBASE_SENDCHANNELMESSAGE, _moduleName, this, type, params));
174-
}
175-
ModuleManager.sendChannelMessage(type, params, scopeName);
176-
//
177-
// clean up loging the action
178-
CONFIG::debug {
179-
use namespace pureLegsCore;
180-
MvcExpress.debug(new TraceModuleBase_sendChannelMessage(MvcTraceActions.MODULEBASE_SENDCHANNELMESSAGE_CLEAN, _moduleName, this, type, params));
181-
}
182-
}
183-
184161
//----------------------------------
185162
// utils
186163
//----------------------------------

src/org/mvcexpress/core/ModuleManager.as

Lines changed: 11 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
22
package org.mvcexpress.core {
33
import flash.utils.Dictionary;
4-
import org.mvcexpress.core.messenger.HandlerVO;
54
import org.mvcexpress.core.messenger.Messenger;
65
import org.mvcexpress.core.namespace.pureLegsCore;
76
import org.mvcexpress.core.traceObjects.MvcTraceActions;
@@ -23,12 +22,9 @@ public class ModuleManager {
2322
/* modules stored by moduleName */
2423
static private var moduleRegistry:Dictionary = new Dictionary(); /* of ModuleBase by String */
2524

26-
/* all modules stared by module name */
25+
/* TODO : comment */
2726
static private var allModules:Vector.<ModuleBase> = new Vector.<ModuleBase>();
2827

29-
/* all channel messengers stored by channel name */
30-
static private var channels:Dictionary = new Dictionary(); /* of Messenger by String*/
31-
3228
/** CONSTRUCTOR */
3329
public function ModuleManager() {
3430
throw Error("ModuleFactory is static framework class for internal use. Not meant to be instantiated.");
@@ -101,57 +97,19 @@ public class ModuleManager {
10197
}
10298
}
10399

104-
//----------------------------------
105-
// channel
106-
//----------------------------------
107-
108-
static pureLegsCore function sendChannelMessage(type:String, params:Object, scopeName:String):void {
109-
trace("ModuleManager.channelMessage > type : " + type + ", params : " + params + ", scopeName " + scopeName);
100+
/**
101+
* sends message to all messengers.
102+
* @param type message type to find needed handlers
103+
* @param params parameter object that will be sent to all handler functions as single parameter.
104+
* @private
105+
*/
106+
static pureLegsCore function sendMessageToAll(type:String, params:Object):void {
110107
use namespace pureLegsCore;
111-
var channelMesanger:Messenger = channels[scopeName];
112-
if (channelMesanger) {
113-
channelMesanger.send(scopeName + "_«¬_" + type, params);
114-
}
115-
}
116-
117-
static pureLegsCore function addChannelHandler(type:String, handler:Function, scopeName:String):HandlerVO {
118-
var channelMesanger:Messenger = channels[scopeName];
119-
if (!channelMesanger) {
120-
use namespace pureLegsCore;
121-
Messenger.allowInstantiation = true;
122-
channelMesanger = new Messenger("$channel_" + scopeName);
123-
Messenger.allowInstantiation = false;
124-
channels[scopeName] = channelMesanger;
125-
}
126-
return channelMesanger.addHandler(scopeName + "_«¬_" + type, handler);
127-
}
128-
129-
static pureLegsCore function removeChannelHandler(type:String, handler:Function, scopeName:String):void {
130-
//use namespace pureLegsCore;
131-
var channelMesanger:Messenger = channels[scopeName];
132-
if (channelMesanger) {
133-
channelMesanger.removeHandler(scopeName + "_«¬_" + type, handler);
134-
}
135-
}
136-
137-
138-
//----------------------------------
139-
// Command channeling
140-
//----------------------------------
141-
142-
static public function channelCommandMap(handleCommandExecute:Function, type:String, commandClass:Class, scopeName:String = "global"):void {
143-
var channelMesanger:Messenger = channels[scopeName];
144-
if (!channelMesanger) {
145-
use namespace pureLegsCore;
146-
Messenger.allowInstantiation = true;
147-
channelMesanger = new Messenger("$channel_" + scopeName);
148-
Messenger.allowInstantiation = false;
149-
channels[scopeName] = channelMesanger;
108+
for (var i:int = 0; i < allModules.length; i++) {
109+
allModules[i].messenger.send(type, params);
150110
}
151-
channelMesanger.addCommandHandler(scopeName + "_«¬_" + type, handleCommandExecute, commandClass);
152111
}
153112

154-
155113
//----------------------------------
156114
// DEBUG
157115
//----------------------------------
@@ -211,22 +169,6 @@ public class ModuleManager {
211169
return "Module with name :" + moduleName + " is not found.";
212170
}
213171
}
214-
215-
//----------------------------------
216-
// DEPRICATED
217-
//----------------------------------
218-
219-
/**
220-
* sends message to all messengers.
221-
* @param type message type to find needed handlers
222-
* @param params parameter object that will be sent to all handler functions as single parameter.
223-
* @private
224-
*/
225-
static pureLegsCore function sendMessageToAll(type:String, params:Object):void {
226-
use namespace pureLegsCore;
227-
for (var i:int = 0; i < allModules.length; i++) {
228-
allModules[i].messenger.send(type, params);
229-
}
230-
}
172+
231173
}
232174
}

src/org/mvcexpress/core/messenger/Messenger.as

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,11 @@ public class Messenger {
160160
}
161161

162162
/**
163-
*
164-
* DEPRICATED : sends message to all existing modules.
163+
* sends message to all existing modules.
165164
* @param type message type to find needed handlers
166165
* @param params parameter object that will be sent to all handler and execute functions as single parameter.
167-
* @deprecated 1.1
168166
*/
169167
public function sendToAll(type:String, params:Object = null):void {
170-
trace("WARNING: sendToAll() is depricated in favour of sendChannelMessage().");
171-
//
172168
use namespace pureLegsCore;
173169
// debug this action
174170
CONFIG::debug {

0 commit comments

Comments
 (0)