flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [35/37] git commit: [flex-asjs] [refs/heads/spark] - copy of many flex-sdk classes, modified to try to compile on top of the FlexJS base classes. A COMPILE::LATER flag is used to comment out features like multi-swf support and a few other features that
Date Sat, 13 Feb 2016 00:14:42 GMT
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/controls/ToolTip.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/controls/ToolTip.as b/frameworks/projects/MX/src/main/flex/mx/controls/ToolTip.as
new file mode 100644
index 0000000..f6a4b9f
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/controls/ToolTip.as
@@ -0,0 +1,515 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.controls
+{
+
+import flash.display.DisplayObject;
+import flash.text.TextFieldAutoSize;
+import flash.text.TextFormat;
+import mx.core.EdgeMetrics;
+import mx.core.IFlexDisplayObject;
+import mx.core.IFlexModuleFactory;
+import mx.core.IFontContextComponent;
+import mx.core.IRectangularBorder;
+import mx.core.IToolTip;
+import mx.core.IUITextField;
+import mx.core.UIComponent;
+import mx.core.UITextField;
+import mx.core.mx_internal;
+import mx.styles.ISimpleStyleClient;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  Styles
+//-------------------------------------- 
+
+/*
+    Note: ToolTip is affected by the following styles:
+
+    backgroundColor
+    borderColor
+    borderStyle
+    color
+    fontFamily
+    fontSize
+    fontStyle
+    fontWidth
+    paddingBottom
+    paddingLeft
+    paddingRight
+    paddingTop
+    shadowColor (when borderStyle is "toolTip")
+    textAlign
+    textDecoration
+*/
+
+include "../styles/metadata/ContainerBackgroundStyles.as"
+include "../styles/metadata/BorderStyles.as"
+include "../styles/metadata/LeadingStyle.as"
+include "../styles/metadata/PaddingStyles.as"
+include "../styles/metadata/TextStyles.as"
+
+/**
+ *  Radius of component corners.
+ *  
+ *  @default 2
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+[Style(name="cornerRadius", type="Number", format="Length", inherit="no", theme="halo, spark, mobile")]
+
+/**
+ *  Number of pixels between the container's bottom border and its content area.
+ *  The default value is -1, so the bottom border of the last header
+ *  overlaps the Accordion container's bottom border.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+[Style(name="paddingBottom", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Number of pixels between the container's top border and its content area.
+ *  The default value is -1, so the top border of the first header
+ *  overlaps the Accordion container's top border.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+[Style(name="paddingTop", type="Number", format="Length", inherit="no")]
+
+/**
+ * Because this component does not define a skin for the mobile theme, Adobe
+ * recommends that you not use it in a mobile application. Alternatively, you
+ * can define your own mobile skin for the component. For more information,
+ * see <a href="http://help.adobe.com/en_US/flex/mobileapps/WS19f279b149e7481c698e85712b3011fe73-8000.html">Basics of mobile skinning</a>.
+ */
+[DiscouragedForProfile("mobileDevice")]
+
+/**
+ *  The ToolTip control lets you provide helpful information to your users.
+ *  When a user moves the mouse pointer over a graphical component, the ToolTip
+ *  control pops up and displays text that provides information about the
+ *  component.
+ *  You can use ToolTips to guide users as they work with your application
+ *  or customize the ToolTip controls to provide additional functionality.
+ *
+ *  @see mx.managers.ToolTipManager
+ *  @see mx.styles.CSSStyleDeclaration
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class ToolTip extends UIComponent implements IToolTip, IFontContextComponent
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class properties
+    //
+    //--------------------------------------------------------------------------
+
+    [Inspectable(category="Other")]
+    
+    /**
+     *  Maximum width in pixels for new ToolTip controls.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static var maxWidth:Number = 300;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function ToolTip()
+    {
+        super();
+
+        // InteractiveObject variables.
+        // Make the ToolTip invisible to the mouse so that it doesn't
+        // interfere with the ToolTipManager's mouse-tracking.
+        mouseEnabled = false;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  The internal object that draws the border.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    mx_internal var border:IFlexDisplayObject;
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  borderMetrics
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private function get borderMetrics():EdgeMetrics
+    {
+        if (border is IRectangularBorder)
+            return IRectangularBorder(border).borderMetrics;
+
+        return EdgeMetrics.EMPTY;
+    }
+
+    //----------------------------------
+    //  fontContext
+    //----------------------------------
+    
+    /**
+     *  @private 
+     */
+    public function get fontContext():IFlexModuleFactory
+    {
+        return moduleFactory;
+    }
+
+    /**
+     *  @private
+     */
+    public function set fontContext(moduleFactory:IFlexModuleFactory):void
+    {
+        this.moduleFactory = moduleFactory;
+    }
+    
+    //----------------------------------
+    //  text
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the text property.
+     */
+    private var _text:String;
+
+    /**
+     *  @private
+     */
+    private var textChanged:Boolean;
+
+    /**
+     *  The text displayed by the ToolTip.
+     *
+     *  @default null
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get text():String
+    {
+        return _text;
+    }
+
+    /**
+     *  @private
+     */
+    public function set text(value:String):void
+    {
+        _text = value;
+        textChanged = true;
+
+        invalidateProperties();
+        invalidateSize();
+        invalidateDisplayList();
+    }
+
+    //----------------------------------
+    //  textField
+    //----------------------------------
+
+    /**
+     *  The internal UITextField that renders the text of this ToolTip.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected var textField:IUITextField;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function createChildren():void
+    {
+        super.createChildren();
+
+        // Create the border/background.
+        createBorder();
+
+        // Create the TextField that displays the tooltip text.
+        createTextField(-1);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function commitProperties():void
+    {
+        super.commitProperties();
+
+        // if the font changed and we already created the label, we will need to 
+        // destory it so it can be re-created, possibly in a different swf context.
+        if (hasFontContextChanged() && textField != null)
+        {
+            var index:int = getChildIndex(DisplayObject(textField));
+            removeTextField();
+            createTextField(index);
+            invalidateSize();
+            textChanged = true;
+        }
+
+        if (textChanged)
+        {
+            // In general, we want the ToolTip style to be applied.
+            // However, we don't want leftMargin and rightMargin
+            // of the TextField's TextFormat to be set to the
+            // paddingLeft and paddingRight of the ToolTip style.
+            // We want these styles to affect the space between the
+            // TextField and the border, but not the space within
+            // the TextField.
+            var textFormat:TextFormat = textField.getTextFormat();
+            textFormat.leftMargin = 0;
+            textFormat.rightMargin = 0;
+            textField.defaultTextFormat = textFormat;
+
+            textField.text = _text;
+            textChanged = false;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override protected function measure():void
+    {
+        super.measure();
+
+        var bm:EdgeMetrics = borderMetrics;
+
+        var leftInset:Number = bm.left + getStyle("paddingLeft");
+        var topInset:Number = bm.top + getStyle("paddingTop");
+        var rightInset:Number = bm.right + getStyle("paddingRight");
+        var bottomInset:Number = bm.bottom + getStyle("paddingBottom");
+
+        var widthSlop:Number = leftInset + rightInset;
+        var heightSlop:Number = topInset + bottomInset;
+
+        textField.wordWrap = false;
+
+        if (textField.textWidth + widthSlop > ToolTip.maxWidth)
+        {
+            textField.width = ToolTip.maxWidth - widthSlop;
+            textField.wordWrap = true;
+        }
+
+        measuredWidth = textField.width + widthSlop;
+        measuredHeight = textField.height + heightSlop;
+    }
+
+    /**
+     *  @private
+     */
+    override protected function updateDisplayList(unscaledWidth:Number,
+                                                  unscaledHeight:Number):void
+    {
+        super.updateDisplayList(unscaledWidth, unscaledHeight);
+
+        var bm:EdgeMetrics = borderMetrics;
+
+        var leftInset:Number = bm.left + getStyle("paddingLeft");
+        var topInset:Number = bm.top + getStyle("paddingTop");
+        var rightInset:Number = bm.right + getStyle("paddingRight");
+        var bottomInset:Number = bm.bottom + getStyle("paddingBottom");
+
+        var widthSlop:Number = leftInset + rightInset;
+        var heightSlop:Number = topInset + bottomInset;
+
+        border.setActualSize(unscaledWidth, unscaledHeight);
+
+        textField.move(leftInset, topInset);
+        textField.setActualSize(unscaledWidth - widthSlop, unscaledHeight - heightSlop);
+    }
+
+    /**
+     *  @private
+     */
+    override public function styleChanged(styleProp:String):void
+    {
+        // This will take care of doing invalidateSize() if styleProp
+        // is "styleName" or a registered layout style such as "borderStyle".
+        super.styleChanged(styleProp);
+
+        // However, if the borderStyle changes from "errorTipAbove" to
+        // "errorTipBelow" or vice versa, the measured size won't change.
+        // (The pointy part of the skin simply changes from the bottom
+        // to the top or vice versa.) This means that the LayoutManager
+        // won't call updateDisplayList() because the size hasn't changed.
+        // But the TextField has to be repositioned, so we need to
+        // invalidate the layout as well as the size.
+        if (styleProp == "styleName" ||
+            styleProp == "borderSkin" ||
+            styleProp == null)
+        {
+            //if the border skin has changed then rebuild it.
+            if(border)
+            {
+                removeChild(DisplayObject(border));
+                border = null;
+            }
+            
+            createBorder();         
+        }
+        else if (styleProp == "borderStyle")
+        {
+            invalidateDisplayList();
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Creates the text field child and adds it as a child of this component.
+     * 
+     *  @param childIndex The index of where to add the child.
+     *  If -1, the text field is appended to the end of the list.
+     */
+    mx_internal function createTextField(childIndex:int):void
+    {
+        if (!textField)
+        {
+            textField = IUITextField(createInFontContext(UITextField));
+
+            textField.autoSize = TextFieldAutoSize.LEFT;
+            textField.mouseEnabled = false;
+            textField.multiline = true;
+            textField.selectable = false;
+            textField.wordWrap = false;
+            textField.styleName = this;
+            
+            if (childIndex == -1)
+                addChild(DisplayObject(textField));
+            else 
+                addChildAt(DisplayObject(textField), childIndex);
+        }
+    }
+
+    /**
+     *  @private
+     *  Removes the text field from this component.
+     */
+    mx_internal function removeTextField():void
+    {
+        if (textField)
+        {
+            removeChild(DisplayObject(textField));
+            textField = null;
+        }
+    }
+    
+
+    /**
+     *  @private
+     */
+    mx_internal function getTextField():IUITextField
+    {
+        return textField;
+    }
+    
+    /**
+     *  @private
+     */
+    private function createBorder():void
+    {        
+        if (!border)
+        {
+            var borderClass:Class = getStyle("borderSkin");
+            
+            if (borderClass != null)
+            {
+                border = new borderClass();
+                
+                if (border is ISimpleStyleClient)
+                    ISimpleStyleClient(border).styleName = this;
+                
+                // Add the border behind all the children.
+                addChildAt(DisplayObject(border), 0);
+                
+                invalidateDisplayList();
+            }
+        }
+    }
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/ComponentDescriptor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/ComponentDescriptor.as b/frameworks/projects/MX/src/main/flex/mx/core/ComponentDescriptor.as
new file mode 100644
index 0000000..246a2df
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/ComponentDescriptor.as
@@ -0,0 +1,436 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+
+/**
+ *  ComponentDescriptor is the base class for the UIComponentDescriptor class,
+ *  which encapsulates the information that you specified in an MXML tag
+ *  for an instance of a visual component.
+ *  In Flex, non-visual components are treated differently and do not
+ *  have descriptors, but in a future version the ComponentDescriptor
+ *  base class may be used for them as well.
+ *
+ *  <p>Most of the tags in an MXML file describe a tree of UIComponent objects.
+ *  For example, the <code>&lt;mx:Application&gt;</code> tag represents a
+ *  UIComponent object, and its child containers and controls are all
+ *  UIComponent objects.</p>
+ *
+ *  <p>The MXML compiler compiles each of these MXML tags into a
+ *  UIComponentDescriptor instance.
+ *  To be precise, the MXML compiler autogenerates an ActionScript
+ *  data structure which is a tree of UIComponentDescriptor objects.</p>
+ *
+ *  <p>At runtime, the <code>createComponentsFromDescriptors()</code> method
+ *  of the Container class uses the information in the UIComponentDescriptor
+ *  objects in the container's <code>childDescriptors</code> array to create
+ *  the actual UIComponent objects that are the container's children,
+ *  plus deeper descendants as well.
+ *  Depending on the value of the container's <code>creationPolicy</code>,
+ *  property, the descendants might be created at application startup,
+ *  when some part of the component is about to become visible,
+ *  or when the application developer manually calls
+ *  the <code>createComponentsFromDescriptors()</code> method.</p>
+ *
+ *  <p>You do not typically create ComponentDescriptor or UIComponentDescriptor
+ *  instances yourself; you can access the ones that the MXML compiler
+ *  autogenerates, via the <code>childDescriptors</code> array
+ *  of the Container class.</p>
+ *
+ *  @see mx.core.UIComponentDescriptor
+ *  @see mx.core.Container#childDescriptors
+ *  @see mx.core.Container#creationPolicy
+ *  @see mx.core.Container#createComponentsFromDescriptors()
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */ 
+public class ComponentDescriptor
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param descriptorProperties An Object containing name/value pairs
+     *  for the properties of the ComponentDescriptor object, such as its
+     *  <code>type</code>, <code>id</code>, <code>propertiesFactory</code>
+     *  and <code>events</code>.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function ComponentDescriptor(descriptorProperties:Object)
+    {
+        super();
+
+        for (var p:String in descriptorProperties)
+        {
+            this[p] = descriptorProperties[p];
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  document
+    //----------------------------------
+
+    /**
+     *  A reference to the document Object in which the component
+     *  is to be created.
+     *
+     *  @see mx.core.IUIComponent#document
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var document:Object;
+
+    //----------------------------------
+    //  events
+    //----------------------------------
+
+    /**
+     *  An Object containing name/value pairs for the component's
+     *  event handlers, as specified in MXML.
+     *
+     *  <p>For example, if you write</p>
+     *
+     *  <pre>
+     *  &lt;mx:DataGrid id="dg" initialize="fetchData(); initDataGrid();"  change="changeHandler(event);"/&gt;
+     *  </pre>
+     *
+     *  <p>then the descriptor's <code>events</code> property is the Object</p>
+     *
+     *  <pre>
+     *  { initialize: "__dg_initialize", change: "__dg_change" }
+     *  </pre>
+     *
+     *  <p>The <code>event</code>property is <code>null</code>
+     *  if no MXML event handlers were specified for the component</p>
+     *
+     *  <p>The strings <code>"__dg_initialize"</code>
+     *  and <code>"__dg_change"</code> are the names of event handler
+     *  methods that the MXML compiler autogenerates.
+     *  The body of these methods contain the ActionScript statements
+     *  that you specified as the values of the event attributes.
+     *  For example, the autogenerated <code>initialize</code> handler is</p>
+     *
+     *  <pre>
+     *  public function __dg_initialize(event:mx.events.FlexEvent):void
+     *  {
+     *      fetchData();
+     *      initDataGrid();
+     *  }
+     *  </pre>
+     *
+     *  <p>You should not assume that the autogenerated event handlers
+     *  will always be specified by name; this may change in a future
+     *  version of Flex.</p>
+     *  
+     *  <p>This property is used by the Container method
+     *  <code>createComponentsFromDescriptors()</code>
+     *  to register the autogenerated event handlers
+     *  using the <code>addEventListener()</code> method.</p>
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var events:Object;
+
+    //----------------------------------
+    //  id
+    //----------------------------------
+
+    /**
+     *  The identifier for the component, as specified in MXML. 
+     *
+     *  <p>For example, if you write</p>
+     *
+     *  <pre>
+     *  &lt;mx:TextInput id="firstName" text="Enter your first name here"/&gt;
+     *  </pre>
+     *
+     *  <p>then the descriptor's <code>id</code> property is the String
+     *  <code>"firstName"</code>.</p>
+     *
+     *  <p>The <code>id</code> property is <code>null</code>
+     *  if no MXML id was specified for the component.</p>
+     *
+     *  <p>The value of the <code>id</code> property becomes the name
+     *  of a public variable in the MXML document object,
+     *  autogenerated by the MXML compiler.
+     *  The value of this variable is a reference to the UIComponent object
+     *  created from this descriptor.
+     *  This is why you can, for example, reference the TextInput control's 
+     *  <code>text</code> property as <code>firstName.text</code>
+     *  from anywhere within the document containing this TextInput instance.</p>
+     *
+     *  <p>If an <code>id</code> is specified, and it isn't the empty string,
+     *  it also becomes the <code>name</code> of the DisplayObject object.
+     *  If an <code>id</code> is not specified or is empty, the DisplayObject
+     *  object's <code>name</code> remains an autogenerated string,
+     *  such as <code>"Button3"</code>, as returned by the
+     *  <code>NameUtil.createUniqueName()</code> method.
+     *  The <code>name</code> is used in generating the string returned
+     *  by the <code>toString()</code> method.
+     *  It can also be used to find the component from its parent
+     *  by calling <code>getChildByName()</code>.</p>
+     *
+     *  @see flash.display.DisplayObject#name
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var id:String;
+
+    //----------------------------------
+    //  properties
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _properties:Object;
+
+    /**
+     *  An Object containing name/value pairs for the component's properties,
+     *  as specified in MXML.
+     *
+     *  <p>For example, if you write</p>
+     *
+     *  <pre>
+     *  &lt;mx:TextInput width="150" text="Hello"/&gt;
+     *  </pre>
+     *
+     *  <p>then the descriptor's <code>properties</code> property
+     *  is the Object</p>
+     *
+     *  <pre>
+     *  { width: 150, text: "Hello" }
+     *  </pre>
+     *
+     *  <p>The <code>properties</code> property is <code>null</code>
+     *  if no MXML properties were specified for the component.
+     *  In this case, the component will use default property values.</p>
+     *
+     *  <p> This Object is produced by calling the function specified by the
+     *  <code>propertiesFactory</code> property, and then cached
+     *  for subsequent access.
+     *  However, when a Repeater produces multiple instances of a component
+     *  from the same descriptor, a fresh copy of the <code>properties</code>
+     *  Object should be produced for each component instance so that they
+     *  don't share property values which are Arrays or Object references.
+     *  The Repeater accomplishes this by calling the 
+     *  <code>invalidateProperties()</code> method on the descriptor.</p>
+     *
+     *  @see #propertiesFactory
+     *  @see #invalidateProperties()
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get properties():Object
+    {
+        if (_properties)
+            return _properties;
+
+        if (propertiesFactory != null)
+            _properties = propertiesFactory.call(document);
+        
+        // Propagate the 'document' property, set by the MXML compiler
+        // on the document descriptor, down to all descendant descriptors.
+        if (_properties)
+        {   
+            var cd:Array = _properties.childDescriptors; 
+            if (cd)
+            {
+                var n:int = cd.length;
+                for (var i:int = 0; i < n; i++)
+                {
+                    cd[i].document = document;
+                }
+            }
+        }
+        else
+        {
+            _properties = {};
+        }
+        
+        return _properties;
+    }
+
+    //----------------------------------
+    //  propertiesFactory
+    //----------------------------------
+
+    /**
+     *  A Function that returns an Object containing name/value pairs
+     *  for the component's properties, as specified in MXML.
+     *
+     *  <p>For example, if you write</p>
+     *  
+     *  <pre>
+     *  &lt;mx:TextInput width="150" text="Hello"&gt;
+     *  </pre>
+     *
+     *  <p>then the descriptor's <code>propertiesFactory</code> property 
+     *  is the Function:</p>
+     *
+     *  <pre>
+     *  function():Object { return { width: 150, text: "Hello" }; }
+     *  </pre>
+     *
+     *  <p>The <code>propertiesFactory</code>property is <code>null</code>
+     *  if no MXML properties were specified for the component.
+     *  In this case, the component will use default property values.</p>
+     *
+     *  <p>The reason that <code>propertyFactory</code> is a
+     *  Function returning an Object rather than an actual Object
+     *  is to allow the tree of ComponentDescriptor objects
+     *  to "unfold" incrementally.
+     *  If all the descriptors in the descriptor tree for the document
+     *  were created at launch time, the time to launch would be greater.</p>
+     *
+     *  <p>The <code>properties</code> property returns a cached Object
+     *  that was produced by this factory function.</p>
+     *  
+     *  <p>Note: Event handlers such as <code>click="doSomething();"</code>
+     *  appear in the <code>events</code> Object,
+     *  not in the <code>properties</code> Object.</p>
+     *
+     *  @see #properties
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var propertiesFactory:Function;
+
+    //----------------------------------
+    //  type
+    //----------------------------------
+
+    /**
+     *  The Class of the component, as specified in MXML.
+     *
+     *  <p>For example, if you write</p>
+     *
+     *  <pre>
+     *  &lt;mx:TextInput/&gt;
+     *  </pre>
+     *
+     *  <p>then the descriptor's <code>type</code> property
+     *  the Class mx.controls.TextInput.</p>
+     *
+     *  <p>The property is never <code>null</code> for the
+     *  ComponentDescriptor objects created by the MXML compiler,
+     *  because every MXML tag has a tag name such as mx:TextInput.</p>
+     *
+     *  <p>The mapping between an MXML tag and its corresponding class
+     *  is determined by the XML namespace and the "manifest" file,
+     *  if any, that is associated with that namespace.
+     *  For example, the standard Flex namespace
+     *  <code>http://www.adobe.com/2006/mxml</code>
+     *  represented by the mx: prefix is associated (in the flex-config.xml
+     *  file) with the manifest file mxml-manifest.xml,
+     *  and this file has the tag</p>
+     *
+     *  <pre>
+     *  &lt;component id="TextInput" class="mx.controls.TextInput"/&gt;
+     *  </pre>
+     *
+     *  <p>which maps the tag name mx:TextInput
+     *  to the Class mx.controls.TextInput.
+     *  Note that the use of a manifest file allows components in single
+     *  XML namespace to map to classes in multiple ActionScript packages.</p>
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var type:Class;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Invalidates the cached <code>properties</code> property.
+     *  The next time you read the <code>properties</code> property,
+     *  the properties are regenerated from the function specified by the 
+     *  value of the <code>propertiesFactory</code> property.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function invalidateProperties():void
+    {
+        _properties = null;
+    }
+    
+    /**
+     *  Returns the string "ComponentDescriptor_" plus the value of the  
+     *  <code>id</code> property.
+     *
+     *  @return The string "ComponentDescriptor_" plus the value of the  
+     *  <code>id</code> property.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function toString():String
+    {
+        return "ComponentDescriptor_" + id;
+    }
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/ContainerCreationPolicy.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/ContainerCreationPolicy.as b/frameworks/projects/MX/src/main/flex/mx/core/ContainerCreationPolicy.as
new file mode 100644
index 0000000..7e9cb5d
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/ContainerCreationPolicy.as
@@ -0,0 +1,109 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 ContainerCreationPolicy class defines the constant values
+ *  for the <code>creationPolicy</code> property of the Container class.
+ *
+ *  @see mx.core.Container#creationPolicy
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public final class ContainerCreationPolicy
+{
+	include "../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class constants
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Delay creating some or all descendants until they are needed.
+	 *
+	 *  <p>For example, if a navigator container such as a TabNavigator
+	 *  has this <code>creationPolicy</code>, it will immediately create
+	 *  all of its children, plus the descendants of the initially
+	 *  selected child.
+	 *  However, it will wait to create the descendants of the other children
+	 *  until the user navigates to them.</p>
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public static const AUTO:String = "auto";
+	
+	/**
+	 *  Immediately create all descendants.
+	 *
+	 *  <p>Avoid using this <code>creationPolicy</code> because
+	 *  it increases the startup time of your application.
+	 *  There is usually no good reason to create components at startup
+	 *  which the user cannot see.
+	 *  If you are using this policy so that you can "push" data into
+	 *  hidden components at startup, you should instead design your
+	 *  application so that the data is stored in data variables
+	 *  and components which are created later "pull" in this data,
+	 *  via databinding or an <code>initialize</code> handler.</p>
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public static const ALL:String = "all";
+	
+	/**
+	 *  Add the container to a creation queue.
+     *  Deprecated since Flex 4.0.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public static const QUEUED:String = "queued";
+	
+	/**
+	 *  Do not create any children.
+	 *
+	 *  <p>With this <code>creationPolicy</code>, it is the developer's
+	 *  responsibility to programmatically create the children 
+	 *  from the UIComponentDescriptors by calling
+	 *  <code>createComponentsFromDescriptors()</code>
+	 *  on the parent container.</p>
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public static const NONE:String = "none";
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/ContainerGlobals.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/ContainerGlobals.as b/frameworks/projects/MX/src/main/flex/mx/core/ContainerGlobals.as
new file mode 100644
index 0000000..5c76b97
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/ContainerGlobals.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.core
+{
+
+COMPILE::AS3
+{
+	import flash.display.InteractiveObject;	
+}
+COMPILE::JS
+{
+	import flex.display.InteractiveObject;	
+}
+import mx.managers.IFocusManager;
+import mx.managers.IFocusManagerContainer;
+
+/**
+*  @private
+*/
+public class ContainerGlobals
+{
+    /**
+     *  @private
+     *  Internal variable that keeps track of the container
+     *  that currently has focus.
+     */
+    public static var focusedContainer:InteractiveObject;
+
+    /**
+     *  @private
+     *  Support for defaultButton.
+     */
+    public static function checkFocus(oldObj:InteractiveObject,
+                                           newObj:InteractiveObject):void
+    {
+        var objParent:InteractiveObject = newObj;
+        var currObj:InteractiveObject = newObj;
+        var lastUIComp:IUIComponent = null;
+
+        if (newObj != null && oldObj == newObj)
+            return;
+        
+        // Find the Container parent with a defaultButton defined.
+        while (currObj)
+        {
+            if (currObj.parent)
+            {
+                objParent = currObj.parent;
+            }
+            else
+            {
+                objParent = null;
+            }
+
+            if (currObj is IUIComponent)
+                lastUIComp = IUIComponent(currObj);
+
+            currObj = objParent;
+
+            if (currObj &&
+                currObj is IFocusManagerContainer && IFocusManagerContainer(currObj).defaultButton)
+            {
+                break;
+            }
+        }
+
+        if (ContainerGlobals.focusedContainer != currObj || 
+            (ContainerGlobals.focusedContainer == null && currObj == null))
+        {
+            if (!currObj)
+                currObj = InteractiveObject(lastUIComp);
+
+            if (currObj && currObj is IFocusManagerContainer)
+            {
+                var fm:IFocusManager = IFocusManagerContainer(currObj).focusManager;
+                if (!fm)
+                    return;
+                var defButton:IButton = IFocusManagerContainer(currObj).defaultButton as IButton;
+                if (defButton)
+                {
+                    ContainerGlobals.focusedContainer = InteractiveObject(currObj);
+                    fm.defaultButton = defButton as IButton;
+                }
+                else
+                {
+                    ContainerGlobals.focusedContainer = InteractiveObject(currObj);
+                    fm.defaultButton = null;
+                }
+            }
+        }
+    }
+
+
+}
+
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/DPIClassification.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/DPIClassification.as b/frameworks/projects/MX/src/main/flex/mx/core/DPIClassification.as
new file mode 100644
index 0000000..acd4a2d
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/DPIClassification.as
@@ -0,0 +1,98 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+
+/**
+ *  An enum of the device screen density classess.  
+ *
+ *  When working with DPI, Flex collapses similar DPI values into DPI classes.
+ *
+ *  @see spark.components.Application#applicationDPI
+ *  @see spark.components.Application#runtimeDPI
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+public final class DPIClassification
+{
+	/**
+	 *  Density value for extra-low-density devices.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 2.5
+	 *  @productversion ApacheFlex 4.11
+	 */
+	public static const DPI_120:Number = 120;
+	
+    /**
+     *  Density value for low-density devices.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public static const DPI_160:Number = 160;
+
+    /**
+     *  Density value for medium-density devices.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public static const DPI_240:Number = 240;
+
+	/**
+	 *  Density value for high-density devices.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 2.5
+	 *  @productversion Flex 4.5
+	 */
+	public static const DPI_320:Number = 320;
+	
+	/**
+	 *  Density value for extra-high-density devices.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 2.5
+	 *  @productversion ApacheFlex 4.10
+	 */
+	public static const DPI_480:Number = 480;
+	
+	/**
+	 *  Density value for extra-extra-high-density devices.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 2.5
+	 *  @productversion ApacheFlex 4.11
+	 */
+	public static const DPI_640:Number = 640;
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/DesignLayer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/DesignLayer.as b/frameworks/projects/MX/src/main/flex/mx/core/DesignLayer.as
new file mode 100644
index 0000000..de98fe9
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/DesignLayer.as
@@ -0,0 +1,447 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+    import org.apache.flex.events.EventDispatcher;
+    import mx.events.PropertyChangeEvent;
+    import mx.events.PropertyChangeEventKind;
+        
+    /**
+     *  Dispatched by the layer when either <code>effectiveVisibility</code> or 
+     *  <code>effectiveAlpha</code> changes.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    [Event(name="layerPropertyChange", type="mx.events.PropertyChangeEvent")]
+    
+    /**
+     *  The DesignLayer class represents a visibility group that can be associated
+     *  with one or more IVisualElement instances at runtime.  
+     * 
+     *  DesignLayer instances support a <code>visible</code> and alpha property 
+     *  that when set will propagate to the associated layer children.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public class DesignLayer extends EventDispatcher implements IMXMLObject
+    {
+        //--------------------------------------------------------------------------
+        //
+        //  Constructor
+        //
+        //--------------------------------------------------------------------------
+        
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function DesignLayer()
+        {
+            super();
+        }
+        
+        //----------------------------------
+        //  id
+        //----------------------------------
+
+        /**
+         *  @private
+         *  Storage for id property.
+         */
+        private var _id:String;
+        
+        /**
+         *  ID of the layer component. This value becomes the instance name of the 
+         *  layer and as such, should not contain any white space or special 
+         *  characters. 
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function get id():String
+        {
+            return _id;
+        }
+        
+        /**
+         *  @private
+         */
+        public function set id(value:String):void
+        {
+            _id = value;
+        }
+        
+        //----------------------------------
+        //  parent
+        //----------------------------------
+
+        /**
+         *  @private
+         *  Storage for parent property.
+         */
+        private var _parent:DesignLayer;
+        
+        /**
+         *  This layer's parent layer. 
+         *  
+         *  @default null
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function get parent():DesignLayer
+        {
+            return _parent;
+        }
+        
+        /**
+         *  @private
+         *  Called when a DesignLayer instance is added to or removed from a parent.
+         *  Developers typically never need to call this method.
+         *
+         *  @param p The new parent layer of this DesignLayer instance.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        protected function parentChanged(value:DesignLayer):void
+        {
+            // We remove our layer from the old parent unless the new
+            // parent is null (in this case we know we are invoking this 
+            // directly from removeLayer).
+            if (_parent && value)
+                _parent.removeLayer(this);
+            
+            _parent = value;
+            effectiveVisibilityChanged(_visible);
+            effectiveAlphaChanged(_alpha);
+        }
+        
+        //----------------------------------
+        //  layerChildren
+        //----------------------------------
+        
+        /**
+         * @private
+         */  
+        private var layerChildren:Array = [];
+        
+        //----------------------------------
+        //  visible
+        //----------------------------------
+        
+        /**
+         * @private
+         */  
+        private var _visible:Boolean = true;
+
+        /**
+         *  The visibility for this design layer instance.
+         *
+         *  <p>When updated, the appropriate change event for <code>effectiveVisibility</code> 
+         *  will be dispatched to all <code>layerPropertyChange</code> listeners for 
+         *  this layer, as well as those of affected descendant layers if any.</p>
+         *
+         *  @default true
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function get visible():Boolean
+        {
+            return _visible;
+        }
+ 
+        /**
+         * @private
+         */
+        public function set visible(value:Boolean):void
+        {
+            if (_visible != value)
+            {
+                _visible = value;
+                effectiveVisibilityChanged(effectiveVisibility);
+            }
+        }
+        
+        //----------------------------------
+        //  effectiveVisibility
+        //----------------------------------
+        
+        /**
+         *  Returns the effective visibility of this design layer.
+         *  This value takes into consideration the  visibility of 
+         *  this layer and any ancestor layers.  
+         * 
+         *  @default true
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */   
+        public function get effectiveVisibility():Boolean
+        {
+            var isVisible:Boolean = _visible;
+            var currentLayer:DesignLayer = this;
+            while (isVisible && currentLayer.parent)
+            {
+                currentLayer = currentLayer.parent;
+                isVisible = currentLayer.visible;
+            }
+            return isVisible;
+        }
+        
+        /**
+         * @private
+         * Used to notify the visual elements associated with this layer that the 
+         * effective visiblity has changed.  Dispatches a <code>layerPropertyChange</code> 
+         * event with property field set to "effectiveVisibility".
+         */  
+        protected function effectiveVisibilityChanged(value:Boolean):void
+        {
+            dispatchEvent(new PropertyChangeEvent("layerPropertyChange", false, 
+                false, PropertyChangeEventKind.UPDATE, "effectiveVisibility", 
+                !effectiveVisibility, effectiveVisibility));
+            
+            for (var i:int = 0; i < layerChildren.length; i++)
+            {
+                var layerChild:DesignLayer = layerChildren[i];
+                
+                // We only need to notify those layers that are visible, because
+                // those that aren't don't really care about their layer parents
+                // visibility.
+                if (layerChild.visible)
+                    layerChild.effectiveVisibilityChanged(value);
+            }
+        }
+        
+        //----------------------------------
+        //  alpha
+        //----------------------------------
+        
+        /**
+         * @private
+         */  
+        private var _alpha:Number = 1.0;
+        
+        /**
+         *  The alpha for this design layer instance, between 0.0 and 1.0.
+         *
+         *  <p>When updated, the appropriate change event for <code>effectiveAlpha</code> 
+         *  will be dispatched to all <code>layerPropertyChange</code> listeners 
+         *  for this layer, as well as those of affected descendant layers if any.</p>
+         *
+         *  @default 1.0
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function get alpha():Number
+        {
+            return _alpha;
+        }
+ 
+        /**
+         * @private
+         */
+        public function set alpha(value:Number):void
+        {
+            if (_alpha != value)
+            {
+                var oldAlpha:Number = _alpha;
+                _alpha = value;
+                effectiveAlphaChanged(oldAlpha);
+            }
+        }
+        
+        //----------------------------------
+        //  effectiveAlpha
+        //----------------------------------
+        
+        /**
+         *  Property that returns the effective alpha, between 0.0 and 1.0,
+         *  of this design layer. 
+         *  This value multiplies the alpha of this layer by the alpha of 
+         *  any ancestor layers.  
+         * 
+         *  @default 1.0
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */ 
+        public function get effectiveAlpha():Number
+        {
+            var currentAlpha:Number = _alpha;
+            var currentLayer:DesignLayer = this;
+            while (currentLayer.parent)
+            {
+                currentLayer = currentLayer.parent;
+                currentAlpha = currentAlpha * currentLayer.alpha;
+            }
+            return currentAlpha;
+        }
+        
+        /**
+         * @private
+         * Used to notify the visual elements associated with this layer that the 
+         * effective alpha has changed.  Dispatches a <code>layerPropertyChange</code> 
+         * event with the property field set to "effectiveAlpha".
+         */  
+        protected function effectiveAlphaChanged(oldAlpha:Number):void
+        {
+            dispatchEvent(new PropertyChangeEvent("layerPropertyChange", false, 
+                false, PropertyChangeEventKind.UPDATE, "effectiveAlpha", 
+                oldAlpha, effectiveAlpha));
+            
+            for (var i:int = 0; i < layerChildren.length; i++)
+            {
+                var layerChild:DesignLayer = layerChildren[i];
+                layerChild.effectiveAlphaChanged(layerChild.alpha);
+            }
+        }
+ 
+        //----------------------------------
+        //  numLayers
+        //----------------------------------
+        
+        /**
+         *  The number of DesignLayer children directly parented by this layer.
+         *
+         *  @default 0
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function get numLayers():int
+        {
+            return layerChildren.length;
+        }
+        
+        //----------------------------------------------------------------------
+        //
+        //  Methods
+        //
+        //----------------------------------------------------------------------
+        
+        /**
+         *  Adds a DesignLayer child to this layer.
+         *
+         *  @param value The layer child to add.
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function addLayer(value:DesignLayer):void
+        {
+            value.parentChanged(this);
+            layerChildren.push(value);
+        }
+        
+        /**
+         *  Returns the DesignLayer child at the specified index.
+         *
+         *  <p>Note that the order of DesignLayer children is insignificant.
+         *  The <code>getLayerAt</code> method is meant to be used in 
+         *  conjunction with numLayers to iterate over the child list.</p> 
+         *
+         *  @param index The 0-based index of a DesignLayer child.
+         *
+         *  @return The specified DesignLayer child if index is between
+         *  0 and <code>numLayers</code> - 1.  Returns <code>null</code> 
+         *  if the index is invalid.
+         * 
+         *  @see numLayers
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function getLayerAt(index:int):DesignLayer
+        {
+            return ((index < layerChildren.length) && index >= 0) ? 
+                layerChildren[index] : null;
+        }
+        
+        /**
+         *  @inheritDoc
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function initialized(document:Object, id:String):void
+        {
+            this.id = id;
+        }
+
+        /**
+         *  Removes a DesignLayer child from this layer.
+         *
+         *  @param value The layer child to remove.
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function removeLayer(value:DesignLayer):void
+        {
+            for (var i:int = 0; i < layerChildren.length; i++)
+            {
+                if (layerChildren[i] == value)
+                {
+                    value.parentChanged(null);
+                    layerChildren.splice(i,1);
+                    return;
+                }
+            }
+        }
+         
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/EdgeMetrics.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/EdgeMetrics.as b/frameworks/projects/MX/src/main/flex/mx/core/EdgeMetrics.as
new file mode 100644
index 0000000..bdd9d4b
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/EdgeMetrics.as
@@ -0,0 +1,201 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 EdgeMetrics class specifies the thickness, in pixels,
+ *  of the four edge regions around a visual component.
+ *
+ *  <p>The following Flex properties have values that are EdgeMetrics
+ *  objects:</p>
+ *
+ *  <ul>
+ *  <li>The <code>borderMetrics</code> property of the mx.core.Container and
+ *  mx.skins.Border classes includes only the border in the calculations 
+ *  of the property values of the EdgeMetrics object.</li>
+ *
+ *  <li>The <code>viewMetrics</code> property of the mx.core.Container
+ *  class, and of subclasses of the Container class, includes possible 
+ *  scrollbars and non-content elements -- such as a Panel container's
+ *  header area and the area for a ControlBar component -- in the calculations
+ *  of the  property values of the EdgeMetrics object.</li>
+ *
+ *  <li>The <code>viewMetricsAndPadding</code> property of the
+ *  mx.core.Container class includes the items listed for the
+ *  <code>viewMetrics</code> property, plus the any areas defined by 
+ *  the margins of the container in the calculations of the 
+ *  property values of the EdgeMetrics object.</li>
+ *  </ul>
+ *
+ *  <p>These three properites all return a reference to the same
+ *  EdgeMetrics object that the Container is using for its measurement
+ *  and layout; they do not return a copy of this object.
+ *  If you need a copy, call the <code>clone()</code> method.</p>
+ *
+ *  @see mx.core.Container
+ *  @see mx.skins.Border
+ *  @see mx.containers.Panel
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class EdgeMetrics
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class constants
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  An EdgeMetrics object with a value of zero for its
+     *  <code>left</code>, <code>top</code>, <code>right</code>,
+     *  and <code>bottom</code> properties.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param left The width, in pixels, of the left edge region.
+     *
+     *  @param top The height, in pixels, of the top edge region.
+     *
+     *  @param right The width, in pixels, of the right edge region.
+     *
+     *  @param bottom The height, in pixels, of the bottom edge region.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function EdgeMetrics(left:Number = 0, top:Number = 0,
+                                right:Number = 0, bottom:Number = 0)
+    {
+        super();
+
+        this.left = left;
+        this.top = top;
+        this.right = right;
+        this.bottom = bottom;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  bottom
+    //----------------------------------
+
+    /**
+     *  The height, in pixels, of the bottom edge region.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var bottom:Number;
+
+    //----------------------------------
+    //  left
+    //----------------------------------
+
+    /**
+     *  The width, in pixels, of the left edge region.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var left:Number;
+
+    //----------------------------------
+    //  right
+    //----------------------------------
+
+    /**
+     *  The width, in pixels, of the right edge region.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var right:Number;
+
+    //----------------------------------
+    //  top
+    //----------------------------------
+
+    /**
+     *  The height, in pixels, of the top edge region.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var top:Number;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Returns a copy of this EdgeMetrics object.
+     *
+     *  @return A copy of this EdgeMetrics object.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function clone():EdgeMetrics
+    {
+        return new EdgeMetrics(left, top, right, bottom);
+    }
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/EmbeddedFont.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/EmbeddedFont.as b/frameworks/projects/MX/src/main/flex/mx/core/EmbeddedFont.as
new file mode 100644
index 0000000..11be4e2
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/EmbeddedFont.as
@@ -0,0 +1,223 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+
+[ExcludeClass]
+
+/**
+ *  @private
+ *  Describes the properties that make an embedded font unique.
+ */
+public class EmbeddedFont
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class properties
+    //
+    //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    //  embeddedFontRegistry
+    //----------------------------------
+    
+    private static var noEmbeddedFonts:Boolean;
+    
+    /**
+     *  @private
+     *  Storage for the _embeddedFontRegistry property.
+     *  Note: This gets initialized on first access,
+     *  not when this class is initialized, in order to ensure
+     *  that the Singleton registry has already been initialized.
+     */
+    private static var _embeddedFontRegistry:IEmbeddedFontRegistry;
+    
+    /**
+     *  @private
+     *  A reference to the embedded font registry.
+     *  Single registry in the system.
+     *  Used to look up the moduleFactory of a font.
+     */
+    private static function get embeddedFontRegistry():IEmbeddedFontRegistry
+    {
+        if (!_embeddedFontRegistry && !noEmbeddedFonts)
+        {
+            try
+            {
+                _embeddedFontRegistry = IEmbeddedFontRegistry(
+                    Singleton.getInstance("mx.core::IEmbeddedFontRegistry"));
+            }
+            catch (e:Error)
+            {
+                noEmbeddedFonts = true;
+            }
+        }
+        
+        return _embeddedFontRegistry;
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Create a new EmbeddedFont object.
+     * 
+     *  @param fontName The name of the font.
+     *
+     *  @param bold true if the font is bold, false otherwise.
+     *
+     *  @param italic true if the font is italic, false otherwise,
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */ 
+    public function EmbeddedFont(fontName:String, bold:Boolean, italic:Boolean)
+    {
+        super();
+
+        initialize(fontName, bold, italic);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  bold
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the bold property.
+     */
+    private var _bold:Boolean;
+    
+    /**
+     *  True if the font is bold
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get bold():Boolean
+    {
+        return _bold;   
+    }
+
+    //----------------------------------
+    //  fontName
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the fontName property.
+     */
+    private var _fontName:String;
+    
+    /**
+     *  The name of the font.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get fontName():String
+    {
+        return _fontName;   
+    }
+
+    //----------------------------------
+    //  fontStyle
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the fontStyle property.
+     */
+    private var _fontStyle:String;
+    
+    /**
+     *  The style of the font.
+     *  The value is one of the values in flash.text.FontStyle.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get fontStyle():String
+    {
+        return _fontStyle;  
+    }
+    
+    //----------------------------------
+    //  italic
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the italic property.
+     */
+    private var _italic:Boolean;
+    
+    /**
+     *  True if the font is italic
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get italic():Boolean
+    {
+        return _italic; 
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Initialize
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  @private
+     */
+    public function initialize(fontName:String, bold:Boolean,
+                               italic:Boolean):void
+    {
+        _bold = bold;
+        _italic = italic;
+        _fontName = fontName;
+        _fontStyle = embeddedFontRegistry.getFontStyle(bold, italic);
+}
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/core/FlexGlobals.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/FlexGlobals.as b/frameworks/projects/MX/src/main/flex/mx/core/FlexGlobals.as
new file mode 100644
index 0000000..b07a5d2
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/FlexGlobals.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+
+/**
+ *  A class that contains variables that are global to all applications within
+ *  the same ApplicationDomain.
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *
+ */
+public class FlexGlobals
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Class variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  The first application run in an ApplicationDomain is the top-level application.
+     *  This property is set to a reference to the top-level application in the top-level 
+     *  application's constructor. Each ApplicationDomain will have its own 
+     *  <code>topLevelApplication</code>.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+	public static var topLevelApplication:Object;
+}
+
+}


Mime
View raw message