| 1 |
/* |
/* |
| 2 |
* Copyright 2004-2008 the Seasar Foundation and the Others. |
* Copyright 2004-2011 the Seasar Foundation and the Others. |
| 3 |
* |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
* you may not use this file except in compliance with the License. |
| 9 |
* |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
| 13 |
* either express or implied. See the License for the specific language |
* either express or implied. See the License for the specific language |
| 14 |
* governing permissions and limitations under the License. |
* governing permissions and limitations under the License. |
| 15 |
*/ |
*/ |
| 16 |
package org.seasar.akabana.yui.framework.mixin |
package org.seasar.akabana.yui.framework.core.mixin |
| 17 |
{ |
{ |
| 18 |
|
CONFIG::FP10{ |
| 19 |
import flash.events.Event; |
import __AS3__.vec.Vector; |
| 20 |
import flash.net.registerClassAlias; |
} |
| 21 |
|
import flash.net.registerClassAlias; |
| 22 |
import mx.core.ClassFactory; |
import flash.display.DisplayObject; |
| 23 |
import mx.core.IFactory; |
|
| 24 |
import mx.core.IFlexModuleFactory; |
import mx.core.IFlexModuleFactory; |
| 25 |
import mx.managers.ISystemManager; |
import mx.managers.ISystemManager; |
| 26 |
import mx.resources.ResourceManager; |
|
| 27 |
import mx.styles.CSSStyleDeclaration; |
import org.seasar.akabana.yui.core.ns.yui_internal; |
| 28 |
import mx.styles.StyleManager; |
import org.seasar.akabana.yui.framework.YuiFrameworkGlobals; |
| 29 |
|
import org.seasar.akabana.yui.framework.bridge.FrameworkBridge; |
| 30 |
import org.seasar.akabana.yui.core.yui_internal; |
import org.seasar.akabana.yui.framework.core.YuiFrameworkController; |
| 31 |
import org.seasar.akabana.yui.framework.YuiFrameworkGlobals; |
|
| 32 |
import org.seasar.akabana.yui.framework.bridge.FrameworkBridge; |
[ExcludeClass] |
| 33 |
import org.seasar.akabana.yui.framework.convention.NamingConvention; |
[Mixin] |
| 34 |
import org.seasar.akabana.yui.framework.core.YuiFrameworkContainer; |
[ResourceBundle("conventions")] |
| 35 |
import org.seasar.akabana.yui.framework.core.event.FrameworkEvent; |
/** |
| 36 |
import org.seasar.akabana.yui.logging.LogManager; |
* YuiFramework初期設定用Mixinクラス |
| 37 |
import org.seasar.akabana.yui.logging.config.ConfigurationProvider; |
* |
| 38 |
import org.seasar.akabana.yui.logging.config.factory.LogConfigurationFactory; |
* @author $Author$ |
| 39 |
|
* @version $Revision$ |
| 40 |
[Mixin] |
*/ |
| 41 |
[ResourceBundle("conventions")] |
public final class YuiFrameworkMixin |
| 42 |
/** |
{ |
| 43 |
* YuiFramework初期設定用Mixinクラス |
|
| 44 |
* |
private static var _this:YuiFrameworkMixin; |
| 45 |
* @author $Author$ |
|
| 46 |
* @version $Revision$ |
private static var _container:YuiFrameworkController; |
| 47 |
*/ |
|
| 48 |
public class YuiFrameworkMixin |
public static function init( flexModuleFactory:IFlexModuleFactory ):void{ |
|
{ |
|
|
{ |
|
|
LogConfigurationFactory; |
|
|
registerClassAlias(ConfigurationProvider.FACTORY_CLASS_NAME,LogConfigurationFactory); |
|
|
} |
|
|
|
|
|
private static var _this:YuiFrameworkMixin; |
|
|
|
|
|
private static var _container:YuiFrameworkContainer; |
|
|
|
|
|
private static var _namingConventionClassFactory:IFactory; |
|
|
|
|
|
public static function init( flexModuleFactory:IFlexModuleFactory ):void{ |
|
|
LogManager.init(); |
|
|
|
|
| 49 |
_this = new YuiFrameworkMixin(); |
_this = new YuiFrameworkMixin(); |
| 50 |
_container = new YuiFrameworkContainer(); |
_container = new YuiFrameworkController(); |
| 51 |
YuiFrameworkGlobals.yui_internal::frameworkBridge = FrameworkBridge.initialize(); |
YuiFrameworkGlobals.yui_internal::setFrameworkBridge( FrameworkBridge.initialize() ); |
| 52 |
|
|
| 53 |
if( flexModuleFactory is ISystemManager ){ |
if( flexModuleFactory is ISystemManager ){ |
| 54 |
var systemManager_:ISystemManager = flexModuleFactory as ISystemManager; |
var systemManager_:ISystemManager = flexModuleFactory as ISystemManager; |
| 55 |
|
var root:DisplayObject = systemManager_ as DisplayObject; |
| 56 |
systemManager_ |
_container.yui_internal::systemManagerMonitoringStart(root); |
|
.addEventListener( |
|
|
FrameworkEvent.APPLICATION_MONITOR_START, |
|
|
applicationMonitorStartHandler, |
|
|
false, |
|
|
int.MAX_VALUE |
|
|
); |
|
|
_container.yui_internal::monitoringSystemManager(systemManager_); |
|
| 57 |
} |
} |
| 58 |
} |
} |
| 59 |
|
} |
|
protected static function applicationMonitorStartHandler(event:Event):void{ |
|
|
initNamingConventionClassFactory(); |
|
|
initNamingConvention(); |
|
|
} |
|
|
|
|
|
protected static function initNamingConvention():void{ |
|
|
var namingConvention:NamingConvention = _namingConventionClassFactory.newInstance() as NamingConvention; |
|
|
namingConvention.conventions = ResourceManager.getInstance().getStringArray("conventions","package"); |
|
|
YuiFrameworkGlobals.yui_internal::namingConvention = namingConvention; |
|
|
} |
|
|
|
|
|
protected static function initNamingConventionClassFactory():void{ |
|
|
var namingConventionClassFactoryDef:CSSStyleDeclaration = StyleManager.getStyleDeclaration("org.seasar.akabana.yui.framework.core.YuiFrameworkSettings"); |
|
|
if( namingConventionClassFactoryDef == null ){ |
|
|
_namingConventionClassFactory = new ClassFactory(NamingConvention); |
|
|
} else { |
|
|
var classFactory:Class = namingConventionClassFactoryDef.getStyle("namingConventionClass") as Class; |
|
|
_namingConventionClassFactory = new ClassFactory(classFactory); |
|
|
} |
|
|
} |
|
|
} |
|
| 60 |
} |
} |