This is an automated email from the ASF dual-hosted git repository.

pent pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/MXRoyale by this push:
     new 5415b1a  mx:Application now extends Container; working for HTML/JS. 
Added ApplicationLayout; work in progress.
5415b1a is described below

commit 5415b1aeb809c1858011cb390ea79d46004f6a8a
Author: Peter Ent <[email protected]>
AuthorDate: Tue Mar 20 14:28:25 2018 -0400

    mx:Application now extends Container; working for HTML/JS. Added 
ApplicationLayout; work in progress.
---
 .../src/main/resources/mx-royale-manifest.xml      |   2 +-
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   2 +-
 .../mx/containers/beads/ApplicationLayout.as       | 114 +++++
 .../main/royale/mx/containers/beads/BasicLayout.as | 111 -----
 .../src/main/royale/mx/core/Application.as         | 549 ++++++++++++++-------
 .../src/main/royale/mx/core/ContainerLayout.as     | 136 +++++
 6 files changed, 612 insertions(+), 302 deletions(-)

diff --git 
a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml 
b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
index ad1a1de..1ebfb41 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -34,7 +34,7 @@
        <component id="Container" class="mx.core.Container" />
        <component id="HBox" class="mx.containers.HBox" />
        <component id="VBox" class="mx.containers.VBox" />      
-       <component id="BasicLayout" class="mx.containers.beads.BasicLayout" />
+       <component id="ApplicationLayout" 
class="mx.containers.beads.ApplicationLayout" />
        <component id="BoxLayout" class="mx.containers.beads.BoxLayout" />
        
     <component id="State" class="mx.states.State" />
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as 
b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index 75194bd..a652839 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -29,7 +29,7 @@ internal class MXRoyaleClasses
 {
     import mx.core.UIComponent; UIComponent;
        import mx.core.Container; Container;
-       import mx.containers.beads.BasicLayout; BasicLayout;
+       import mx.containers.beads.ApplicationLayout; ApplicationLayout;
        import mx.containers.beads.BoxLayout; BoxLayout;
 }
 
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/ApplicationLayout.as
 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/ApplicationLayout.as
new file mode 100644
index 0000000..6f9df72
--- /dev/null
+++ 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/ApplicationLayout.as
@@ -0,0 +1,114 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.containers.beads
+{
+
+import mx.core.Container;
+import mx.core.EdgeMetrics;
+import mx.core.IFlexDisplayObject;
+/*
+import mx.core.mx_internal;
+
+use namespace mx_internal;
+*/
+
+
+/**
+ *  @private
+ *  The ApplicationLayout class is for internal use only.
+ */
+public class ApplicationLayout extends BoxLayout
+{
+       
//--------------------------------------------------------------------------
+       //
+       //  Constructor
+       //
+       
//--------------------------------------------------------------------------
+
+       /**
+        *  Constructor.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public function ApplicationLayout()
+       {
+               super();
+       }
+
+       
//--------------------------------------------------------------------------
+       //
+       //  Overridden methods
+       //
+       
//--------------------------------------------------------------------------
+
+       /**
+        *  @private
+        *  Lay out children as per Application layout rules.
+        */
+       override public function updateDisplayList(unscaledWidth:Number,
+                                                                               
           unscaledHeight:Number):Boolean
+       {
+               if (!super.updateDisplayList(unscaledWidth, unscaledHeight)) 
return false;
+               
+               var target:Container = super.target;
+
+               // If there are scrollbars, and any children are at negative
+               // co-ordinates, make adjustments to bring them into the 
visible area.
+               if ((getHorizontalAlignValue() > 0) ||
+                       (getVerticalAlignValue() > 0))
+               {
+                       var paddingLeft:Number = target.getStyle("paddingLeft");
+                       var paddingTop:Number = target.getStyle("paddingTop");
+                       var oX:Number = 0;
+                       var oY:Number = 0;
+
+                       var n:int = target.numChildren;
+                       var i:int;
+                       var child:IFlexDisplayObject;
+
+                       for (i = 0; i < n; i++)
+                       {
+                               child = 
IFlexDisplayObject(target.getChildAt(i));
+
+                               if (child.x < paddingLeft)
+                                       oX = Math.max(oX, paddingLeft - 
child.x);
+
+                               if (child.y < paddingTop)
+                                       oY = Math.max(oY, paddingTop - child.y);
+                       }
+
+                       if (oX != 0 || oY != 0)
+                       {
+                               for (i = 0; i < n; i++)
+                               {
+                                       child = 
IFlexDisplayObject(target.getChildAt(i));
+                                       child.move(child.x + oX, child.y + oY);
+                               }
+                       }
+               }
+               
+               return true;
+       }
+}
+
+}
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BasicLayout.as
 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BasicLayout.as
