利用者向け情報

開発者向け情報

[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 834 - (show annotations)
Sat Sep 26 16:31:05 2009 JST (3 years, 7 months ago) by e1arkw
File size: 5927 byte(s)
messeage.properties
application.properties
MessageManagerのインスタンスからアクセス可能

カスタマイザーをdefaults.cssから取得するようにした
1 /*
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 import flash.net.registerClassAlias;
21
22 import mx.core.IFlexModuleFactory;
23 import mx.core.UIComponent;
24 import mx.events.FlexEvent;
25 import mx.managers.ISystemManager;
26
27 import org.seasar.akabana.yui.framework.convention.NamingConvention;
28 import org.seasar.akabana.yui.framework.core.YuiFrameworkContainer;
29 import org.seasar.akabana.yui.framework.util.SystemManagerUtil;
30 import org.seasar.akabana.yui.logging.LogManager;
31 import org.seasar.akabana.yui.logging.config.ConfigurationProvider;
32 import org.seasar.akabana.yui.logging.config.factory.LogConfigurationFactory;
33
34 [Mixin]
35 [ResourceBundle("conventions")]
36 /**
37 * YuiFramework初期設定用Mixinクラス
38 *
39 * @author $Author$
40 * @version $Revision$
41 */
42 public class YuiFrameworkMixin
43 {
44 {
45 LogConfigurationFactory;
46 registerClassAlias(ConfigurationProvider.FACTORY_CLASS_NAME,LogConfigurationFactory);
47 }
48
49 private static var _this:YuiFrameworkMixin;
50
51 private static var _container:YuiFrameworkContainer;
52
53 public static function init( flexModuleFactory:IFlexModuleFactory ):void{
54
55 LogManager.init();
56
57 _this = new YuiFrameworkMixin();
58 _container = new YuiFrameworkContainer();
59
60 if( flexModuleFactory is ISystemManager ){
61 _container.systemManager = flexModuleFactory as ISystemManager;
62 var systemManager_:ISystemManager = SystemManagerUtil.getRootSystemManager(_container.systemManager);
63
64 systemManager_
65 .addEventListener(
66 Event.ADDED_TO_STAGE,
67 _this.addedToStageHandler,
68 true,
69 int.MAX_VALUE
70 );
71 systemManager_
72 .addEventListener(
73 FlexEvent.APPLICATION_COMPLETE,
74 _this.applicationCompleteHandler,
75 false,
76 int.MAX_VALUE
77 );
78
79 if( systemManager_ != flexModuleFactory ){
80 (flexModuleFactory as ISystemManager)
81 .addEventListener(
82 FlexEvent.APPLICATION_COMPLETE,
83 _this.applicationCompleteHandler,
84 false,
85 int.MAX_VALUE
86 );
87 }
88 }
89 }
90
91 public function set conventions( value:Array ):void{
92 var namingConvention_:NamingConvention = new NamingConvention();
93 namingConvention_.conventions = value;
94 _container.namingConvention = namingConvention_;
95 }
96
97 protected var initialized:Boolean;
98
99 private function addedToStageHandler( event:Event ):void{
100 if( event.target is UIComponent ){
101 _container.registerComponent(event.target as UIComponent);
102 }
103 }
104
105 private function addedHandler( event:Event ):void{
106 if( event.target is UIComponent ){
107 _container.registerComponent(event.target as UIComponent);
108 }
109 }
110
111 private function removedHandler( event:Event ):void{
112 if( event.target is UIComponent ){
113 _container.unregisterComponent(event.target as UIComponent);
114 }
115 }
116
117 private function applicationCompleteHandler( event:FlexEvent ):void{
118 if( event.currentTarget is ISystemManager ){
119 var systemManager_:ISystemManager = SystemManagerUtil.getRootSystemManager(_container.systemManager);
120 systemManager_
121 .removeEventListener(
122 FlexEvent.APPLICATION_COMPLETE,
123 applicationCompleteHandler,
124 false
125 );
126
127 if( systemManager_ != event.currentTarget ){
128 (event.currentTarget as ISystemManager)
129 .removeEventListener(
130 FlexEvent.APPLICATION_COMPLETE,
131 applicationCompleteHandler,
132 false
133 );
134 }
135 systemManager_
136 .removeEventListener(
137 Event.ADDED_TO_STAGE,
138 _this.addedToStageHandler,
139 true
140 );
141 systemManager_
142 .addEventListener(
143 Event.ADDED,
144 _this.addedHandler,
145 true,
146 int.MAX_VALUE
147 );
148 systemManager_
149 .addEventListener(
150 Event.REMOVED_FROM_STAGE,
151 _this.removedHandler,
152 true,
153 int.MAX_VALUE
154 );
155 if( !initialized ){
156 initialized = true;
157 _container.initialize();
158 }
159 }
160 }
161 }
162 }

Properties

Name Value
svn:keywords Author Revision

Repository Top
ViewVC Help  
ViewVC logotype
Powered by ViewVC