チェンジセット 2773

差分発生行の前後
無視リスト:
コミット日時:
2009/06/02 18:40:55 (3 年前)
コミッタ:
seagirl
ログメッセージ:

まだ途中

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/GeniusFramework/branches/2.0

    • 属性の設定値: svn:ignore (削除)
  • as3/GeniusFramework/branches/2.0/samples/GettingStarted

    • 属性の設定値: svn:externals (削除)
    • 属性の設定値: svn:ignore (変更前)
      .project
      .settings
      .flexProperties
      .actionScriptProperties
      (変更後)
      bin-debug
  • as3/GeniusFramework/branches/2.0/samples/GettingStarted/src/GettingStarted.mxml

    r2598 r2773  
    66        xmlns:views="views.*" 
    77        backgroundColor="#FFFFFF" 
     8        preloader="GettingStartedPreloader" 
    89        layout="absolute"> 
    910        <mx:Style source="GettingStarted.css" /> 
  • as3/GeniusFramework/branches/2.0/samples/GettingStarted/src/GettingStartedDelegate.as

    r2597 r2773  
    1212        { 
    1313                public var view:GettingStarted; 
    14                  
    15                 override protected function createConfig():Config 
    16                 {                                
    17                         return new Config("assets/config.json"); 
    18                 } 
    1914                 
    2015                override protected function initializeModels():void 
     
    3429                } 
    3530                 
    36                 override protected function changePage(data:Object):void 
     31                override public function changePage(data:Object):void 
    3732                { 
    3833                        view.viewStack.selectViewByClassName(data.page); 
  • as3/GeniusFramework/branches/2.0/src

    • 属性の設定値: svn:ignore (削除)
  • as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/controllers/ViewController.as

    r2594 r2773  
    3434        import jp.seagirl.genius.core.Context; 
    3535        import jp.seagirl.genius.effects.IGeniusEffect; 
    36         import jp.seagirl.genius.models.Model; 
     36        import jp.seagirl.genius.models.IModel; 
    3737        import jp.seagirl.genius.views.ApplicationDelegate; 
    3838         
     
    165165                //-------------------------------------------------------------------------- 
    166166                 
    167                 protected function getModel(modelName:String):Model 
     167                protected function getModel(modelName:String):IModel 
    168168                { 
    169169                        return context.getModel(modelName); 
  • as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/core/Config.as

    r2583 r2773  
    128128                public function initialize():void 
    129129                { 
    130                         if (source is String) 
     130                        if (source != null && source is String) 
    131131                        { 
    132132                                load(); 
  • as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/core/Context.as

    r2587 r2773  
    3030         
    3131        import jp.seagirl.genius.controllers.ViewController; 
     32        import jp.seagirl.genius.models.IModel; 
    3233        import jp.seagirl.genius.models.Model; 
    3334         
     
    164165                } 
    165166                 
    166                 public function getModel(modelName:String):Model 
     167                public function getModel(modelName:String):IModel 
    167168                { 
    168169                        return modelsMap[modelName]; 
     
    174175                } 
    175176                 
    176                 public function addModel(model:Model):void 
     177                public function addModel(model:IModel):void 
    177178                { 
    178179                        modelsMap[model.name] = model; 
    179180                } 
    180181                 
    181                 public function removeModel(modelName:String):Model 
    182                 { 
    183                         var model:Model = modelsMap[modelName] as Model; 
     182                public function removeModel(modelName:String):IModel 
     183                { 
     184                        var model:IModel = modelsMap[modelName] as IModel; 
    184185                         
    185186                        if (model) 
  • as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/models/IModel.as

    r318 r2773  
    3333        public interface IModel 
    3434        { 
    35  
     35                function get name():String; 
     36                function set name(value:String):void; 
    3637        } 
    3738} 
  • as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/models/Model.as

    r2484 r2773  
    7474                //---------------------------------- 
    7575                 
    76                 public var name:String; 
     76                private var _name:String; 
     77                 
     78                public function get name():String 
     79                { 
     80                        return _name; 
     81                } 
     82                 
     83                public function set name(value:String):void 
     84                { 
     85                        _name = value; 
     86                } 
    7787                 
    7888                //---------------------------------- 
  • as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/views/ApplicationDelegate.as

    r2596 r2773  
    3636        import jp.seagirl.genius.core.Config; 
    3737        import jp.seagirl.genius.core.Context; 
    38         import jp.seagirl.genius.events.ApplicationEvent
    39         import jp.seagirl.genius.models.Model
     38        import jp.seagirl.genius.models.IModel
     39        import jp.seagirl.preloaders.GeniusPreloader
    4040         
    4141        import mx.binding.utils.BindingUtils; 
    4242        import mx.core.Application; 
     43        import mx.events.FlexEvent; 
    4344         
    4445        import org.libspark.thread.EnterFrameThreadExecutor; 
     
    6667                private var config:Config; 
    6768                 
    68                 override protected function preinitialize():void 
    69                 { 
     69                override public function initialized(document:Object, id:String):void 
     70                { 
     71                        trace('initialized') 
    7072                        Thread.initialize(new EnterFrameThreadExecutor()); 
     73                         
     74                        config = GeniusPreloader.config; 
     75                 
     76                        context = new Context(config); 
     77                        context.traceApplicationInformation(); 
     78                         
     79                        BindingUtils.bindSetter(onContextStateChange, context, 'state'); 
     80                         
     81                        if (!hasOwnProperty('view')) 
     82                                throw new Error("対応する View が見つかりません。"); 
     83                         
     84                        this['view'] = document; 
     85                         
     86                        viewClass = getViewClass(); 
     87                         
     88                        var application:Application = this['view'] as Application; 
     89                         
     90                        if (application) 
     91                        { 
     92                                application.preloader = GeniusPreloader; 
     93                                application.data = { delegate: this }; 
     94                                application.styleName = 'plain'; 
     95                                application.setStyle('color', '#000000'); 
     96                                 
     97                                application.addEventListener(FlexEvent.PREINITIALIZE, view_preinitializeHandler); 
     98                                application.addEventListener(FlexEvent.INITIALIZE, view_initializeHandler); 
     99                                application.addEventListener(FlexEvent.CREATION_COMPLETE, view_creationCompleteHandler); 
     100                        } 
     101                } 
     102                 
     103                override protected function initialize():void 
     104                { 
     105                        initializeModels(); 
     106                        initializeViews(); 
     107                        initializeControllers(); 
     108                        initializeContextMenu(); 
     109                } 
     110                 
     111                protected function initializeModels():void 
     112                { 
     113                         
     114                } 
     115                 
     116                protected function initializeViews():void 
     117                { 
     118                         
     119                } 
     120                 
     121                protected function initializeControllers():void 
     122                { 
     123                         
     124                } 
     125                 
     126                protected function initializeContextMenu():void 
     127                { 
     128                        var target:Application = this['view'] as Application; 
     129                         
     130                        var item:ContextMenuItem = new ContextMenuItem("Reload"); 
     131                        item.separatorBefore = true; 
     132                        item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, itemSelectHandler); 
     133                         
     134                        var menu:ContextMenu = target.contextMenu as ContextMenu; 
     135                        menu.hideBuiltInItems(); 
     136                        menu.customItems = [item].concat(menu.customItems); 
     137                        target.contextMenu = menu; 
     138                } 
     139                 
     140                public function changePage(data:Object):void 
     141                { 
     142                         
     143                } 
     144                 
     145                public function getModel(modelName:String):IModel 
     146                { 
     147                        return context.getModel(modelName); 
     148                } 
     149                 
     150                public function hasModel(modelName:String):Boolean 
     151                { 
     152                        return context.hasModel(modelName); 
     153                } 
     154                 
     155                public function addModel(model:IModel):void 
     156                { 
     157                        context.addModel(model); 
     158                } 
     159                 
     160                public function removeModel(modelName:String):IModel 
     161                { 
     162                        return context.removeModel(modelName); 
     163                } 
     164                 
     165                public function getController(controllerName:String):ViewController 
     166                { 
     167                        return context.getController(controllerName); 
     168                } 
     169                 
     170                public function hasController(controllerName:String):Boolean 
     171                { 
     172                        return context.hasController(controllerName); 
     173                } 
     174                 
     175                public function addController(controller:ViewController):void 
     176                { 
     177                        context.addController(controller); 
     178                } 
     179                 
     180                public function removeController(controllerName:String):ViewController 
     181                { 
     182                        return context.removeController(controllerName); 
     183                } 
     184                 
     185                private function onContextStateChange(data:Object):void 
     186                { 
     187                        if (this['view'] == null || data == null) 
     188                                return; 
     189                         
     190                        changePage(data); 
     191                } 
     192                 
     193                override protected function view_preinitializeHandler(event:FlexEvent):void 
     194                { 
     195                        trace('view_preinitializeHandler') 
     196                        this['view'].removeEventListener(FlexEvent.PREINITIALIZE, view_preinitializeHandler); 
    71197                         
    72198                        var application:Application = this['view'] as Application; 
     
    76202                                SWFWheel.initialize(application.systemManager.stage); 
    77203                                SWFProfiler.init(application.systemManager.stage, application); 
    78                                  
    79                                 application.data = { delegate: this }; 
    80                                 application.styleName = 'plain'; 
    81                                 application.setStyle('color', '#000000'); 
    82204                        } 
    83                 } 
    84                  
    85                 override protected function initialize():void 
    86                 { 
    87                         config = createConfig(); 
    88                         config.addEventListener(ApplicationEvent.APPLICATION_DID_FINISHED_INITIALIZING_CONFIG, configInitializedHandler); 
    89                         config.initialize(); 
    90                 } 
    91                  
    92                 protected function createConfig():Config 
    93                 { 
    94                         return new Config(); 
    95                 } 
    96                  
    97                 protected function initializeContext():void 
    98                 { 
    99                         context = new Context(config); 
    100                         context.traceApplicationInformation(); 
    101                                  
    102                         BindingUtils.bindSetter(onContextStateChange, context, 'state'); 
    103                 } 
    104                  
    105                 protected function initializeModels():void 
    106                 { 
    107                          
    108                 } 
    109                  
    110                 protected function initializeViews():void 
    111                 { 
    112                          
    113                 } 
    114                  
    115                 protected function initializeControllers():void 
    116                 { 
    117                          
    118                 } 
    119                  
    120                 protected function initializeContextMenu():void 
    121                 { 
    122                         var target:Application = this['view'] as Application; 
    123                          
    124                         var item:ContextMenuItem = new ContextMenuItem("Reload"); 
    125                         item.separatorBefore = true; 
    126                         item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, itemSelectHandler); 
    127                          
    128                         var menu:ContextMenu = target.contextMenu as ContextMenu; 
    129                         menu.hideBuiltInItems(); 
    130                         menu.customItems = [item].concat(menu.customItems); 
    131                         target.contextMenu = menu; 
    132                 } 
    133                  
    134                 protected function changePage(data:Object):void 
    135                 { 
    136                          
    137                 } 
    138                  
    139                 public function getModel(modelName:String):Model 
    140                 { 
    141                         return context.getModel(modelName); 
    142                 } 
    143                  
    144                 public function hasModel(modelName:String):Boolean 
    145                 { 
    146                         return context.hasModel(modelName); 
    147                 } 
    148                  
    149                 public function addModel(model:Model):void 
    150                 { 
    151                         context.addModel(model); 
    152                 } 
    153                  
    154                 public function removeModel(modelName:String):Model 
    155                 { 
    156                         return context.removeModel(modelName); 
    157                 } 
    158                  
    159                 public function getController(controllerName:String):ViewController 
    160                 { 
    161                         return context.getController(controllerName); 
    162                 } 
    163                  
    164                 public function hasController(controllerName:String):Boolean 
    165                 { 
    166                         return context.hasController(controllerName); 
    167                 } 
    168                  
    169                 public function addController(controller:ViewController):void 
    170                 { 
    171                         context.addController(controller); 
    172                 } 
    173                  
    174                 public function removeController(controllerName:String):ViewController 
    175                 { 
    176                         return context.removeController(controllerName); 
    177                 } 
    178                  
    179                 /** 
    180                  * 状態に変化があると呼び出されるコールバック関数です。 
    181                  */              
    182                 private function onContextStateChange(data:Object):void 
    183                 { 
    184                         if (data == null) 
    185                                 return; 
    186                          
    187                         changePage(data); 
    188                 } 
    189                  
    190                 private function configInitializedHandler(event:ApplicationEvent):void 
    191                 { 
    192                         initializeContext(); 
    193                         initializeModels(); 
    194                         initializeViews(); 
    195                         initializeControllers(); 
    196                         initializeContextMenu(); 
     205                         
     206                        preinitialize(); 
     207                } 
     208                 
     209                override protected function view_initializeHandler(event:FlexEvent):void 
     210                { 
     211                        trace('view_initializeHandler') 
     212                        this['view'].removeEventListener(FlexEvent.INITIALIZE, view_initializeHandler); 
     213                         
     214                        initialize(); 
    197215                } 
    198216