deleted file mode 100644
index 8606de9..0000000
--- 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BasicLayout.as
+++ /dev/null
@@ -1,111 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package mx.containers.beads
-{
-       import mx.core.Container;
-       import mx.core.EdgeMetrics;
-       import mx.core.IUIComponent;
-       
-       import org.apache.royale.core.IStrand;
-       import org.apache.royale.core.LayoutBase;
-       
-       public class BasicLayout extends LayoutBase
-       {
-               public function BasicLayout()
-               {
-                       super();
-               }
-               
-               
//--------------------------------------------------------------------------
-               //
-               //  Properties
-               //
-               
//--------------------------------------------------------------------------
-               
-               private var _strand:IStrand;
-               
-               override public function set strand(value:IStrand):void
-               {
-                       _strand = value;
-                       _target = value as Container;
-                       super.strand = value;
-                       
-               }
-               
-               private var _target:Container;
-               
-               public function get target():Container
-               {
-                       return _target;
-               }
-               
-               public function set target(value:Container):void
-               {
-                       _target = value;
-               }
-               
-               override public function layout():Boolean
-               {
-                       var testWidth:Number = 
target.getExplicitOrMeasuredWidth();
-                       var testHeight:Number = 
target.getExplicitOrMeasuredHeight();
-                       trace("Before layout: width="+testWidth+"; 
height="+testHeight);
-                       if (updateDisplayList(target.width, target.height)) {
-                               testWidth = target.getExplicitOrMeasuredWidth();
-                               testHeight = 
target.getExplicitOrMeasuredHeight();
-                               //???   target.setActualSize(testWidth, 
testHeight);
-                               trace("After layout: width="+target.width+"; 
height="+target.height);
-                               
-                       }
-                       return true;
-               }
-               
-               /**
-                *  @private
-                *  Lay out the children using their x, y positions
-                */
-               public function updateDisplayList(unscaledWidth:Number,
-                                                                               
  unscaledHeight:Number):Boolean
-               {                       
-                       var n:int = target.numChildren;
-                       if (n == 0)
-                               return false;
-                       
-                       COMPILE::JS {
-                               if (target.positioner.style.position != 
'absolute' || target.positioner.style.position != 'relative') {
-                                       target.positioner.style.position = 
'relative';
-                               }
-                       }
-                       
-                       var i:int;
-                       var obj:Object;
-                       
-                       for(i=0; i < n; i++) {
-                               obj = target.getLayoutChildAt(i);
-                               if (obj.includeInLayout) {
-                                       COMPILE::JS {
-                                               obj.positioner.style.position = 
'absolute';
-                                       }
-                               }
-                       }
-                       
-                       return true;
-               }
-       }
-}
\ No newline at end of file
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
index 5a1f366..a533e65 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
@@ -52,10 +52,37 @@ import mx.utils.Platform;
 
 use namespace mx_internal;
 */
+COMPILE::SWF {
+import flash.events.Event;
+import flash.display.DisplayObject;
+import flash.display.StageAlign;
+import flash.display.StageQuality;
+import flash.display.StageScaleMode;
+import org.apache.royale.events.utils.MouseEventConverter;
+}
+
+import mx.containers.beads.ApplicationLayout;
+import mx.containers.beads.BoxLayout;
+
+import org.apache.royale.binding.ApplicationDataBinding;
+import org.apache.royale.core.AllCSSValuesImpl;
+import org.apache.royale.core.IBead;
+import org.apache.royale.core.IBeadLayout;
+import org.apache.royale.core.IInitialViewApplication;
+import org.apache.royale.core.ILayoutChild;
+import org.apache.royale.core.IParent;
+import org.apache.royale.core.IPopUpHost;
+import org.apache.royale.core.IRenderedObject;
 import org.apache.royale.core.IStatesImpl;
+import org.apache.royale.core.IStrand;
+import org.apache.royale.core.IValuesImpl;
+import org.apache.royale.core.ValuesManager;
+import org.apache.royale.events.Event;
+import org.apache.royale.events.IEventDispatcher;
 import org.apache.royale.events.ValueChangeEvent;
-import org.apache.royale.express.Application;
 import org.apache.royale.states.State;
+import org.apache.royale.utils.MXMLDataInterpreter;
+import org.apache.royale.utils.Timer;
 import org.apache.royale.utils.loadBeadFromValuesManager;
     
 //--------------------------------------
@@ -203,7 +230,7 @@ import org.apache.royale.utils.loadBeadFromValuesManager;
  *  @playerversion AIR 1.1
  *  @productversion Flex 3
  */
-public class Application extends org.apache.royale.express.Application
+public class Application extends Container implements IStrand, IParent, 
IEventDispatcher, IPopUpHost, IRenderedObject
 {
 
     
//--------------------------------------------------------------------------
@@ -272,202 +299,346 @@ public class Application extends 
org.apache.royale.express.Application
             FlexGlobals.topLevelApplication = this;
 
         super();
+               
+               COMPILE::SWF {
+                       if (stage)
+                       {
+                               stage.align = StageAlign.TOP_LEFT;
+                               stage.scaleMode = StageScaleMode.NO_SCALE;
+                               // should be opt-in
+                               //stage.quality = 
StageQuality.HIGH_16X16_LINEAR;
+                       }
+                       
+                       loaderInfo.addEventListener(flash.events.Event.INIT, 
initHandler);
+               }
+               COMPILE::JS {
+                       element.className = 'Application';                      
+               }
+               
+               this.valuesImpl = new AllCSSValuesImpl();
+               addBead(new ApplicationDataBinding());
+               addBead(new ApplicationLayout());
 
         instanceParent = this;
     }
-
-    
//--------------------------------------------------------------------------
-    //
-    //  Variables
-    //
-    
//--------------------------------------------------------------------------
        
-       private var instanceParent:mx.core.Application;
-
-    /**
-     *  @private
-     */
-    override protected function initialize():void
-    {
-        initManagers();
-        super.initialize();
-    }
-    
-    /**
-     *  @private
-     */
-    private function initManagers():void
-    {
-        // install FocusManager
-    }
-
-    /**
-     *  @copy org.apache.royale.core.ItemRendererClassFactory#mxmlContent
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion Royale 0.8
-     * 
-     *  @royalesuppresspublicvarwarning
-     */
-    public var mxmlContent:Array;
-
-    /**
-     *  Number of pixels between the container's top border
-     *  and the top of its content area.
-     *
-     *  @default 0
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get paddingTop():Object
-    {
-        if (GOOG::DEBUG)
-            trace("paddingTop not implemented");
-        return 0;
-    }
-    public function set paddingTop(value:Object):void
-    {
-        if (GOOG::DEBUG)
-            trace("paddingTop not implemented");
-    }
-    
-    /**
-     *  Number of pixels between the container's bottom border
-     *  and the bottom of its content area.
-     *
-     *  @default 0
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get paddingBottom():Object
-    {
-        if (GOOG::DEBUG)
-            trace("paddingBottom not implemented");
-        return 0;
-    }
-    public function set paddingBottom(value:Object):void
-    {
-        if (GOOG::DEBUG)
-            trace("paddingBottom not implemented");
-    }
-    
-    /**
-     *  Number of pixels between children in the vertical direction.
-     *  The default value depends on the component class;
-     *  if not overridden for the class, the default value is 6.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get verticalGap():Object
-    {
-        if (GOOG::DEBUG)
-            trace("verticalGap not implemented");
-        return 0;
-    }
-    public function set verticalGap(value:Object):void
+       COMPILE::SWF
+       private function initHandler(event:flash.events.Event):void
+       {
+               if (model is IBead) addBead(model as IBead);
+               if (controller is IBead) addBead(controller as IBead);
+               
+               MouseEventConverter.setupAllConverters(stage);
+               
+               for each (var bead:IBead in beads)
+               addBead(bead);
+               
+               dispatchEvent(new org.apache.royale.events.Event("beadsAdded"));
+               
+               if (dispatchEvent(new 
org.apache.royale.events.Event("preinitialize", false, true)))
+                       this.initialize();
+               else
+                       addEventListener(flash.events.Event.ENTER_FRAME, 
enterFrameHandler);
+               
+       }
+       
+       COMPILE::SWF
+       private function enterFrameHandler(event:flash.events.Event):void
+       {
+               if (dispatchEvent(new 
org.apache.royale.events.Event("preinitialize", false, true)))
+               {
+                       removeEventListener(flash.events.Event.ENTER_FRAME, 
enterFrameHandler);
+                       this.initialize();
+               }
+       }
+       
+       /**
+        *  This method gets called when all preinitialize handlers
+        *  no longer call preventDefault();
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.0
+        */
+    COMPILE::SWF
+    override public function initialize():void
     {
-        if (GOOG::DEBUG)
-            trace("verticalGap not implemented");
-    }
+        MXMLDataInterpreter.generateMXMLInstances(this, instanceParent, 
MXMLDescriptor);
+               
+               this.initManagers();
 
-    private var _states:Array;
-    
-    /**
-     *  The array of view states. These should
-     *  be instances of org.apache.royale.states.State.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion Royale 0.8
-     */
-    public function get states():Array
-    {
-        return _states;
-    }
-    
-    /**
-     *  @private
-     *  @royaleignorecoercion Class
-     *  @royaleignorecoercion org.apache.royale.core.IBead
-     */
-    public function set states(value:Array):void
-    {
-        _states = value;
-        _currentState = _states[0].name;
-        
-        try{
-            loadBeadFromValuesManager(IStatesImpl, "iStatesImpl", this);
-        }
-        //TODO:  Need to handle this case more gracefully
-        catch(e:Error)
-        {
-            COMPILE::SWF
-                {
-                    trace(e.message);                        
-                }
-        }
-        
-    }
-    
-    /**
-     *  <code>true</code> if the array of states
-     *  contains a state with this name.
-     * 
-     *  @param state The state namem.
-     *  @return True if state in state array
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion Royale 0.8
-     */
-    public function hasState(state:String):Boolean
-    {
-        for each (var s:State in _states)
-        {
-            if (s.name == state)
-                return true;
-        }
-        return false;
-    }
-    
-    private var _currentState:String;
-    
-    [Bindable("currentStateChange")]
-    /**
-     *  The name of the current state.
-     * 
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion Royale 0.8
-     */
-    public function get currentState():String
-    {
-        return _currentState;   
+        dispatchEvent(new org.apache.royale.events.Event("initialize"));
+        dispatchEvent(new 
org.apache.royale.events.Event("applicationComplete"));
     }
-    
-    /**
-     *  @private
-     */
-    public function set currentState(value:String):void
+       
+       
//--------------------------------------------------------------------------
+       //
+       //  Variables
+       //
+       
//--------------------------------------------------------------------------
+       
+       /**
+        *  The org.apache.royale.core.IValuesImpl that will
+        *  determine the default values and other values
+        *  for the application.  The most common choice
+        *  is org.apache.royale.core.SimpleCSSValuesImpl.
+        *
+        *  @see org.apache.royale.core.SimpleCSSValuesImpl
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.0
+        */
+    public function set valuesImpl(value:IValuesImpl):void
     {
-        var event:ValueChangeEvent = new 
ValueChangeEvent("currentStateChange", false, false, _currentState, value)
-        _currentState = value;
-        dispatchEvent(event);
+        ValuesManager.valuesImpl = value;
+        ValuesManager.valuesImpl.init(this);
     }
+       
+       private var instanceParent:mx.core.Application;
+       
+       //----------------------------------
+       // model
+       //----------------------------------
+       
+       /**
+        *  The data model (for the initial view).
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.0
+        */     
+       COMPILE::JS
+       private var _model:Object;
+       
+       /**
+        *  The data model (for the initial view).
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.0
+        */
+       [Bindable("__NoChangeEvent__")]
+       COMPILE::JS
+       override public function get model():Object
+       {
+               return _model;
+       }
+       
+       /**
+        *  @private
+        */
+       [Bindable("__NoChangeEvent__")]
+       COMPILE::JS
+       override public function set model(value:Object):void
+       {
+               _model = value;
+       }
+       
+       //----------------------------------
+       // controller
+       //----------------------------------
+       
+       private var _controller:Object;
+       
+       /**
+        *  The controller.  The controller typically watches
+        *  the UI for events and updates the model accordingly.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.0
+        */
+       [Bindable("__NoChangeEvent__")]
+       public function get controller():Object
+       {
+               return _controller;
+       }
+       
+       /**
+        *  @private
+        */
+       [Bindable("__NoChangeEvent__")]
+       public function set controller(value:Object):void
+       {
+               _controller = value;
+       }
+       
+       //----------------------------------
+       //  layout
+       //----------------------------------
+       
+       /**
+        *  @private
+        *  Storage for layout property.
+        */
+       private var _layout:String = ContainerLayout.VERTICAL;
+       
+       [Bindable("layoutChanged")]
+       [Inspectable(category="General", 
enumeration="vertical,horizontal,absolute", defaultValue="vertical")]
+       
+       /**
+        *  Specifies the layout mechanism used for this application. 
+        *  Applications can use <code>"vertical"</code>, 
<code>"horizontal"</code>, 
+        *  or <code>"absolute"</code> positioning. 
+        *  Vertical positioning lays out each child component vertically from
+        *  the top of the application to the bottom in the specified order.
+        *  Horizontal positioning lays out each child component horizontally
+        *  from the left of the application to the right in the specified 
order.
+        *  Absolute positioning does no automatic layout and requires you to
+        *  explicitly define the location of each child component. 
+        *
+        *  @default "vertical"
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public function get layout():String
+       {
+               return _layout;
+       }
+       
+       /**
+        *  @private
+        */
+       public function set layout(value:String):void
+       {
+               if (value != _layout) {
+                       // do something here - find the right bead, remove the 
old bead??
+                       var layoutBead:IBeadLayout = getBeadByType(IBeadLayout) 
as IBeadLayout;
+                       if (layoutBead is BoxLayout) {
+                               (layoutBead as BoxLayout).direction = value;
+                       }
+               }
+       }
+               
+       
//--------------------------------------------------------------------------
+       //
+       //  Initialization and Start-up
+       //
+       
//--------------------------------------------------------------------------
+       
+       /**
+        *  @private
+        */
+       private function initManagers():void
+       {
+               // install FocusManager
+       }
+       
+       /**
+        * @return {Object} The array of children.
+        */
+       COMPILE::JS
+       protected function internalChildren():NodeList
+       {
+               return element.childNodes;
+       };
+       
+       COMPILE::JS
+       protected var startupTimer:Timer;
+       
+       /**
+        * @royaleignorecoercion org.apache.royale.core.IBead
+        */
+       COMPILE::JS
+       public function start():void
+       {
+               if (model is IBead) addBead(model as IBead);
+               if (controller is IBead) addBead(controller as IBead);
+               
+               for (var index:int in beads) {
+                       addBead(beads[index]);
+               }
+               
+               dispatchEvent(new org.apache.royale.events.Event("beadsAdded"));
+               
+               if (dispatchEvent(new 
org.apache.royale.events.Event("preinitialize", false, true)))
+                       initialize();
+               else {                  
+                       startupTimer = new Timer(34, 0);
+                       startupTimer.addEventListener("timer", 
handleStartupTimer);
+                       startupTimer.start();
+               }
+       }
+       
+       /**
+        * @private
+        */
+       COMPILE::JS
+       protected function handleStartupTimer(event:Event):void
+       {
+               if (dispatchEvent(new 
org.apache.royale.events.Event("preinitialize", false, true)))
+               {
+                       startupTimer.stop();
+                       initialize();
+               }
+       }
+       
+       /**
+        * @royaleignorecoercion org.apache.royale.core.IBead
+        */
+       COMPILE::JS
+       override public function initialize():void
+       {
+               var body:HTMLElement = document.getElementsByTagName('body')[0];
+               body.appendChild(element);
+               
+               MXMLDataInterpreter.generateMXMLInstances(this, instanceParent, 
MXMLDescriptor);
+               
+               dispatchEvent('initialize');
+               
+//             if (initialView)
+//             {
+//            initialView.applicationModel = model;
+//            addElement(initialView);
+//            
+//                     var baseView:UIBase = initialView as UIBase;
+//                     if (!isNaN(baseView.percentWidth) || 
!isNaN(baseView.percentHeight)) {
+//                             this.element.style.height = 
window.innerHeight.toString() + 'px';
+//                             this.element.style.width = 
window.innerWidth.toString() + 'px';
+//                             this.initialView.dispatchEvent('sizeChanged'); 
// kick off layout if % sizes
+//                     }
+//                     
+//                     dispatchEvent(new 
org.apache.royale.events.Event("viewChanged"));
+//             }
+               dispatchEvent(new 
org.apache.royale.events.Event("applicationComplete"));
+       }
+       
+       
//--------------------------------------------------------------------------
+       //
+       //  Other overrides
+       //
+       
//--------------------------------------------------------------------------
+       
+       COMPILE::SWF
+       override public function get $displayObject():DisplayObject
+       {
+               return this;
+       }
+       
+       COMPILE::SWF
+       override public function set width(value:Number):void
+       {
+               // just eat this.  
+               // The stageWidth will be set by SWF metadata. 
+               // Setting this directly doesn't do anything
+       }
+       
+       COMPILE::SWF
+       override public function set height(value:Number):void
+       {
+               // just eat this.  
+               // The stageWidth will be set by SWF metadata. 
+               // Setting this directly doesn't do anything
+       }
 
 }
 
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/core/ContainerLayout.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ContainerLayout.as
new file mode 100644
index 0000000..676f9de
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ContainerLayout.as
@@ -0,0 +1,136 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.core
+{
+       
+/**
+ *  The ContainerLayout class defines the constant values
+ *  for the <code>layout</code> property of container classes.
+ *
+ *  @see mx.containers.Panel#layout
+ *  @see mx.core.Application#layout
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public final class ContainerLayout
+{
+       
//--------------------------------------------------------------------------
+       //
+       //  Class constants
+       //
+       
//--------------------------------------------------------------------------
+
+       /**
+        *  Use absolute layout for the contents of this container.
+        *  You are responsible for explicitly specifying the position
+        *  of each child.
+        *
+        *  <p>The easiest way to do this is to specify
+        *  the <code>x</code>, <code>y</code>, <code>width</code>,
+        *  and <code>height</code> of each child.</p>
+        *
+        *  <p>The <code>width</code> and <code>height</code> can be specified
+        *  as a percentage value in MXML.
+        *  (In ActionScript you have to set the <code>percentWidth</code>
+        *  and <code>percentHeight</code> properties.)</p>
+        *
+        *  <p>If you don't specify the <code>width</code> or
+        *  <code>percentWidth</code> for a child, 
+        *  then its <code>measuredWidth</code>, as automatically determined
+        *  by its <code>measure()</code> method, will be used.
+        *  The same applies for its height.</p>
+        *
+        *  <p>As an alternative way of doing layout, you can use the anchor
+        *  styles <code>left</code>, <code>top</code>, <code>right </code>,
+        *  <code>bottom</code>, <code>horizontalCenter</code>,
+        *  and <code>verticalCenter</code> on children to anchor them to
+        *  the sides or the center of a container.</p>
+        *
+        *  <p>When you use absolute layout, the container's
+        *  <code>paddingLeft</code>, <code>paddingTop</code>,
+        *  <code>paddingRight</code>, <code>paddingBottom</code>,
+        *  <code>horizontalGap</code>, <code>verticalGap</code>,
+        *  <code>horizontalAlign</code>, and<code>verticalAlign</code>
+        *  styles are ignored.</p> 
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static const ABSOLUTE:String = "absolute";
+       
+       /**
+        *  Use vertical layout for the contents of this container.
+        *  The container will automatically place its children in a single 
column.
+        *
+        *  <p>If you don't specify the <code>width</code> or
+        *  <code>percentWidth</code> for a child, 
+        *  then its <code>measuredWidth</code>, as automatically determined
+        *  by its <code>measure()</code> method, is used.
+        *  The same applies for its height.</p>
+        *
+        *  <p>You can control the spacing between children
+        *  with the <code>verticalGap</code> style,
+        *  and the alignment of the children
+        *  with the <code>horizontalAlign</code> style.
+        *  The <code>paddingLeft</code>, <code>paddingTop</code>,
+        *  <code>paddingRight</code>, and <code>paddingBottom</code> styles
+        *  control the space between the border of the container
+        *  and the children.</p>
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static const VERTICAL:String = "vertical";
+
+       /**
+        *  Use horizontal layout for the contents of this container.
+        *  The container will automatically place its children in a single row.
+        *
+        *  <p>If you don't specify the <code>width</code> or
+        *  <code>percentWidth</code> for a child, 
+        *  then its <code>measuredWidth</code>, as automatically determined
+        *  by its <code>measure()</code> method, is used.
+        *  The same applies for its height.</p>
+        *
+        *  <p>You can control the spacing between children
+        *  with the <code>horizontalGap</code> style,
+        *  and the alignment of the children
+        *  with the <code>verticalAlign</code> style.
+        *  The <code>paddingLeft</code>, <code>paddingTop</code>,
+        *  <code>paddingRight</code>, and <code>paddingBottom</code> styles
+        *  control the space between the border of the container
+        *  and the children.</p>
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static const HORIZONTAL:String = "horizontal";
+}
+
+}

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to