チェンジセット 2556
- コミット日時:
- 2009/05/02 01:29:48 (3 年前)
- ファイル:
-
- as3/GeniusFramework/branches/2.0/app-template/bin-debug/index.html (移動) (as3/GeniusFramework/branches/2.0/app-template/bin-debug/main.html から 移動)
- as3/GeniusFramework/branches/2.0/app-template/bin-debug/main.css (削除)
- as3/GeniusFramework/branches/2.0/app-template/script/build.properties (更新) (1 diff)
- as3/GeniusFramework/branches/2.0/app-template/src/MyApp.mxml (移動) (as3/GeniusFramework/branches/2.0/app-template/src/main.mxml から 移動) (1 diff)
- as3/GeniusFramework/branches/2.0/app-template/src/MyAppConfig.as (移動) (as3/GeniusFramework/branches/2.0/app-template/src/Config.as から 移動) (1 diff)
- as3/GeniusFramework/branches/2.0/app-template/src/MyAppDelegate.as (移動) (as3/GeniusFramework/branches/2.0/app-template/src/mainDelegate.as から 移動) (4 diffs)
- as3/GeniusFramework/branches/2.0/bin/build.xml (更新) (1 diff)
- as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/core/IConfig.as (追加)
- as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/views/ApplicationDelegate.as (更新) (4 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/GeniusFramework/branches/2.0/app-template/script/build.properties
r2553 r2556 2 2 APP_ROOT=${basedir}/.. 3 3 MAIN_APP=${APP_ROOT}/src/[% name %].mxml 4 OUTPUT_BIN=${basedir}/ bin-debug/[% name %].swf4 OUTPUT_BIN=${basedir}/../bin-debug/[% name %].swf as3/GeniusFramework/branches/2.0/app-template/src/MyApp.mxml
r2555 r2556 3 3 xmlns:mx="http://www.adobe.com/2006/mxml" 4 4 xmlns:local="*" 5 xmlns:views=" views.*"5 xmlns:views="[% package %].views.*" 6 6 layout="absolute" 7 7 pageTitle="[% name %]"> as3/GeniusFramework/branches/2.0/app-template/src/MyAppConfig.as
r2484 r2556 1 1 package 2 2 { 3 public class Config 3 import jp.seagirl.genius.core.IConfig; 4 5 public class [% name %]Config implements IConfig 4 6 { 5 7 // アプリケーションの名前 6 public static const APPLICATION_NAME:String = '[% name %]'; 8 public function get applicationName():String 9 { 10 return '[% name %]'; 11 } 7 12 8 13 // アプリケーションのバージョン 9 public static const APPLICATION_VERSION:String = '1.0.0'; 14 public function get applicationVersion():String 15 { 16 return '1.0.0'; 17 } 10 18 11 19 // デフォルトの状態 12 public static const DEFAULT_STATE:Object = { page: 'Page1' }; 13 20 public function get defaultState():Object 21 { 22 return { page: 'Page1' }; 23 } 24 14 25 } 15 26 } as3/GeniusFramework/branches/2.0/app-template/src/MyAppDelegate.as
r2555 r2556 8 8 import jp.seagirl.genius.views.ApplicationDelegate; 9 9 10 import mx.binding.utils.BindingUtils;11 10 import mx.core.UIComponent; 12 11 … … 18 17 19 18 /** 20 * アプリケーション 情報を登録します。19 * アプリケーション設定ファイルを初期化 21 20 */ 22 override protected function initialize Application():void21 override protected function initializeConfig():void 23 22 { 24 context.name = Config.APPLICATION_NAME; 25 context.version = Config.APPLICATION_VERSION; 26 context.traceApplicationInformation(); 27 } 28 29 /** 30 * アプリケーションの状態を登録します。 31 */ 32 override protected function initializeState():void 33 { 34 context.defaultState = Config.DEFAULT_STATE; 35 36 if (!context.state.hasOwnProperty('page')) 37 context.state = Config.DEFAULT_STATE; 38 39 BindingUtils.bindSetter(changePage, context, 'state'); 23 config = new [% name %]Config(); 40 24 } 41 25 … … 45 29 override protected function initializeModels():void 46 30 { 47 // context.addModel(new MainModel());31 //addModel(new MainModel()); 48 32 } 49 33 … … 53 37 override protected function initializeControllers():void 54 38 { 55 context.addController(new Page1Controller(view.page1));56 context.addController(new Page2Controller(view.page2));39 addController(new Page1Controller(view.page1)); 40 addController(new Page2Controller(view.page2)); 57 41 } 58 42 59 43 /** 60 * 状態に変化があると呼び出され るコールバック関数です。44 * 状態に変化があると呼び出されます。。 61 45 */ 62 privatefunction changePage(data:Object):void46 override protected function changePage(data:Object):void 63 47 { 64 if (data == null)65 return;66 67 48 var child:UIComponent; 68 49 as3/GeniusFramework/branches/2.0/bin/build.xml
r2553 r2556 33 33 </copy> 34 34 35 <move file="${app_root}/src/main.mxml" tofile="${app_root}/src/${name}.mxml" /> 36 <move file="${app_root}/src/mainDelegate.as" tofile="${app_root}/src/${name}Delegate.as" /> 35 <move file="${app_root}/src/MyApp.mxml" tofile="${app_root}/src/${name}.mxml" /> 36 <move file="${app_root}/src/MyAppDelegate.as" tofile="${app_root}/src/${name}Delegate.as" /> 37 <move file="${app_root}/src/MyAppConfig.as" tofile="${app_root}/src/${name}Config.as" /> 37 38 <move file="${app_root}/src/main.css" tofile="${app_root}/src/${name}.css" /> 38 39 <move file="${app_root}/src/main-config.xml" tofile="${app_root}/src/${name}-config.xml" /> as3/GeniusFramework/branches/2.0/src/jp/seagirl/genius/views/ApplicationDelegate.as
r2555 r2556 26 26 package jp.seagirl.genius.views 27 27 { 28 import jp.seagirl.genius.controllers.ViewController; 28 29 import jp.seagirl.genius.core.Context; 30 import jp.seagirl.genius.core.IConfig; 31 import jp.seagirl.genius.models.Model; 29 32 33 import mx.binding.utils.BindingUtils; 30 34 import mx.core.Application; 31 35 … … 50 54 } 51 55 56 protected var config:IConfig; 57 52 58 override protected function preinitialize():void 53 59 { 54 context = new Context();55 56 60 if (this['view'] is Application) 57 61 SWFWheel.initialize(Application(this['view']).systemManager.stage); … … 64 68 override protected function initialize():void 65 69 { 66 initialize Application();67 initialize State();70 initializeConfig(); 71 initializeContext(); 68 72 initializeModels(); 69 73 initializeControllers(); 70 74 } 71 75 72 protected function initialize Application():void76 protected function initializeConfig():void 73 77 { 74 78 if (config == null) 79 throw new Error("IConfig インスタンスが設定されていません。") 75 80 } 76 81 77 protected function initialize State():void82 protected function initializeContext():void 78 83 { 84 context = new Context(); 85 context.name = config.applicationName; 86 context.version = config.applicationVersion; 87 context.traceApplicationInformation(); 79 88 89 context.defaultState = config.defaultState; 90 91 if (!context.state.hasOwnProperty('page')) 92 context.state = config.defaultState; 93 94 BindingUtils.bindSetter(onContextStateChange, context, 'state'); 80 95 } 81 96 … … 90 105 } 91 106 107 protected function changePage(data:Object):void 108 { 109 110 } 111 112 public function getModel(modelName:String):Model 113 { 114 return context.getModel(modelName); 115 } 116 117 public function hasModel(modelName:String):Boolean 118 { 119 return context.hasModel(modelName); 120 } 121 122 public function addModel(model:Model):void 123 { 124 context.addModel(model); 125 } 126 127 public function removeModel(modelName:String):Model 128 { 129 return context.removeModel(modelName); 130 } 131 132 public function getController(controllerName:String):ViewController 133 { 134 return context.getController(controllerName); 135 } 136 137 public function hasController(controllerName:String):Boolean 138 { 139 return context.hasController(controllerName); 140 } 141 142 public function addController(controller:ViewController):void 143 { 144 context.addController(controller); 145 } 146 147 public function removeController(controllerName:String):ViewController 148 { 149 return context.removeController(controllerName); 150 } 151 152 /** 153 * 状態に変化があると呼び出されるコールバック関数です。 154 */ 155 private function onContextStateChange(data:Object):void 156 { 157 if (data == null) 158 return; 159 160 changePage(data); 161 } 162 92 163 } 93 164 }

