利用者向け情報

開発者向け情報

[sandbox.akabana]/trunk/yui-frameworks/yui-air-flex4/src/main/flex/jp/akb7/yui/air/YuiWindowedApplication.as

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1660 - (hide annotations)
Sun Jul 24 12:44:20 2011 JST (21 months, 3 weeks ago) by e1arkw
Original Path: trunk/yui/yui-air-flex4/src/main/flex/org/seasar/akabana/yui/air/YuiWindowedApplication.as
File size: 3016 byte(s)
ソースコード 整理しました。
1 e1arkw 1232 /*
2 e1arkw 1505 * Copyright 2004-2011 the Seasar Foundation and the Others.
3 e1arkw 1232 *
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 e1arkw 1225 package org.seasar.akabana.yui.air
17     {
18 e1arkw 1305 import flash.events.Event;
19    
20     import mx.core.UIComponent;
21     import mx.events.AIREvent;
22    
23 e1arkw 1516 import org.seasar.akabana.yui.framework.YuiApplicationConsts;
24 e1arkw 1305 import org.seasar.akabana.yui.framework.core.YuiFrameworkSettings;
25 e1arkw 1482 import org.seasar.akabana.yui.framework.error.YuiFrameworkError;
26 e1arkw 1516 import org.seasar.akabana.yui.framework.logging.debug;
27 e1arkw 1305
28     import spark.components.WindowedApplication;
29    
30     [Style(name="rootViewClass", type="Class")]
31 e1arkw 1660 public class YuiWindowedApplication extends WindowedApplication {
32    
33     private static const ROOT_VIEW_CLASS:String = "rootViewClass";
34    
35     private static const ROOT_VIEW:String = "rootView";
36    
37 e1arkw 1305 private var _setting:YuiFrameworkSettings;
38    
39     public function get setting():YuiFrameworkSettings{
40     return _setting;
41     }
42    
43     private var _rootView:UIComponent;
44    
45     public function get rootView():UIComponent{
46     return _rootView;
47     }
48    
49 e1arkw 1660 public function YuiWindowedApplication(){
50 e1arkw 1305 super();
51     _setting = new YuiFrameworkSettings();
52     }
53 e1arkw 1233
54 e1arkw 1660 public override function dispatchEvent(event:Event):Boolean{
55 e1arkw 1516 var result:Boolean = super.dispatchEvent(event);
56     if( !(event.type in YuiApplicationConsts.UNRECOMMEND_EVENT_MAP)){
57     if( result ){
58     if( initialized && _rootView != null && _rootView.initialized ){
59     result = _rootView.dispatchEvent(event);
60     }
61     }
62 e1arkw 1305 }
63 e1arkw 1516 return result;
64 e1arkw 1305 }
65    
66 e1arkw 1477 protected override function createChildren():void{
67     super.createChildren();
68 e1arkw 1305
69     createRootView();
70     }
71    
72     protected function createRootView():void{
73 e1arkw 1660 var viewClass:Class = getStyle(ROOT_VIEW_CLASS) as Class;
74 e1arkw 1305
75     if( viewClass == null ){
76 e1arkw 1482 throw new YuiFrameworkError("rootViewClass style is needed.");
77 e1arkw 1305 } else {
78     _rootView = new viewClass();
79 e1arkw 1660 _rootView.name = ROOT_VIEW;
80 e1arkw 1305 _rootView.setVisible(false,true);
81     addElement(_rootView);
82     }
83     }
84     }
85 e1arkw 1225 }

Repository Top
ViewVC Help  
ViewVC logotype
Powered by ViewVC