Permalink
Browse files

Same renaming.

  • Loading branch information...
MindScriptAct committed Nov 11, 2013
1 parent 90e7f75 commit b9bdf8f6ad97916a2574149b8190995ff765a715
Showing with 70 additions and 126 deletions.
  1. +1 −1 libSrc/mvcexpress/core/CommandMap.as
  2. +1 −1 libSrc/mvcexpress/core/messenger/Messenger.as
  3. +0 −21 libSrc/mvcexpress/modules/ModuleCore.as
  4. +1 −1 mvcExpress-helloMobile/src/mindscriptact/mobileTestApp/controler/test/TestCommand.as
  5. +0 −1 mvcExpress-helloWorld/src/helloWorld/Main.as
  6. +5 −5 mvcExpress-helloWorld/src/helloWorld/MainModule.as
  7. +2 −2 mvcExpress-helloWorld/src/helloWorld/controller/setup/SetupControllerCommand.as
  8. +1 −1 mvcExpress-helloWorld/src/helloWorld/messages/{DataMsg.as → DataMessage.as}
  9. +1 −1 mvcExpress-helloWorld/src/helloWorld/messages/{Msg.as → Message.as}
  10. +1 −1 mvcExpress-helloWorld/src/helloWorld/messages/{ViewMsg.as → ViewMessage.as}
  11. +2 −2 mvcExpress-helloWorld/src/helloWorld/model/TestProxy.as
  12. +4 −4 mvcExpress-helloWorld/src/helloWorld/view/main/MainMediator.as
  13. +5 −5 mvcExpress-modular/src/modularProject/modularSample/ModularSample.as
  14. +5 −5 mvcExpress-modular/src/modularProject/modules/console/Console.as
  15. +12 −4 mvcExpress-ticTacToe/src/ticTacToe/Main.as
  16. +3 −10 mvcExpress-ticTacToe/src/ticTacToe/MainModule.as
  17. +0 −10 mvcExpress-ticTacToe/src/ticTacToe/constants/MainConfig.as
  18. +1 −1 mvcExpress-ticTacToe/src/ticTacToe/constants/TokenId.as
  19. +1 −2 mvcExpress-ticTacToe/src/ticTacToe/controller/game/CellClickCommand.as
  20. +1 −1 mvcExpress-ticTacToe/src/ticTacToe/controller/game/NewGameCommand.as
  21. +3 −3 mvcExpress-ticTacToe/src/ticTacToe/controller/setup/SetupControllerCommand.as
  22. +1 −1 mvcExpress-ticTacToe/src/ticTacToe/messages/{DataMsg.as → DataMessages.as}
  23. +1 −1 mvcExpress-ticTacToe/src/ticTacToe/messages/{Msg.as → Messages.as}
  24. +1 −1 mvcExpress-ticTacToe/src/ticTacToe/messages/{ViewMsg.as → ViewMessages.as}
  25. +7 −7 mvcExpress-ticTacToe/src/ticTacToe/model/GameBoardProxy.as
  26. +2 −2 mvcExpress-ticTacToe/src/ticTacToe/model/GameProxy.as
  27. +0 −24 mvcExpress-ticTacToe/src/ticTacToe/services/BlankService.as
  28. +1 −1 mvcExpress-ticTacToe/src/ticTacToe/view/gameScreen/GameScreen.as
  29. +7 −7 mvcExpress-ticTacToe/src/ticTacToe/view/gameScreen/GameScreenMediator.as
