Vulcan Project에 사용된 PureMVC Framework의 코드는 일부 수정되어 사용 되었습니다. 수정된 내용은 다음과 같습니다.
PureMVC MultiCore for AS3 1.0.5
패키지 및 클래스 이름 변경
org.puremvc.as3.multicore 패키지 및 하위 구조는 com.vulcan.mvc.history 패키지를 제외한 com.vulcan.mvc 패키지 및 하위 구조와 1:1로 대응되어 경로 및 파일명(클래스 네임)이 변경되었습니다.
코드 수정
com.vulcan.mvc.core 패키지의 Controller, Model, View 클래스의 removeController, removeModel, removeView 메서드에서 각각 새로 정의한 clear 메서드를 호출하는 로직으로 변경되었습니다. 각 clear 메서드는 등록된 IController, IModel, IView 인스턴스를 명시적으로 모두 제거하는 역할을 합니다.
Controller.as
// 수정된 메서드 public static function removeController( key:String ):void { var controller:Controller = instanceMap[ key ]; if(controller){ controller.clear(); } } // 추가된 메서드 protected function clear():void { for(var notificationName:String in commandMap) { removeCommand(notificationName); } delete instanceMap[ multitonKey ]; }
Model.as
// 수정된 메서드 public static function removeModel( key:String ):void { var model:Model = instanceMap[ key ]; if(model){ model.clear(); } } // 추가된 메서드 protected function clear():void { for(var name:String in proxyMap) { removeProxy(name); } delete instanceMap[ multitonKey ]; }
View.as
// 수정된 메서드 public static function removeView( key:String ):void { var view:View = instanceMap[ key ]; if(view){ view.clear(); } } // 추가된 메서드 protected function clear():void { for(var name:String in mediatorMap) { removeMediator(name); } delete instanceMap[ multitonKey ]; }
PureMVC Utility - AS3 / Undo 1.3
패키지 및 클래스 이름 변경
org.puremvc.as3.utilities.undo 패키지 및 하위 구조는 com.vulcan.mvc.history 패키지 및 하위 구조와 1:1로 대응되어 경로 및 파일명(클래스 네임)이 변경되었습니다.
코드 수정
PureMVC Standard 버전인 코드를 PureMVC MultiCore 버전에 적합하도록 수정되었습니다.HistoryBase.as (원본의 UndoableCommandBase.as 파일)
public function undo():void
{
if ( undoCmdClass == null )
throw new Error("undo command 를 찾지 못함. registerUndoCommand 메서드를 사용하여 undo command 를 등록하세요.");
/** The type of the notification is used as a flag,
* indicating wheather to save the command into the history, or not.
* The undo command, shold not be recorded into the history,
* and its notification type is set to UndoableCommandEnum.NON_RECORDABLE_COMMAND
**/
var oldType:String = _note.getType();
_note.setType( ProcessType.NON_RECORD );
try
{
var commandInstance : ICommand = new undoCmdClass();
// MultiCore를 위해 multitonKey 설정추가함.
commandInstance.initializeNotifier(multitonKey);
commandInstance.execute( _note );
}
catch ( err:Error )
{
trace("UNDO 에러 : " + this + ".\n " + err.getStackTrace() );
}
_note.setType( oldType );
}
HistoryMacroBase.as(원본의 UndoableMacroCommandBase.as 파일)
override public function executeCommand():void { //throw new Error("The undoable MACRO command does not have 'executeCommand' method implemented."); // don't record the sub commands var noteType:String = getNote().getType(); // DO NOT RECORD THE SUBCOMMANDS INTO THE HISTORY getNote().setType( ProcessType.NON_RECORD ); for ( var i:int = 0; i< subCommands.length; i++) { var commandClassRef : Class = subCommands[i]; var commandInstance : ICommand = new commandClassRef(); // MultiCore를 위해 multitonKey 설정추가함. commandInstance.initializeNotifier(multitonKey); commandInstance.execute( getNote() ); } // SET BACK THE ORIGINAL TYPE OF THE NOTE getNote().setType( noteType ); }
수정된 소스 코드와 PureMVC 라이선스 사본은 소스 저장소의 com.vulcan.mvc 패키지에 해당하는 디렉토리를 참고하시기 바랍니다.
'Documents > Startup' 카테고리의 다른 글
NAME, NAME_TYPE 속성을 이용한 인스턴스 찾기 (4) | 2010.10.29 |
---|---|
Vulcan Project 초기화 과정 (0) | 2010.10.25 |
Vulcan Project 구조 (0) | 2010.10.25 |