[sandbox.akabana]/trunk/yui/yui-framework/src/main/flex/org/seasar/akabana/yui/framework/mixin/YuiFrameworkMixin.as
Parent Directory
|
Revision Log
Revision 487 -
(hide annotations)
Sun Jul 27 16:42:42 2008 JST (4 years, 9 months ago) by e1arkw
File size: 3971 byte(s)
Sun Jul 27 16:42:42 2008 JST (4 years, 9 months ago) by e1arkw
File size: 3971 byte(s)
| 1 | e1arkw | 404 | /* |
| 2 | * Copyright 2004-2008 the Seasar Foundation and the Others. | ||
| 3 | * | ||
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | * you may not use this file except in compliance with the License. | ||
| 6 | * You may obtain a copy of the License at | ||
| 7 | * | ||
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | * | ||
| 10 | * Unless required by applicable law or agreed to in writing, software | ||
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
| 13 | * either express or implied. See the License for the specific language | ||
| 14 | * governing permissions and limitations under the License. | ||
| 15 | */ | ||
| 16 | package org.seasar.akabana.yui.framework.mixin | ||
| 17 | { | ||
| 18 | |||
| 19 | import flash.events.Event; | ||
| 20 | |||
| 21 | import mx.core.IFlexModuleFactory; | ||
| 22 | e1arkw | 448 | import mx.core.UIComponent; |
| 23 | e1arkw | 404 | import mx.events.FlexEvent; |
| 24 | import mx.managers.ISystemManager; | ||
| 25 | |||
| 26 | e1arkw | 422 | import org.seasar.akabana.yui.framework.convention.NamingConvention; |
| 27 | e1arkw | 404 | import org.seasar.akabana.yui.framework.core.YuiFrameworkContainer; |
| 28 | e1arkw | 431 | import org.seasar.akabana.yui.logging.LogManager; |
| 29 | e1arkw | 404 | |
| 30 | [Mixin] | ||
| 31 | e1arkw | 431 | [ResourceBundle("yui_framework")] |
| 32 | /** | ||
| 33 | e1arkw | 404 | * YuiFramework設定用MIXIN |
| 34 | * | ||
| 35 | */ | ||
| 36 | public class YuiFrameworkMixin | ||
| 37 | { | ||
| 38 | e1arkw | 447 | YuiCoreClasses; |
| 39 | LogManager.init(); | ||
| 40 | YuiFrameworkClasses; | ||
| 41 | |||
| 42 | e1arkw | 431 | private static const _logManagerInitialized:Boolean = initLogManager(); |
| 43 | |||
| 44 | e1arkw | 404 | private static const _this:YuiFrameworkMixin = new YuiFrameworkMixin(); |
| 45 | |||
| 46 | private static const _container:YuiFrameworkContainer = new YuiFrameworkContainer(); | ||
| 47 | |||
| 48 | e1arkw | 431 | public static function initLogManager():Boolean{ |
| 49 | LogManager.init(); | ||
| 50 | return true; | ||
| 51 | } | ||
| 52 | |||
| 53 | e1arkw | 404 | public static function init( flexModuleFactory:IFlexModuleFactory ):void{ |
| 54 | if( flexModuleFactory is ISystemManager ){ | ||
| 55 | var systemManager:ISystemManager = flexModuleFactory as ISystemManager; | ||
| 56 | systemManager.addEventListener( | ||
| 57 | Event.ADDED_TO_STAGE, | ||
| 58 | _this.addedToStageHandler, | ||
| 59 | true, | ||
| 60 | int.MAX_VALUE | ||
| 61 | e1arkw | 476 | ); |
| 62 | e1arkw | 404 | systemManager.addEventListener( |
| 63 | FlexEvent.APPLICATION_COMPLETE, | ||
| 64 | _this.applicationCompleteHandler, | ||
| 65 | e1arkw | 422 | false, |
| 66 | e1arkw | 404 | int.MAX_VALUE |
| 67 | ); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | public function set conventions( value:Array ):void{ | ||
| 72 | var namingConvention_:NamingConvention = new NamingConvention(); | ||
| 73 | namingConvention_.conventions = value; | ||
| 74 | _container.namingConvention = namingConvention_; | ||
| 75 | } | ||
| 76 | |||
| 77 | e1arkw | 422 | protected var initialized:Boolean; |
| 78 | |||
| 79 | e1arkw | 404 | private function addedToStageHandler( event:Event ):void{ |
| 80 | e1arkw | 468 | if( event.target is UIComponent ){ |
| 81 | _container.registerComponent(event.target as UIComponent); | ||
| 82 | } | ||
| 83 | e1arkw | 404 | } |
| 84 | |||
| 85 | private function applicationCompleteHandler( event:FlexEvent ):void{ | ||
| 86 | if( event.currentTarget is ISystemManager ){ | ||
| 87 | var systemManager:ISystemManager = event.currentTarget as ISystemManager; | ||
| 88 | systemManager.removeEventListener( | ||
| 89 | FlexEvent.APPLICATION_COMPLETE, | ||
| 90 | applicationCompleteHandler, | ||
| 91 | e1arkw | 422 | false |
| 92 | e1arkw | 404 | ); |
| 93 | e1arkw | 487 | systemManager.removeEventListener( |
| 94 | Event.ADDED_TO_STAGE, | ||
| 95 | _this.addedToStageHandler, | ||
| 96 | true | ||
| 97 | ); | ||
| 98 | systemManager.addEventListener( | ||
| 99 | Event.ADDED, | ||
| 100 | _this.addedToStageHandler, | ||
| 101 | true, | ||
| 102 | int.MAX_VALUE | ||
| 103 | ); | ||
| 104 | e1arkw | 422 | if( !initialized ){ |
| 105 | initialized = true; | ||
| 106 | e1arkw | 472 | _container.initialize(); |
| 107 | e1arkw | 422 | } |
| 108 | e1arkw | 404 | } |
| 109 | } | ||
| 110 | } | ||
| 111 | } |
| Repository Top ViewVC Help |
![]() |
| Powered by ViewVC |