@@ -450,7 +450,7 @@ public class CommandMap {
}
// used for debugging
- pureLegsCore function listMessageCommands(messageType:String):Class {
+ pureLegsCore function getMessageCommand(messageType:String):Class {
return classRegistry[messageType];
}
@@ -215,7 +215,7 @@ public class Messenger {
for (var i:int = 0; i < msgCount; i++) {
var handlerVo:HandlerVO = msgList[i];
if (handlerVo.isExecutable) {
- messageHandlers += "[EXECUTES:" + commandMap.listMessageCommands(key) + "], ";
+ messageHandlers += "[EXECUTES:" + commandMap.getMessageCommand(key) + "], ";
CONFIG::debug {
messageHandlers += "[" + handlerVo.handlerClassName + "], ";
}
@@ -201,31 +201,10 @@ public class ModuleCore {
}
}
- //----------------------------------
- // Execute module command.
- //----------------------------------
-
- /**
- * Public function to execute provided command cass, meant to be used from outside of module class. In all other cases use commandMap.execute() <p>
- * This function can be used to initialize, set up and start the framework without creating custom module class. </p>
- * @param commandClass Command class to be instantiated and executed.
- * @param params Object to be sent to execute() function.
- */
- public function externalExecuteCommand(commandClass:Class, params:Object = null):void {
- commandMap.execute(commandClass, params);
- }
-
-
//----------------------------------
// Debug
//----------------------------------
- public function listMessageCommands(messageType:String):String {
- use namespace pureLegsCore;
-
- return "SENDING MESSAGE:'" + messageType + "'\t> WILL EXECUTE > " + String(commandMap.listMessageCommands(messageType)) + "\n";
- }
-
/**
* List all message mappings.
*/
@@ -1,7 +1,7 @@
package com.mindscriptact.mobileTestApp.controler.test {
import flash.geom.Point;
-import helloWorld.model.TestProxy;
+import wiewManagement.model.TestProxy;
import mvcexpress.mvc.Command;
@@ -1,6 +1,5 @@
package helloWorld {
//import com.mindscriptact.mvcExpressLogger.MvcExpressLogger;
-
import flash.display.Sprite;
import flash.events.Event;
@@ -4,9 +4,9 @@ import flash.geom.Point;
import helloWorld.controller.setup.SetupControllerCommand;
import helloWorld.controller.setup.SetupModelCommand;
import helloWorld.controller.setup.SetupViewCommand;
-import helloWorld.messages.DataMsg;
-import helloWorld.messages.Msg;
-import helloWorld.messages.ViewMsg;
+import helloWorld.messages.DataMessage;
+import helloWorld.messages.Message;
+import helloWorld.messages.ViewMessage;
import mvcexpress.modules.ModuleCore;
import mvcexpress.utils.checkClassStringConstants;
@@ -22,7 +22,7 @@ public class MainModule extends ModuleCore {
// little utility to prevent accidental message constant dublications.
CONFIG::debug {
- checkClassStringConstants(Msg, DataMsg, ViewMsg);
+ checkClassStringConstants(Message, DataMessage, ViewMessage);
}
// map commands (you can map them here.. or move it to command.)
@@ -45,7 +45,7 @@ public class MainModule extends ModuleCore {
// messages can be sent from modules, commands, proxies and mediators.
// messages can execute commands, and be handled by mediators.
// params object is optional.
- sendMessage(Msg.TEST, new Point(1, 5));
+ sendMessage(Message.TEST, new Point(1, 5));
trace("Hello mvcExpress!!!");
}
@@ -1,6 +1,6 @@
package helloWorld.controller.setup {
import helloWorld.controller.test.TestCommand;
-import helloWorld.messages.Msg;
+import helloWorld.messages.Message;
import mvcexpress.mvc.Command;
@@ -16,7 +16,7 @@ public class SetupControllerCommand extends Command {
// map a command to message string.
// command class will be executed then messange with that string is sent.
- commandMap.map(Msg.TEST, TestCommand);
+ commandMap.map(Message.TEST, TestCommand);
}
}
@@ -3,7 +3,7 @@ package helloWorld.messages {
/**
* Constants for data messages. (Usualy for data change.)
*/
-public class DataMsg {
+public class DataMessage {
static public const TEST_DATA_CHANGED:String = "testDataChanged";
@@ -3,7 +3,7 @@ package helloWorld.messages {
/**
* Constants for command messages, and everything that does not fit well in DataMsg or ViewMsg classes.
*/
-public class Msg {
+public class Message {
static public const TEST:String = "test";
@@ -3,7 +3,7 @@ package helloWorld.messages {
/**
* Constants for view messages. (Usualy for user interactions.)
*/
-public class ViewMsg {
+public class ViewMessage {
static public const MAIN_CLICKED:String = "mainClicked";
@@ -1,5 +1,5 @@
package helloWorld.model {
-import helloWorld.messages.DataMsg;
+import helloWorld.messages.DataMessage;
import mvcexpress.mvc.Proxy;
@@ -27,7 +27,7 @@ public class TestProxy extends Proxy {
testData = value;
// in many cases then dada is chaned, you want to send a message so any interested mediators or commands colud react.
- sendMessage(DataMsg.TEST_DATA_CHANGED, testData);
+ sendMessage(DataMessage.TEST_DATA_CHANGED, testData);
}
//----------------------------------
@@ -2,8 +2,8 @@ package helloWorld.view.main {
import flash.events.MouseEvent;
import helloWorld.Main;
-import helloWorld.messages.DataMsg;
-import helloWorld.messages.ViewMsg;
+import helloWorld.messages.DataMessage;
+import helloWorld.messages.ViewMessage;
import helloWorld.model.TestProxy;
import mvcexpress.mvc.Mediator;
@@ -30,15 +30,15 @@ public class MainMediator extends Mediator {
view.stage.addEventListener(MouseEvent.CLICK, handleStageClick);
// to handle framework messages you will add message handler.
- addHandler(DataMsg.TEST_DATA_CHANGED, handleTestDataChange);
+ addHandler(DataMessage.TEST_DATA_CHANGED, handleTestDataChange);
}
private function handleStageClick(event:MouseEvent):void {
trace("MainMediator.handleMainClick > event : " + event);
// in many cases you will want to send a message then user makes input.
- sendMessage(ViewMsg.MAIN_CLICKED);
+ sendMessage(ViewMessage.MAIN_CLICKED);
}
private function handleTestDataChange(testData:String):void {
@@ -1,18 +1,18 @@
package modularProject.modularSample {
//import com.mindscriptact.mvcExpressLogger.MvcExpressLogger;
-
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
-import modularProject.global.ModuleNames;
import modularProject.modularSample.controller.setup.InitModularSampleCommand;
import modularProject.modularSample.controller.setup.SetUpPermissionsCommand;
import modularProject.modularSample.controller.setup.SetUpViewCommand;
import modularProject.modularSample.msg.DataMessages;
import modularProject.modularSample.msg.Messages;
import modularProject.modularSample.msg.ViewMessages;
+import modules.ModuleNames;
+
import mvcexpress.extensions.scoped.modules.ModuleScoped;
import mvcexpress.utils.checkClassStringConstants;
@@ -40,11 +40,11 @@ public class ModularSample extends Sprite {
trace("ModularSampleShellModule.onInit");
- module.externalExecuteCommand(SetUpPermissionsCommand);
+ module.commandMap.execute(SetUpPermissionsCommand);
- module.externalExecuteCommand(SetUpViewCommand);
+ module.commandMap.execute(SetUpViewCommand);
- module.externalExecuteCommand(InitModularSampleCommand, this);
+ module.commandMap.execute(InitModularSampleCommand, this);
}
@@ -49,13 +49,13 @@ public class Console extends Sprite {
renderConsoleView();
- module.externalExecuteCommand(SetUpConsolePermissionsCommand);
+ module.commandMap.execute(SetUpConsolePermissionsCommand);
- module.externalExecuteCommand(SetUpConsoleControllerCommand);
- module.externalExecuteCommand(SetUpConsoleModelCommand, this.consoleId);
- module.externalExecuteCommand(SetUpConsoleViewCommand);
+ module.commandMap.execute(SetUpConsoleControllerCommand);
+ module.commandMap.execute(SetUpConsoleModelCommand, this.consoleId);
+ module.commandMap.execute(SetUpConsoleViewCommand);
- module.externalExecuteCommand(InitConsoleCommand, this);
+ module.commandMap.execute(InitConsoleCommand, this);
}
@@ -1,10 +1,17 @@
package ticTacToe {
//import com.mindscriptact.mvcExpressLogger.MvcExpressLogger;
+import com.mindscriptact.mvcExpressLogger.MvcExpressLogger;
import flash.display.Sprite;
import flash.events.Event;
+import mvcexpress.utils.checkClassStringConstants;
+
+import ticTacToe.messages.DataMessages;
+import ticTacToe.messages.Messages;
+import ticTacToe.messages.ViewMessages;
+
/**
* Main application class.
*/
@@ -27,10 +34,11 @@ public class Main extends Sprite {
private function init(event:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
- // add mvcExpress logger for debugging. (press CTRL + ` to open it.)
- //CONFIG::debug {
- // MvcExpressLogger.init(this.stage);
- //}
+ // add mvcExpress logger for debugging. (press CTRL + ` to toggle it.)
+ CONFIG::debug {
+ MvcExpressLogger.init(this.stage, 330, 0, 870, 400, 1, true);
+ checkClassStringConstants(Messages, DataMessages, ViewMessages);
+ }
// entry point
module = new MainModule();
@@ -6,9 +6,9 @@ import mvcexpress.utils.checkClassStringConstants;
import ticTacToe.controller.setup.SetupControllerCommand;
import ticTacToe.controller.setup.SetupModelCommand;
import ticTacToe.controller.setup.SetupViewCommand;
-import ticTacToe.messages.DataMsg;
-import ticTacToe.messages.Msg;
-import ticTacToe.messages.ViewMsg;
+import ticTacToe.messages.DataMessages;
+import ticTacToe.messages.Messages;
+import ticTacToe.messages.ViewMessages;
/**
* Main application module.
@@ -18,13 +18,6 @@ public class MainModule extends ModuleCore {
override protected function onInit():void {
- // little utility to prevent accidental message constant dublications.
- CONFIG::debug {
- checkClassStringConstants(Msg, DataMsg, ViewMsg);
-
- MvcExpress.debugFunction = trace;
- }
-
// map commands
commandMap.execute(SetupControllerCommand);
// map proxies (and services)
@@ -1,10 +0,0 @@
-package ticTacToe.constants {
-
-/**
- * Example file to store constants.
- */
-public class MainConfig {
-
-
-}
-}
@@ -7,7 +7,7 @@ package ticTacToe.constants {
public class TokenId {
static public const TIC:int = 1;
- static public const TAC:int = 0;
+ static public const EMPTY:int = 0; // TAC
static public const TOE:int = -1;
}
@@ -29,9 +29,8 @@ public class CellClickCommand extends Command {
//
var lineVo:LineVO = gameBoardProxy.findLine();
if (lineVo) {
- trace("lineVo : " + lineVo);
// block game...
- gameProxy.disable();
+ gameProxy.disableGame();
}
}
}
@@ -18,7 +18,7 @@ public class NewGameCommand extends Command {
public function execute(params:Object):void {
gameBoardProxy.clearBoard();
- gameProxy.enable();
+ gameProxy.enableGame();
}
}
@@ -3,7 +3,7 @@ import mvcexpress.mvc.Command;
import ticTacToe.controller.game.CellClickCommand;
import ticTacToe.controller.game.NewGameCommand;
-import ticTacToe.messages.ViewMsg;
+import ticTacToe.messages.ViewMessages;
/**
* Initial set up of maping commands to messages.
@@ -13,8 +13,8 @@ import ticTacToe.messages.ViewMsg;
public class SetupControllerCommand extends Command {
public function execute(params:Object):void {
- commandMap.map(ViewMsg.CELL_CLICKED, CellClickCommand);
- commandMap.map(ViewMsg.NEW_GAME_CLICKED, NewGameCommand);
+ commandMap.map(ViewMessages.CELL_CLICKED, CellClickCommand);
+ commandMap.map(ViewMessages.NEW_GAME_CLICKED, NewGameCommand);
}
}
@@ -3,7 +3,7 @@ package ticTacToe.messages {
/**
* Constants for data messages. (Usualy for data change.)
*/
-public class DataMsg {
+public class DataMessages {
static public const CELL_SET:String = "cellSet";
static public const BOARD_CLEARED:String = "boardCleared";
static public const LINE_FOUND:String = "lineFound";
@@ -3,7 +3,7 @@ package ticTacToe.messages {
/**
* Constants for command messages, and everything that does not fit well in DataMsg or ViewMsg classes.
*/
-public class Msg {
+public class Messages {
}
@@ -3,7 +3,7 @@ package ticTacToe.messages {
/**
* Constants for view messages. (Usualy for user interactions.)
*/
-public class ViewMsg {
+public class ViewMessages {
static public const CELL_CLICKED:String = "cellClicked";
static public const NEW_GAME_CLICKED:String = "newGameClicked";
Oops, something went wrong.

0 comments on commit b9bdf8f

Please sign in to comment.