利用者向け情報

開発者向け情報

[sandbox.akabana]/trunk/yui/yui-framework/src/main/flex/org/seasar/akabana/yui/framework/mixin/YuiFrameworkMixin.as

Parent Directory Parent Directory | Revision Log Revision Log


Revision 710 - (hide annotations)
Sat Apr 11 19:30:09 2009 JST (4 years, 1 month ago) by e1arkw
File size: 4553 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 e1arkw 560 [ResourceBundle("conventions")]
33     /**
34 e1arkw 495 * YuiFramework初期設定用Mixinクラス
35 e1arkw 493 *
36     * @author $Author$
37     * @version $Revision$
38 e1arkw 404 */
39     public class YuiFrameworkMixin
40     {
41 e1arkw 518 private static var _this:YuiFrameworkMixin;
42 e1arkw 404
43 e1arkw 518 private static var _container:YuiFrameworkContainer;
44 e1arkw 404
45     public static function init( flexModuleFactory:IFlexModuleFactory ):void{
46 e1arkw 518 LogManager.init();
47 e1arkw 657
48 e1arkw 518 _this = new YuiFrameworkMixin();
49     _container = new YuiFrameworkContainer();
50    
51 e1arkw 404 if( flexModuleFactory is ISystemManager ){
52 e1arkw 710 var systemManager:ISystemManager = (flexModuleFactory as ISystemManager).getSandboxRoot() as ISystemManager;
53 e1arkw 404 systemManager.addEventListener(
54     Event.ADDED_TO_STAGE,
55     _this.addedToStageHandler,
56     true,
57     int.MAX_VALUE
58 e1arkw 476 );
59 e1arkw 404 systemManager.addEventListener(
60     FlexEvent.APPLICATION_COMPLETE,
61     _this.applicationCompleteHandler,
62 e1arkw 422 false,
63 e1arkw 404 int.MAX_VALUE
64     );
65 e1arkw 657 }
66 e1arkw 404 }
67    
68     public function set conventions( value:Array ):void{
69     var namingConvention_:NamingConvention = new NamingConvention();
70     namingConvention_.conventions = value;
71     _container.namingConvention = namingConvention_;
72     }
73    
74 e1arkw 422 protected var initialized:Boolean;
75    
76 e1arkw 404 private function addedToStageHandler( event:Event ):void{
77 e1arkw 468 if( event.target is UIComponent ){
78     _container.registerComponent(event.target as UIComponent);
79     }
80 e1arkw 404 }
81 e1arkw 492
82     private function addedHandler( event:Event ):void{
83     if( event.target is UIComponent ){
84     _container.registerComponent(event.target as UIComponent);
85     }
86 e1arkw 683 }
87    
88     private function removedHandler( event:Event ):void{
89     if( event.target is UIComponent ){
90     _container.unregisterComponent(event.target as UIComponent);
91     }
92     }
93 e1arkw 404
94     private function applicationCompleteHandler( event:FlexEvent ):void{
95     if( event.currentTarget is ISystemManager ){
96     var systemManager:ISystemManager = event.currentTarget as ISystemManager;
97     systemManager.removeEventListener(
98     FlexEvent.APPLICATION_COMPLETE,
99     applicationCompleteHandler,
100 e1arkw 422 false
101 e1arkw 404 );
102 e1arkw 487 systemManager.removeEventListener(
103     Event.ADDED_TO_STAGE,
104     _this.addedToStageHandler,
105     true
106 e1arkw 683 );
107 e1arkw 487 systemManager.addEventListener(
108     Event.ADDED,
109 e1arkw 492 _this.addedHandler,
110 e1arkw 487 true,
111     int.MAX_VALUE
112 e1arkw 683 );
113     systemManager.addEventListener(
114     Event.REMOVED_FROM_STAGE,
115     _this.removedHandler,
116     true,
117     int.MAX_VALUE
118 e1arkw 487 );
119 e1arkw 422 if( !initialized ){
120     initialized = true;
121 e1arkw 472 _container.initialize();
122 e1arkw 422 }
123 e1arkw 404 }
124     }
125     }
126     }

Properties

Name Value
svn:keywords Author Revision

Repository Top
ViewVC Help  
ViewVC logotype
Powered by ViewVC