Skip to content

Commit

Permalink
Same renaming.
Browse files Browse the repository at this point in the history
  • Loading branch information
MindScriptAct committed Nov 11, 2013
1 parent 90e7f75 commit b9bdf8f
Show file tree
Hide file tree
Showing 29 changed files with 70 additions and 126 deletions.
2 changes: 1 addition & 1 deletion libSrc/mvcexpress/core/CommandMap.as
Expand Up @@ -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];
}

Expand Down
2 changes: 1 addition & 1 deletion libSrc/mvcexpress/core/messenger/Messenger.as
Expand Up @@ -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 + "], ";
}
Expand Down
21 changes: 0 additions & 21 deletions libSrc/mvcexpress/modules/ModuleCore.as
Expand Up @@ -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.
*/
Expand Down
@@ -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;

Expand Down
1 change: 0 additions & 1 deletion mvcExpress-helloWorld/src/helloWorld/Main.as
@@ -1,6 +1,5 @@
package helloWorld {
//import com.mindscriptact.mvcExpressLogger.MvcExpressLogger;

import flash.display.Sprite;
import flash.events.Event;

Expand Down
10 changes: 5 additions & 5 deletions mvcExpress-helloWorld/src/helloWorld/MainModule.as
Expand Up @@ -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;
Expand All @@ -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.)
Expand All @@ -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!!!");
}
Expand Down
@@ -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;

Expand All @@ -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);
}

}
Expand Down
Expand Up @@ -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";

Expand Down
Expand Up @@ -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";

Expand Down
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions mvcExpress-helloWorld/src/helloWorld/model/TestProxy.as
@@ -1,5 +1,5 @@
package helloWorld.model {
import helloWorld.messages.DataMsg;
import helloWorld.messages.DataMessage;

import mvcexpress.mvc.Proxy;

Expand Down Expand Up @@ -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);
}

//----------------------------------
Expand Down
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
@@ -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;

Expand Down Expand Up @@ -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);

}

Expand Down
10 changes: 5 additions & 5 deletions mvcExpress-modular/src/modularProject/modules/console/Console.as
Expand Up @@ -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);

}

Expand Down
16 changes: 12 additions & 4 deletions mvcExpress-ticTacToe/src/ticTacToe/Main.as
@@ -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.
*/
Expand All @@ -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();
Expand Down
13 changes: 3 additions & 10 deletions mvcExpress-ticTacToe/src/ticTacToe/MainModule.as
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions mvcExpress-ticTacToe/src/ticTacToe/constants/MainConfig.as

This file was deleted.

2 changes: 1 addition & 1 deletion mvcExpress-ticTacToe/src/ticTacToe/constants/TokenId.as
Expand Up @@ -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;

}
Expand Down
Expand Up @@ -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();
}
}
}
Expand Down
Expand Up @@ -18,7 +18,7 @@ public class NewGameCommand extends Command {

public function execute(params:Object):void {
gameBoardProxy.clearBoard();
gameProxy.enable();
gameProxy.enableGame();
}

}
Expand Down
Expand Up @@ -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.
Expand All @@ -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);
}

}
Expand Down
Expand Up @@ -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";
Expand Down
Expand Up @@ -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 {


}
Expand Down
Expand Up @@ -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";

Expand Down

0 comments on commit b9bdf8f

Please sign in to comment.