Transferred from the Adobe Open Source Subversion Repository

Revision: 4170
Author:   egeorgie@adobe.com
Date:     2008-11-23T21:12:27.092823Z

Log Message:
-----------
1.	mx.layout.ILayoutItem gets renamed to mx.layout.ILayoutElement
2.	get actualPosition() -> getLayoutPositionX(postTransform:Boolean=true):Number, getLayoutPositionY(postTransform:Boolean=true):Number
3.	get actualSize() -> getLayoutWidth(postTransform:Boolean=true):Number, getLayoutHeight(postTransform:Boolean=true):Number
4.	get preferredSize() -> getPreferredWidth(postTransform:Boolean=true):Number, getPreferredHeight(postTransform:Boolean=true):Number
5.	get minSize() -> getMinWidth(postTransform:Boolean=true):Number, getMinHeight(postTransform:Boolean=true):Number
6.	get maxSize() -> getMaxWidth(postTransform:Boolean=true):Number, getMaxHeight(postTransform:Boolean=true):Number
7.	setActualSize() -> setlayoutSize(width:Number=NaN, height:Number=NaN, postTransform:Boolean=true):void
8.	setActualPosition() -> setLayoutPosition(width:Number=NaN, height:Number=NaN, postTransform:Boolean=true):void
10.     Add support for custom 3D layouts by exposing access to transform matrices through the ILayoutElement interface.

QE Notes: None
Doc Notes: None
Bugs: None
Reviewer: Hans
tests: checkintests, mustella (gumbo/components)

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/tests/layout/layout_tester.mxml</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemHelper.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemUIC.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/DataGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxHSlider.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/ILayoutItem.as" copyfrom-rev="4137" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/ILayoutElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxHScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/effectClasses/FxAnimate3DInstance.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/ILayoutItem.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/VerticalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/tests/graphics/GraphicTags_checkintests.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/skins/spark/FxScrollerSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/effectClasses/FxAnimateInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxVSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/BasicLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/Path.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxVScrollBar.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemFactory.as" copyfrom-rev="4137" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutElementFactory.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/Ellipse.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxButton.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemFactory.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemFDO.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/GroupBase.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemHelper.as" copyfrom-rev="4137" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutElementHelper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/GraphicElement.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutItemUIC.as" copyfrom-rev="4137" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/LayoutElementUIC.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1285088 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as
+++ frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as
@@ -37,18 +37,18 @@
     //
     //--------------------------------------------------------------------------

-    private static function calculatePercentHeight( layoutItem:ILayoutItem, height:Number ):Number
-    {
-    	var percentHeight:Number = LayoutItemHelper.pinBetween(layoutItem.percentHeight * 0.01 * height,
-    	                                                       layoutItem.minSize.y,
-    	                                                       layoutItem.maxSize.y );
+    private static function calculatePercentHeight(layoutElement:ILayoutElement, height:Number):Number
+    {
+    	var percentHeight:Number = LayoutElementHelper.pinBetween(layoutElement.percentHeight * 0.01 * height,
+    	                                                          layoutElement.getMinHeight(),
+    	                                                          layoutElement.getMaxHeight() );
     	return percentHeight < height ? percentHeight : height;
     }

-    private static function sizeLayoutItem(layoutItem:ILayoutItem, height:Number,
-                                           verticalAlign:String, restrictedHeight:Number,
-                                           width:Number, variableColumnWidth:Boolean,
-                                           columnWidth:Number):void
+    private static function sizeLayoutElement(layoutElement:ILayoutElement, height:Number,
+                                              verticalAlign:String, restrictedHeight:Number,
+                                              width:Number, variableColumnWidth:Boolean,
+                                              columnWidth:Number):void
     {
         var newHeight:Number = NaN;

@@ -62,14 +62,14 @@
         }
         else
         {
-            if (hasPercentHeight(layoutItem))
-               newHeight = calculatePercentHeight(layoutItem, height);
+            if (hasPercentHeight(layoutElement))
+               newHeight = calculatePercentHeight(layoutElement, height);
         }

         if (variableColumnWidth)
-            layoutItem.setActualSize(width, newHeight);
+            layoutElement.setLayoutSize(width, newHeight);
         else
-            layoutItem.setActualSize(columnWidth, newHeight);
+            layoutElement.setLayoutSize(columnWidth, newHeight);
     }

     //--------------------------------------------------------------------------
@@ -132,7 +132,7 @@
     [Inspectable(category="General")]

     /**
-     *  Returns the current number of visible items.
+     *  Returns the current number of visible elements.
      *
      *  @default -1
      */
@@ -170,9 +170,9 @@
     [Inspectable(category="General")]

     /**
-     *  Specifies the number of items to display.
-     *
-     *  If requestedColumnCount is -1, then all of them items are displayed.
+     *  Specifies the number of elements to display.
+     *
+     *  If requestedColumnCount is -1, then all of them elements are displayed.
      *
      *  This property implies the layout's measuredWidth.
      *
@@ -211,16 +211,16 @@
      *  is false.
      *
      *  If this property isn't explicitly set, then the measured width
-     *  of the first item is returned.
+     *  of the first element is returned.
      */
     public function get columnWidth():Number
     {
         if (!isNaN(_columnWidth))
             return _columnWidth;
-        else if (!target || (target.numLayoutItems <= 0))
+        else if (!target || (target.numLayoutElements <= 0))
             return 0;
         else
-            return target.getLayoutItemAt(0).preferredSize.x;
+            return target.getLayoutElementAt(0).getPreferredWidth();
     }

     /**
@@ -248,13 +248,13 @@

     /**
      *  If false, i.e. "fixed column width" is specified, the width of
-     *  each item is set to the value of columnWidth.
+     *  each element is set to the value of columnWidth.
      *
      *  If the columnWidth property wasn't explicitly set,
      *  then it's initialized with the measuredWidth of
-     *  the first item.
-     *
-     *  The items' includeInLayout,
+     *  the first element.
+     *
+     *  The elements' includeInLayout,
      *  measuredWidth, minWidth,
      *  and percentWidth properties are ignored when
      *  variableColumnWidth is false.
@@ -397,7 +397,7 @@
     }

     /**
-     *  An index is "in view" if the corresponding non-null layout item is
+     *  An index is "in view" if the corresponding non-null layout element is
      *  within the horizontal limits of the layout target's scrollRect
      *  and included in the layout.
      *
@@ -407,12 +407,12 @@
      *
      *  If the specified index is partially within the view, the
      *  returned value is the percentage of the corresponding
-     *  layout item that's visible.
+     *  layout element that's visible.
      *
      *  Returns 0.0 if the specified index is invalid or if it corresponds to
-     *  null item, or a ILayoutItem for which includeInLayout is false.
-     *
-     *  @return the percentage of the specified item that's in view.
+     *  null element, or a ILayoutElement for which includeInLayout is false.
+     *
+     *  @return the percentage of the specified element that's in view.
      *  @see firstIndexInView
      *  @see lastIndexInView
      */
@@ -422,11 +422,11 @@
         if (!g)
             return 0.0;

-        if ((index < 0) || (index >= g.numLayoutItems))
+        if ((index < 0) || (index >= g.numLayoutElements))
            return 0.0;

-        var li:ILayoutItem = g.getLayoutItemAt(index);
-        if ((li == null) || !li.includeInLayout)
+        var le:ILayoutElement = g.getLayoutElementAt(index);
+        if ((le == null) || !le.includeInLayout)
             return 0.0;

         if (!clipContent)
@@ -446,9 +446,9 @@
         // index is first (c0) or last (c1) visible column
         var x0:Number = g.horizontalScrollPosition;
         var x1:Number = x0 + g.width;
-        var ix0:Number = li.actualPosition.x;
-        var ix1:Number = ix0 + li.actualSize.x;
-        if (ix0 >= ix1)  // item has 0 or negative width
+        var ix0:Number = le.getLayoutPositionX();
+        var ix1:Number = ix0 + le.getLayoutWidth();
+        if (ix0 >= ix1)  // element has 0 or negative width
             return 1.0;
         if ((ix0 >= x0) && (ix1 <= x1))
             return 1.0;
@@ -456,50 +456,49 @@
     }

     /**
-     *  Binary search for the first layout item that contains y.
-     *
-     *  This function considers both the item's actual bounds and
-     *  the gap that follows it to be part of the item.  The search
+     *  Binary search for the first layout element that contains y.
+     *
+     *  This function considers both the element's actual bounds and
+     *  the gap that follows it to be part of the element.  The search
      *  covers index i0 through i1 (inclusive).
      *
-     *  This function is intended for variable height items.
-     *
-     *  Returns the index of the item that contains x, or -1.
+     *  This function is intended for variable height elements.
+     *
+     *  Returns the index of the element that contains x, or -1.
      *
      * @private
      */
     private static function findIndexAt(x:Number, gap:int, g:GroupBase, i0:int, i1:int):int
     {
         var index:int = (i0 + i1) / 2;
-        var item:ILayoutItem = g.getLayoutItemAt(index);
-        var p:Point = item.actualPosition;
-        var s:Point = item.actualSize;
-        // TBD: deal with null item, includeInLayout false.
-        if ((x >= p.x) && (x
= elementX) && (x < elementX + element.getLayoutWidth() + gap))
             return index;
         else if (i0 == i1)
             return -1;
-        else if (x < p.x)
+        else if (x < elementX)
             return findIndexAt(x, gap, g, i0, Math.max(i0, index-1));
         else
             return findIndexAt(x, gap, g, Math.min(index+1, i1), i1);
     }

    /**
-    *  Returns the index of the first non-null includeInLayout item,
-    *  beginning with the item at index i.
+    *  Returns the index of the first non-null includeInLayout element,
+    *  beginning with the element at index i.
     *
-    *  Returns -1 if no such item can be found.
+    *  Returns -1 if no such element can be found.
     *
     *  @private
     */
-    private static function findLayoutItemIndex(g:GroupBase, i:int, dir:int):int
-    {
-        var n:int = g.numLayoutItems;
+    private static function findLayoutElementIndex(g:GroupBase, i:int, dir:int):int
+    {
+        var n:int = g.numLayoutElements;
         while((i >= 0) && (i < n))
         {
-           var item:ILayoutItem = g.getLayoutItemAt(i);
-           if (item && item.includeInLayout)
+           var element:ILayoutElement = g.getLayoutElementAt(i);
+           if (element && element.includeInLayout)
            {
                return i;
            }
@@ -522,7 +521,7 @@
         if (!g)
             return;

-        var n:int = g.numLayoutItems - 1;
+        var n:int = g.numLayoutElements - 1;
         if (n < 0)
         {
             setIndexInView(-1, -1);
@@ -537,7 +536,7 @@
         }

         // We're going to use findIndexAt to find the index of
-        // the items that overlap the left and right edges of the scrollRect.
+        // the elements that overlap the left and right edges of the scrollRect.
         // Values that are exactly equal to scrollRect.right aren't actually
         // rendered, since the left,right interval is only half open.
         // To account for that we back away from the right edge by a
@@ -555,30 +554,30 @@

         var i0:int = findIndexAt(x0 + gap, gap, g, 0, n);
         var i1:int = findIndexAt(x1, gap, g, 0, n);
-        // Special case: no item overlaps x0, is index 0 visible?
+        // Special case: no element overlaps x0, is index 0 visible?
         if (i0 == -1)
         {
-            var index0:int = findLayoutItemIndex(g, 0, +1);
+            var index0:int = findLayoutElementIndex(g, 0, +1);
             if (index0 != -1)
             {
-                var item0:ILayoutItem = g.getLayoutItemAt(index0);
-                var p0:Point = item0.actualPosition;
-                var s0:Point = item0.actualSize;
-                if ((p0.x < x1) && ((p0.x + s0.x) > x0))
+                var element0:ILayoutElement = g.getLayoutElementAt(index0);
+                var element0X:Number = element0.getLayoutPositionX();
+                var element0Width:Number = element0.getLayoutWidth();
+                if ((element0X < x1) && ((element0X + element0Width) > x0))
                     i0 = index0;
             }
         }

-        // Special case: no item overlaps y1, is index n visible?
+        // Special case: no element overlaps y1, is index n visible?
         if (i1 == -1)
         {
-            var index1:int = findLayoutItemIndex(g, n, -1);
+            var index1:int = findLayoutElementIndex(g, n, -1);
             if (index1 != -1)
             {
-                var item1:ILayoutItem = g.getLayoutItemAt(index1);
-                var p1:Point = item1.actualPosition;
-                var s1:Point = item1.actualSize;
-                if ((p1.x < x1) && ((p1.x + s1.x) > x0))
+                var element1:ILayoutElement = g.getLayoutElementAt(index1);
+                var element1X:Number = element1.getLayoutPositionX();
+                var element1Width:Number = element1.getLayoutWidth();
+                if ((element1X < x1) && ((element1X + element1Width) > x0))
                     i1 = index1;
             }
         }
@@ -586,55 +585,56 @@
         setIndexInView(i0, i1);
     }

-       /**
-     *  If the item at index i is non-null and includeInLayout,
+    /**
+     *  If the element at index i is non-null and includeInLayout,
      *  then return it's actual bounds, otherwise return null.
      *
      *  @private
      */
-    private static function layoutItemBounds(g:GroupBase, i:int):Rectangle
-    {
-        var item:ILayoutItem = g.getLayoutItemAt(i);
-        if (item && item.includeInLayout)
-        {
-            var p:Point = item.actualPosition;
-            var s:Point = item.actualSize;
-            return new Rectangle(p.x, p.y, s.x, s.y);
+    private static function layoutElementBounds(g:GroupBase, i:int):Rectangle
+    {
+        var element:ILayoutElement = g.getLayoutElementAt(i);
+        if (element && element.includeInLayout)
+        {
+            return new Rectangle(element.getLayoutPositionX(),
+                                 element.getLayoutPositionY(),
+                                 element.getLayoutWidth(),
+                                 element.getLayoutHeight());
         }
         return null;
     }

     /**
      *  Returns the actual position/size Rectangle of the first partially
-     *  visible or not-visible, non-null includeInLayout item, beginning
-     *  with the item at index i, searching in direction dir (dir must
+     *  visible or not-visible, non-null includeInLayout element, beginning
+     *  with the element at index i, searching in direction dir (dir must
      *  be +1 or -1).   The last argument is the GroupBase scrollRect, it's
      *  guaranteed to be non-null.
      *
-     *  Returns null if no such item can be found.
+     *  Returns null if no such element can be found.
      *
      *  @private
      */
-    private function findLayoutItemBounds(g:GroupBase, i:int, dir:int, r:Rectangle):Rectangle
-    {
-        var n:int = g.numLayoutItems;
+    private function findLayoutElementBounds(g:GroupBase, i:int, dir:int, r:Rectangle):Rectangle
+    {
+        var n:int = g.numLayoutElements;

         if (inView(i) >= 1)
             i = Math.max(0, Math.min(n - 1, i + dir));

         while((i >= 0) && (i < n))
         {
-           var itemR:Rectangle = layoutItemBounds(g, i);
+           var elementR:Rectangle = layoutElementBounds(g, i);
            // Special case: if the scrollRect r _only_ contains
-           // itemR, then if we're searching left (dir == -1),
-           // and itemR's left edge is visible, then try again
+           // elementR, then if we're searching left (dir == -1),
+           // and elementR's left edge is visible, then try again
            // with i-1.   Likewise for dir == +1.
-           if (itemR)
+           if (elementR)
            {
-               var overlapsLeft:Boolean = (dir == -1) && (itemR.left == r.left) && (itemR.right >= r.right);
-               var overlapsRight:Boolean = (dir == +1) && (itemR.right == r.right) && (itemR.left <= r.left);
+               var overlapsLeft:Boolean = (dir == -1) && (elementR.left == r.left) && (elementR.right >= r.right);
+               var overlapsRight:Boolean = (dir == +1) && (elementR.right == r.right) && (elementR.left <= r.left);
                if (!(overlapsLeft || overlapsRight))
-                   return itemR;
+                   return elementR;
            }
            i += dir;
         }
@@ -649,26 +649,26 @@
      *
      *

      *  LEFT
-     *  If the firstIndexInView item is partially visible then top justify
-     *  it, otherwise top justify the item at the previous index.
+     *  If the firstIndexInView element is partially visible then top justify
+     *  it, otherwise top justify the element at the previous index.
      *

      *
      *

      *  RIGHT
-     *  If the lastIndexInView item is partially visible, then bottom justify
-     *  it, otherwise bottom justify the item at the following index.
+     *  If the lastIndexInView element is partially visible, then bottom justify
+     *  it, otherwise bottom justify the element at the following index.
      *

      *
      *  PAGE_UP
      *

-     *  If the firstIndexInView item is partially visible, then bottom
-     *  justify it, otherwise bottom justify item at the previous index.
+     *  If the firstIndexInView element is partially visible, then bottom
+     *  justify it, otherwise bottom justify element at the previous index.
      *

      *
      *

      *  PAGE_DOWN
-     *  If the lastIndexInView item is partially visible, then top
-     *  justify it, otherwise top justify item at the following index.
+     *  If the lastIndexInView element is partially visible, then top
+     *  justify it, otherwise top justify element at the following index.
      *

      *
      *

@@ -683,7 +683,7 @@
         if (!g)
             return 0;

-        var maxIndex:int = g.numLayoutItems -1;
+        var maxIndex:int = g.numLayoutElements -1;
         if (maxIndex < 0)
             return 0;

@@ -691,49 +691,49 @@
         if (!scrollR)
             return 0;

-        var itemR:Rectangle = null;
+        var elementR:Rectangle = null;
         switch(unit)
         {
             case ScrollUnit.LEFT:
             case ScrollUnit.PAGE_LEFT:
-                itemR = findLayoutItemBounds(g, firstIndexInView, -1, scrollR);
+                elementR = findLayoutElementBounds(g, firstIndexInView, -1, scrollR);
                 break;

             case ScrollUnit.RIGHT:
             case ScrollUnit.PAGE_RIGHT:
-                itemR = findLayoutItemBounds(g, lastIndexInView, +1, scrollR);
+                elementR = findLayoutElementBounds(g, lastIndexInView, +1, scrollR);
                 break;

             default:
                 return super.getHorizontalScrollPositionDelta(unit);
         }

-        if (!itemR)
+        if (!elementR)
             return 0;

         var delta:Number = 0;
         switch (unit)
         {
             case ScrollUnit.LEFT:
-                delta = Math.max(-scrollR.width, itemR.left - scrollR.left);
+                delta = Math.max(-scrollR.width, elementR.left - scrollR.left);
                 break;

             case ScrollUnit.RIGHT:
-                delta = Math.min(scrollR.width, itemR.right - scrollR.right);
+                delta = Math.min(scrollR.width, elementR.right - scrollR.right);
                 break;

             case ScrollUnit.PAGE_LEFT:
-                if ((itemR.left < scrollR.left) && (itemR.right >= scrollR.right))
-                    delta = Math.max(-scrollR.width, itemR.left - scrollR.left);
+                if ((elementR.left < scrollR.left) && (elementR.right >= scrollR.right))
+                    delta = Math.max(-scrollR.width, elementR.left - scrollR.left);
                 else
-                    delta = itemR.right - scrollR.right;
+                    delta = elementR.right - scrollR.right;
                 break;

             case ScrollUnit.PAGE_RIGHT:
-                if ((itemR.left <= scrollR.left) && (itemR.right > scrollR.right))
-                    delta = Math.min(scrollR.width, itemR.right - scrollR.right);
+                if ((elementR.left <= scrollR.left) && (elementR.right > scrollR.right))
+                    delta = Math.min(scrollR.width, elementR.right - scrollR.right);
                 else
-                    delta = itemR.left - scrollR.left;
+                    delta = elementR.left - scrollR.left;
                 break;
         }

@@ -752,25 +752,25 @@
         var visibleColumns:uint = 0;
         var reqColumns:int = requestedColumnCount;

-        var count:uint = layoutTarget.numLayoutItems;
-        var totalCount:uint = count; // How many items will be laid out
+        var count:uint = layoutTarget.numLayoutElements;
+        var totalCount:uint = count; // How many elements will be laid out
         for (var i:int = 0; i < count; i++)
         {
-            var li:ILayoutItem = layoutTarget.getLayoutItemAt(i);
-            if (!li || !li.includeInLayout)
+            var le:ILayoutElement = layoutTarget.getLayoutElementAt(i);
+            if (!le || !le.includeInLayout)
             {
             	totalCount--;
                 continue;
             }

-            preferredHeight = Math.max(preferredHeight, li.preferredSize.y);
-            preferredWidth += li.preferredSize.x;
+            preferredHeight = Math.max(preferredHeight, le.getPreferredHeight());
+            preferredWidth += le.getPreferredWidth();

             var vcr:Boolean = (reqColumns != -1) && (visibleColumns < reqColumns);
             if (vcr || (reqColumns == -1))
             {
-                var mw:Number =  hasPercentWidth(li) ? li.minSize.x : li.preferredSize.x;
-                var mh:Number = hasPercentHeight(li) ? li.minSize.y : li.preferredSize.y;
+                var mw:Number = hasPercentWidth(le)  ? le.getMinWidth() : le.getPreferredWidth();
+                var mh:Number = hasPercentHeight(le) ? le.getMinHeight() : le.getPreferredHeight();
                 minWidth += mw;
                 minHeight = Math.max(minHeight, mh);
             }
@@ -801,7 +801,7 @@

     private function fixedColumnWidthMeasure(layoutTarget:GroupBase):void
     {
-        var cols:uint = layoutTarget.numLayoutItems;
+        var cols:uint = layoutTarget.numLayoutElements;
         var visibleCols:uint = (requestedColumnCount == -1) ? cols : requestedColumnCount;

         var cw:Number = columnWidth; // can be expensive to compute
@@ -813,14 +813,14 @@
         if (isNaN(rowHeight))
         {
 			minRowHeight = rowHeight = 0;
-	        var count:uint = layoutTarget.numLayoutItems;
+	        var count:uint = layoutTarget.numLayoutElements;
 	        for (var i:int = 0; i < count; i++)
 	        {
-	            var layoutItem:ILayoutItem = layoutTarget.getLayoutItemAt(i);
-	            if (!layoutItem || !layoutItem.includeInLayout) continue;
-	            rowHeight = Math.max(rowHeight, layoutItem.preferredSize.y);
-	            var itemMinHeight:Number = hasPercentHeight(layoutItem) ? layoutItem.minSize.y : layoutItem.preferredSize.y;
-	            minRowHeight = Math.max(minRowHeight, itemMinHeight);
+	            var layoutElement:ILayoutElement = layoutTarget.getLayoutElementAt(i);
+	            if (!layoutElement || !layoutElement.includeInLayout) continue;
+	            rowHeight = Math.max(rowHeight, layoutElement.getPreferredHeight());
+	            var elementMinHeight:Number = hasPercentHeight(layoutElement) ? layoutElement.getMinHeight() : layoutElement.getPreferredHeight();
+	            minRowHeight = Math.max(minRowHeight, elementMinHeight);
 	        }
         }

@@ -853,12 +853,12 @@
         if (!layoutTarget)
             return;

-        var layoutItem:ILayoutItem;
-        var count:uint = layoutTarget.numLayoutItems;
+        var layoutElement:ILayoutElement;
+        var count:uint = layoutTarget.numLayoutElements;

         // If verticalAlign is top, we don't need to figure out the contentHeight.
-        // Otherwise the contentHeight is used to position the item and even size
-        // the item if it's "contentJustify" or "justify".
+        // Otherwise the contentHeight is used to position the element and even size
+        // the element if it's "contentJustify" or "justify".
         var contentHeight:Number = unscaledHeight;

@@ -869,22 +869,22 @@
         {
             for (var i:int = 0; i < count; i++)
             {
-                layoutItem = layoutTarget.getLayoutItemAt(i);
-                if (!layoutItem || !layoutItem.includeInLayout)
+                layoutElement = layoutTarget.getLayoutElementAt(i);
+                if (!layoutElement || !layoutElement.includeInLayout)
                     continue;

-                var layoutItemHeight:Number;
-                if (hasPercentHeight(layoutItem))
-                    layoutItemHeight = calculatePercentHeight(layoutItem, unscaledHeight);
+                var layoutElementHeight:Number;
+                if (hasPercentHeight(layoutElement))
+                    layoutElementHeight = calculatePercentHeight(layoutElement, unscaledHeight);
                 else
-                    layoutItemHeight = layoutItem.preferredSize.y;
+                    layoutElementHeight = layoutElement.getPreferredHeight();

-                contentHeight = Math.max(contentHeight, layoutItemHeight);
+                contentHeight = Math.max(contentHeight, layoutElementHeight);
             }
         }

-        // If we're justifying the items, then all heights should be set to
-        // unscaledHeight.  If we're content justifying the items, then
+        // If we're justifying the elements, then all heights should be set to
+        // unscaledHeight.  If we're content justifying the elements, then
         // all heights should be set to the contentHeight.
         // Otherwise restrictedHeight is ignored in distributedWidth.
         var restrictedHeight:Number;
@@ -902,15 +902,15 @@
         else if (verticalAlign == VerticalAlign.BOTTOM)
             vAlign = 1;

-        // If columnCount wasn't set, then as the LayoutItems are positioned
+        // If columnCount wasn't set, then as the LayoutElements are positioned
         // we'll count how many columns fall within the layoutTarget's scrollRect
         var visibleColumns:uint = 0;
         var minVisibleX:Number = layoutTarget.horizontalScrollPosition;
         var maxVisibleX:Number = minVisibleX + unscaledWidth

-        // Finally, position the LayoutItems and find the first/last
+        // Finally, position the LayoutElements and find the first/last
         // visible indices, the content size, and the number of
-        // visible items.
+        // visible elements.
         var x:Number = 0;
         var maxX:Number = 0;
         var maxY:Number = 0;
@@ -919,17 +919,17 @@

         for (var index:int = 0; index < count; index++)
         {
-            layoutItem = layoutTarget.getLayoutItemAt(index);
-            if (!layoutItem || !layoutItem.includeInLayout)
+            layoutElement = layoutTarget.getLayoutElementAt(index);
+            if (!layoutElement || !layoutElement.includeInLayout)
                 continue;

-            // Set the layout item's position
-            var y:Number = (contentHeight - layoutItem.actualSize.y) * vAlign;
-            layoutItem.setActualPosition(x, y);
+            // Set the layout element's position
+            var y:Number = (contentHeight - layoutElement.getLayoutHeight()) * vAlign;
+            layoutElement.setLayoutPosition(x, y);

             // Update maxX,Y, first,lastVisibleIndex, and x
-            var dx:Number = layoutItem.actualSize.x;
-            var dy:Number = layoutItem.actualSize.y;
+            var dx:Number = layoutElement.getLayoutWidth();
+            var dy:Number = layoutElement.getLayoutHeight();
             maxX = Math.max(maxX, x + dx);
             maxY = Math.max(maxY, y + dy);
             if (!clipContent ||
@@ -970,45 +970,45 @@
         var spaceToDistribute:Number = width;
         var totalPercentWidth:Number = 0;
         var childInfoArray:Array = [];
-        var childInfo:HLayoutItemFlexChildInfo;
+        var childInfo:HLayoutElementFlexChildInfo;
         var newHeight:Number;
-        var layoutItem:ILayoutItem;
+        var layoutElement:ILayoutElement;

         // columnWidth can be expensive to compute
         var cw:Number = (variableColumnWidth) ? 0 : columnWidth;
-        var count:uint = target.numLayoutItems;
-        var totalCount:uint = count; // number of items to use in gap calculation
+        var count:uint = target.numLayoutElements;
+        var totalCount:uint = count; // number of elements to use in gap calculation

         // If the child is flexible, store information about it in the
         // childInfoArray. For non-flexible children, just set the child's
         // width and height immediately.
         for (var index:int = 0; index < count; index++)
         {
-            layoutItem = target.getLayoutItemAt(index);
-            if (!layoutItem || !layoutItem.includeInLayout)
+            layoutElement = target.getLayoutElementAt(index);
+            if (!layoutElement || !layoutElement.includeInLayout)
             {
                 totalCount--;
                 continue;
             }

-            if (hasPercentWidth(layoutItem) && variableColumnWidth)
+            if (hasPercentWidth(layoutElement) && variableColumnWidth)
             {
-                totalPercentWidth += layoutItem.percentWidth;
-
-                childInfo = new HLayoutItemFlexChildInfo();
-                childInfo.layoutItem = layoutItem;
-                childInfo.percent    = layoutItem.percentWidth;
-                childInfo.min        = layoutItem.minSize.x;
-                childInfo.max        = layoutItem.maxSize.x;
+                totalPercentWidth += layoutElement.percentWidth;
+
+                childInfo = new HLayoutElementFlexChildInfo();
+                childInfo.layoutElement = layoutElement;
+                childInfo.percent    = layoutElement.percentWidth;
+                childInfo.min        = layoutElement.getMinWidth();
+                childInfo.max        = layoutElement.getMaxWidth();

                 childInfoArray.push(childInfo);
             }
             else
             {
-                sizeLayoutItem(layoutItem, height, verticalAlign,
+                sizeLayoutElement(layoutElement, height, verticalAlign,
                                restrictedHeight, NaN, variableColumnWidth, cw);

-                spaceToDistribute -= layoutItem.actualSize.x;
+                spaceToDistribute -= layoutElement.getLayoutWidth();
             }
         }

@@ -1025,7 +1025,7 @@

             for each (childInfo in childInfoArray)
             {
-                sizeLayoutItem(childInfo.layoutItem, height, verticalAlign,
+                sizeLayoutElement(childInfo.layoutElement, height, verticalAlign,
                                restrictedHeight, childInfo.size,
                                variableColumnWidth, cw);
             }
@@ -1038,10 +1038,10 @@

 [ExcludeClass]

-import mx.layout.ILayoutItem;
+import mx.layout.ILayoutElement;
 import mx.containers.utilityClasses.FlexChildInfo;

-class HLayoutItemFlexChildInfo extends FlexChildInfo
+class HLayoutElementFlexChildInfo extends FlexChildInfo
 {
-    public var layoutItem:ILayoutItem;
+    public var layoutElement:ILayoutElement;
 }


Adding missing return statement during server response validation.

--- AS3WebSocket/src/com/worlize/websocket/WebSocket.as
+++ AS3WebSocket/src/com/worlize/websocket/WebSocket.as
@@ -698,6 +698,7 @@
 			}
 			if (!keyValidated) {
 				failHandshake("Unable to validate server response for Sec-Websocket-Accept header.");
+				return;
 			}

 			if (debug) {
@@ -808,4 +809,4 @@
 		}

 	}
-}+}


Changed how initial layout is performed: now checks to see if there are children present because of inline MXML components.

--- frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
+++ frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
@@ -106,7 +106,9 @@
 			// if the host component is not being sized by percentage, go ahead and complete the setup.
 			if (isNaN((host as UIBase).percentHeight) && isNaN((host as UIBase).percentWidth)) {
 				completeSetup();
-				performLayout(event);
+
+				var num:Number = contentView.numElements;
+				if (num > 0) performLayout(event);
 			}
 			else {
 				// otherwise, wait until the size has been set and then finish
@@ -118,7 +120,9 @@
 		{
 			host.removeEventListener(event.type, deferredSizeHandler);
 			completeSetup();
-			performLayout(event);
+
+			var num:Number = contentView.numElements;
+			if (num > 0) performLayout(event);
 		}

 		protected function completeSetup():void


Transferred from the Adobe Open Source Subversion Repository

Revision: 21356
Author:   deeptika@adobe.com
Date:     2011-06-08T08:23:19.610911Z

Log Message:
-----------
For grouped columns, we create all columns in the beginning. So we need to add all columns width while computing list sub content's width.
QE notes:
Doc notes:
Bugs: FLEXDMV-2597 (ADG Focus Border disappears when tabbing focus using Grouped Columns)
Reviewer:
Tests run:
Is noteworthy for integration:

Modified Paths:
--------------
/private/flex/sdk/branches/4.y/frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGridBaseEx.as

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1290333 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGridBaseEx.as
+++ frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGridBaseEx.as
@@ -2147,10 +2147,67 @@
     {
         super.adjustListContent(unscaledWidth, unscaledHeight);

+		if(getOptimumColumns() != visibleColumns)
+		{
+			var n:int = displayableColumns.length;
+			var listSubContentWidth:int = 0;
+			for(var i:int = lockedColumnCount; i < n; i++)
+			{
+				listSubContentWidth += displayableColumns[i].width;
+			}
+
+			listSubContentWidth += getLastColumnResidualWidth() + 50; //Adding default sort renderer's width
+			listSubContent.setActualSize(listSubContentWidth,unscaledHeight);
+		}
+
         // listSubContent scrollRect needs to be updated whenever
         // listContent size is adjusted
         updateSubContent();
     }
+
+	/**
+	 *  @private
+	 */
+	private function getLastColumnResidualWidth():Number
+	{
+		var n:int = displayableColumns.length-1;
+		var displayWidth:int = unscaledWidth - viewMetrics.right - viewMetrics.left;
+		var totalWidth:Number = 0;
+		var i:int;
+		var numLockCols:int = Math.max(0, lockedColumnCount);
+
+		//Find the scrollable width i.e displayWidth - { sum of width of locked columns}
+		if (numLockCols > 0 && numLockCols < visibleColumns.length)
+		{
+			for (i = 0; i < numLockCols; i++)
+			{
+				displayWidth -= displayableColumns[i].width;
+			}
+		}
+
+		// Starting from the right most column in the displayableColumns array
+		// find out how many columns we will be able to
+		// accumulate and how much width they will take
+		// when horizontal scroll bar is at the rightmost end
+		if (n>=0)
+		{
+			totalWidth = (isNaN(displayableColumns[n].explicitWidth) ? displayableColumns[n].preferredWidth : displayableColumns[n].explicitWidth);
+		}
+
+		for (i = n-1; i >= numLockCols; i--)
+		{
+			if (totalWidth + displayableColumns[i].width <= displayWidth)
+				totalWidth += displayableColumns[i].width;
+			else
+				break;
+		}
+
+		// The residual width is the width which should be added to
+		// the last column apriori, so that in future when we have horizontally
+		// scrolled to the right most position we don't need to create larger
+		// items for that column
+		return displayWidth - totalWidth;
+	}

     // horizontal page up, page down
     /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1281795 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/gridClasses/GridSortField.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/GridSortField.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

 package spark.components.gridClasses
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 2668
Author:   kelin@adobe.com
Date:     2008-07-30T21:05:00.806335Z

Log Message:
-----------
Massive check-in:

Updated Range, TrackBase, Slider, Spinner to use valueInterval to constrain values. In Slider, snapInterval was removed in favor of just using stepSize (for simplicity). TrackBase also is able to handle a resizable thumb.

Refactored ScrollBar to subclass TrackBase instead of Range in order to share thumb dragging code. pageSize was also moved from Range into ScrollBar.

Added a basic version of NumericStepper that can handle simple operations like committing the value when the enter key is pressed.

Skins for each of the components were also updated/added as needed. I also updated flex4test/CircularScrollBar.

QE: Yes!
Reviewer: Chet, Gordon, Jason

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/HSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/HSliderThumbSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/HScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/HScrollBarSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/Range.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/VSliderTrackSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/VScrollBarTrackSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/TrackBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/skins/MyVScrollBarSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/Flex4Classes.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/mxml-2009-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/defaults.css</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/NumericStepper.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/NumericStepperSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/VSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/gumbo-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/VScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/SpinnerDecrButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/VSliderThumbSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/VScrollBarSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/Spinner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/SpinnerSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/HSliderTrackSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/HScrollBarTrackSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/flex4test.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/SpinnerIncrButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/components/CircularScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/skins/CircularScrollBarSkin.mxml</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1282902 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as
@@ -15,9 +15,9 @@
 import flash.events.Event;
 import flash.events.KeyboardEvent;
 import flash.events.MouseEvent;
+import flash.geom.Point;
 import flash.ui.Keyboard;
-import flash.geom.Point;
-import mx.logging.AbstractTarget;
+
 import mx.managers.IFocusManagerComponent;

 /**
@@ -62,8 +62,9 @@
     private var _liveDragging:Boolean = false;

     /**
-     *  When liveDragging is enabled, the thumb's value is committed as it is
-     *  dragged along the track instead of when the thumb is released.
+     *  When liveDragging is enabled, the thumb's value is
+     *  committed as it is dragged along the track instead
+     *  of when the thumb is released.
      *
      *  @default false
      */
@@ -85,7 +86,6 @@

     /**
      *  @private
-     *  Sets the focus onto the thumb.
      */
     override public function setFocus():void
     {
@@ -106,7 +106,18 @@
                                    thumb_keyboardHandler);
         }
     }
-
+
+    /**
+     *  Converts a point retrieved from clicking on the track
+     *  into a position. This allows subclasses to center
+     *  their thumb when clicking on the track.
+     */
+    protected function pointClickToPosition(localX:Number,
+                                            localY:Number):Number
+    {
+        return 0;
+    }
+
     //--------------------------------------------------------------------------
     //
     // Event Handlers
@@ -165,15 +176,18 @@
     //---------------------------------

     /**
-     *  Handle keyboard events. Left/Down decreases the value by snapInterval
-     *  or if snapInterval is 0 then it decreases the value by stepSize. The
-     *  opposite for Right/Up arrows. The Home and End keys set the value
+     *  Handle keyboard events. Left/Down decreases the value
+     *  decreases the value by stepSize. The opposite for
+     *  Right/Up arrows. The Home and End keys set the value
      *  to the min and max respectively.
      */
     protected function thumb_keyboardHandler(event:KeyboardEvent):void
     {
-        // TODO: Perhaps provide a way to easily override the keyboard
-        // behavior. Consider reversed HSliders or VSliders.
+        // TODO: Provide a way to easily override the keyboard
+        // behavior. This means having a callback in the subclasses
+        // that tell the superclass all the positions in an array
+        // but defaulting to the normal stepping behavior when no
+        // array is returned. Consider reversed HSliders or VSliders.
         var prevValue:Number = this.value;
         var newValue:Number;

@@ -182,39 +196,21 @@
             case Keyboard.DOWN:
             case Keyboard.LEFT:
             {
-                if (snapInterval > 0)
-                {
-                    newValue = nearestValidValue(value - snapInterval);
-                    positionThumb(valueToPosition(newValue));
-                    setValue(newValue);
-                }
-                else
-                {
-                    newValue = nearestValidValue(value - stepSize);
-                    positionThumb(valueToPosition(newValue));
-                    setValue(newValue);
-                }
+                newValue = nearestValidValue(value - stepSize, stepSize);
+                positionThumb(valueToPosition(newValue));
+                setValue(newValue);
                 break;
             }

             case Keyboard.UP:
             case Keyboard.RIGHT:
             {
-                if (snapInterval > 0)
-                {
-                    newValue = nearestValidValue(value + snapInterval);
-                    positionThumb(valueToPosition(newValue));
-                    setValue(newValue);
-                }
-                else
-                {
-                    newValue = nearestValidValue(value + stepSize);
-                    positionThumb(valueToPosition(newValue));
-                    setValue(newValue);
-                }
-                break;
-            }
-
+                newValue = nearestValidValue(value + stepSize, stepSize);
+                positionThumb(valueToPosition(newValue));
+                setValue(newValue);
+                break;
+            }
+
             case Keyboard.HOME:
             {
                 value = minimum;
@@ -232,15 +228,15 @@
             dispatchEvent(new Event("change"));
     }

-
     //---------------------------------
     // Track down handlers
     //---------------------------------

     /**
-     *  Handle mouse-down events for the slider track. We calculate the
-     *  value based on the new position and then move the thumb to the
-     *  correct location as well as commit the value.
+     *  Handle mouse-down events for the slider track. We
+     *  calculate the value based on the new position and then
+     *  move the thumb to the correct location as well as
+     *  commit the value.
      */
     override protected function track_mouseDownHandler(event:MouseEvent):void
     {
@@ -249,10 +245,10 @@

         // Calculate the new value.
         var pt:Point = new Point(event.stageX, event.stageY);
-        pt = globalToLocal(pt);
-        var tempPosition:Number = pointToPosition(pt.x, pt.y);
+        pt = track.globalToLocal(pt);
+        var tempPosition:Number = pointClickToPosition(pt.x, pt.y);
         var tempValue:Number = positionToValue(tempPosition);
-        var RtempValue:Number = nearestValidValue(tempValue);
+        var RtempValue:Number = nearestValidValue(tempValue, valueInterval);

         // Move the thumb to the new value
         positionThumb(valueToPosition(RtempValue));


starting to add support for var; not done yet

--- WeaveCore/src/weave/compiler/Compiler.as
+++ WeaveCore/src/weave/compiler/Compiler.as
@@ -81,10 +81,10 @@

 		private static const _statementsWithoutParams:Array = [
 			ST_ELSE, ST_DO, ST_BREAK, ST_CONTINUE, ST_CASE, ST_DEFAULT,
-			ST_TRY, ST_FINALLY, ST_VAR, ST_RETURN, ST_THROW
+			ST_TRY, ST_FINALLY, ST_RETURN, ST_THROW, ST_VAR
 		];
 		private static const _statementsWithParams:Array = [
-			ST_IF, ST_FOR, ST_FOR_EACH, ST_WHILE, ST_SWITCH, ST_CATCH
+			ST_IF, ST_FOR, ST_EACH, ST_FOR_EACH, ST_WHILE, ST_SWITCH, ST_CATCH
 		];

 		/**
@@ -130,6 +130,12 @@
 		 * Used in conjunction with _validStatementPatterns.
 		 */
 		private static const PN_EXPR:String = 'EXPR';
+
+		/**
+		 * may only contain one expression, optionally enclosed in (), no statements.
+		 * Used in conjunction with _validStatementPatterns.
+		 */
+		private static const PN_VARS:String = 'VARS';

 		/**
 		 * longer patterns appear earlier so they will match before shorter patterns when checked in order
@@ -148,7 +154,8 @@
 			[ST_CONTINUE],
 			[ST_RETURN, PN_EXPR],
 			[ST_RETURN],
-			[ST_THROW, PN_EXPR]
+			[ST_THROW, PN_EXPR],
+			[ST_VAR, PN_VARS]
 		];

 		/**
@@ -184,11 +191,6 @@
 		private const ASSIGN_OP_LOOKUP:Object = new Dictionary(); // Function -> true
 		private const PURE_OP_LOOKUP:Dictionary = new Dictionary(); // Function -> true
 		private const MAX_OPERATOR_LENGTH:int = 4;
-
-		/**
-		 * While this is set to true, compiler optimizations are enabled.
-		 */
-		public var enableOptimizations:Boolean = true;

 		/**
 		 * This is a list of objects and/or classes containing functions and constants supported by the compiler.
@@ -239,7 +241,7 @@
 		{
 			var tokens:Array = getTokens(expression);
 			//trace("source:", expression, "tokens:" + tokens.join(' '));
-			var compiledObject:ICompiledObject = optimize(compileTokens(tokens, true));
+			var compiledObject:ICompiledObject = finalize(compileTokens(tokens, true));
 			return compileObjectToFunction(compiledObject, symbolTable, ignoreRuntimeErrors, useThisScope, paramNames, paramDefaults);
 		}

@@ -251,7 +253,7 @@
 		 */
 		public function compileToObject(expression:String):ICompiledObject
 		{
-			return optimize(compileTokens(getTokens(expression), true));
+			return finalize(compileTokens(getTokens(expression), true));
 		}

 		// TODO: includeLibrary(sourceSymbolTable, destinationSymbolTable) where it copies all the properties of source to destination
@@ -420,6 +422,7 @@
 					a.push(k);
 				return a;
 			};
+			operators[ST_VAR] = function(..._):*{};
 			// loop statements
 			operators[ST_DO] = function(x:*, y:*):* { return x && y; };
 			operators[ST_WHILE] = function(x:*, y:*):* { return x && y; };
@@ -1126,7 +1129,7 @@

 				if (leftBracket == '{')
 				{
-					// It's ok if it creates an extra {} wrapper because optimize() will take care of that.
+					// It's ok if it creates an extra {} wrapper because finalize() will take care of that.
 					// It's important to remember that the brackets existed for statement processing.
 					tokens.splice(open, 2, compileOperator(';', [compileTokens(subArray, true)]));

@@ -1164,10 +1167,9 @@
 						var functionParams:Object = {};
 						functionParams[FUNCTION_PARAM_NAMES] = variableNames;
 						functionParams[FUNCTION_PARAM_VALUES] = variableValues;
-						functionParams[FUNCTION_CODE] = optimize(tokens[open]);
+						functionParams[FUNCTION_CODE] = finalize(tokens[open]);
 						call = compileOperator(FUNCTION, [new CompiledConstant(null, functionParams)]);
-						call.originalTokens = tokens.slice(open - 2, open + 1);
-						tokens.splice(open - 2, 3, call);
+						call.originalTokens = tokens.splice(open - 2, 3, call);
 						continue;
 					}

@@ -1222,21 +1224,12 @@

 				// '{' or '(' group that does not correspond to a function call

-				if (leftBracket == '(' && compiledParams.length == 0)
+				if (leftBracket == '(' && compiledParams.length == 0 && token != FUNCTION)
 					throw new Error("Missing expression inside parentheses");

-				if (enableOptimizations && compiledParams.length == 1 && separator == ',')
-				{
-					// simplify to single expression
-					tokens.splice(open, 2, compiledParams[0]);
-				}
-				else
-				{
-					// cannot be simplified at the moment -- multiple commands or statement params
-					if (leftBracket == '(' && statements.hasOwnProperty(token) && statements[token])
-						separator = '('; // statement params
-					tokens.splice(open, 2, compileOperator(separator, compiledParams));
-				}
+				if (leftBracket == '(' && statements.hasOwnProperty(token) && statements[token])
+					separator = '('; // statement params
+				tokens.splice(open, 2, compileOperator(separator, compiledParams));
 			}
 		}

@@ -1285,7 +1278,7 @@
 		private function compileVariable(variableName:String):Object
 		{
 			// do not treat statement keywords as variable names
-			if (statements.hasOwnProperty(variableName))
+			if (statements.hasOwnProperty(variableName) || operators.hasOwnProperty(variableName))
 				return variableName;
 			return new CompiledFunctionCall(new CompiledConstant(variableName, variableName), null); // params are null as a special case
 		}
@@ -1517,6 +1510,8 @@
 				return;
 			}

+			var varNames:Array;
+
 			// find a matching statement pattern
 			nextPattern: for each (var pattern:Array in _validStatementPatterns)
 			{
@@ -1555,13 +1550,69 @@
 						if (!call || call.evaluatedMethod != operators[';'])
 							throwInvalidSyntax(stmt);
 					}
+
+					if (type == PN_VARS)
+					{
+						// must be function call
+						if (tokenIsStatement(token) || !call)
+							throwInvalidSyntax(stmt);
+
+						// must be local variable/assignment or list of local variables/assignments
+
+						// if there is only a single variable, wrap it in an operator ',' call
+						if (!call.compiledParams || call.evaluatedMethod == operators['='])
+							tokens[startIndex + i] = token = call = compileOperator(',', [call]);
+
+						// special case for "x = 3;" which becomes {x = 3}
+						if (call.evaluatedMethod == operators[';'] && call.compiledParams.length == 1)
+						{
+							call.compiledMethod = new CompiledConstant(',', operators[',']);
+							call.evaluateConstants();
+						}
+
+						if (call.evaluatedMethod != operators[','] || call.compiledParams.length == 0)
+							throwInvalidSyntax(stmt);
+
+						varNames = [];
+						for (var i:int = 0; i < call.compiledParams.length; i++)
+						{
+							var variable:CompiledFunctionCall = call.compiledParams[i] as CompiledFunctionCall;
+							if (!variable)
+								throwInvalidSyntax(stmt);
+
+							if (!variable.compiledParams) // local initialization
+							{
+								// variable initialization only -- remove from ',' params
+								call.compiledParams.splice(i--, 1);
+								varNames.push(variable.evaluatedMethod);
+							}
+							else if (variable.evaluatedMethod == operators['='] && variable.compiledParams.length == 2) // local assignment
+							{
+								varNames.push(variable.evaluatedParams[0]);
+							}
+							else
+								throwInvalidSyntax(stmt);
+						}
+					}
 				}

 				// found matching pattern
 				var originalTokens:Array = tokens.slice(startIndex, startIndex + pattern.length);
 				var params:Array = tokens.splice(startIndex + 1, pattern.length - 1);

-				if (stmt == ST_IF) // if (cond) {stmt} else {stmt}
+				if (stmt == ST_VAR)
+				{
+					token = compileOperator(ST_VAR, [new CompiledConstant(null, varNames)]);
+					call = params[0];
+					if (call.compiledParams.length > 0)
+					{
+						call.compiledParams.unshift(token);
+						call.evaluateConstants();
+						token = call;
+					}
+					tokens[startIndex] = token;
+				}
+				else if (stmt == ST_IF) // if (cond) {stmt} else {stmt}
 				{
 					// implemented as "cond ? true_stmt : false_stmt"
 					params.splice(2, 1); // works whether or not else is present
@@ -1616,7 +1667,7 @@
 				}
 				else
 				{
-					throw new Error(stmt + " not supported yet");
+					throw new Error(stmt + " not supported");
 				}

 				// save original token list for correct decompiling
@@ -1683,21 +1734,70 @@
 			return (JUMP_LOOKUP[method] || LOOP_LOOKUP[method])
 		}

-		private function optimize(compiledObject:ICompiledObject):ICompiledObject
+		/**
+		 * Call this to move all var declarations at the beginning of the code and perform optimizations on the compiled objects.
+		 * @param compiledObject An ICompiledObject to finalize.
+		 * @return A finialized/optimized version of compiledObject.
+		 */
+		private function finalize(compiledObject:ICompiledObject):ICompiledObject
+		{
+			var varLookup:Object = {};
+
+			compiledObject = _finalize(compiledObject, varLookup);
+
+			var names:Array = [];
+			for (var name:String in varLookup)
+				names.push(name);
+
+			if (names.length > 0)
+			{
+				// there is at least one var declaration, so we need to include it at the beginning.
+				var varDeclarations:CompiledFunctionCall = compileOperator(ST_VAR, [new CompiledConstant(null, names)]);
+				var call:CompiledFunctionCall = compiledObject as CompiledFunctionCall
+				if (call && call.evaluatedMethod == operators[';'])
+				{
+					call.compiledParams.unshift(varDeclarations);
+					call.evaluateConstants();
+				}
+				else
+					compiledObject = compileOperator(';', [varDeclarations, compiledObject]);
+			}
+			return compiledObject;
+		}
+		/**
+		 * @private helper function
+		 */
+		private function _finalize(compiledObject:ICompiledObject, varLookup:Object):ICompiledObject
 		{
 			if (compiledObject is CompiledConstant)
 				return compiledObject;

 			var call:CompiledFunctionCall = compiledObject as CompiledFunctionCall;
-
-			call.compiledMethod = optimize(call.compiledMethod);
+			call.compiledMethod = _finalize(call.compiledMethod, varLookup);
+			if (!call.compiledMethod)
+				throw new Error("Misplaced variable declaration");
 			var params:Array = call.compiledParams;
 			if (params)
+			{
 				for (var i:int = 0; i < params.length; i++)
-					params[i] = optimize(params[i]);
+				{
+					params[i] = _finalize(params[i], varLookup);
+					if (params[i] == null) // variable declaration eliminated?
+						params.splice(i--, 1);
+				}
+			}
 			call.evaluateConstants();

 			var method:Object = call.evaluatedMethod;
+
+			// remove var declarations from their current locations
+			if (method == operators[ST_VAR])
+			{
+				for each (var name:String in call.evaluatedParams[0])
+					varLookup[name] = true;
+				return null;
+			}
+
 			if (method == operators[';'] || method == operators[','] || method == operators['('])
 			{
 				if (params.length == 0)
@@ -1710,7 +1810,7 @@
 				{
 					if (debug)
 						trace('optimized unnecessary wrapper function call:',decompileObject(compiledObject));
-					return optimize(params[0]);
+					return _finalize(params[0], varLookup);
 				}
 			}

@@ -1864,6 +1964,11 @@
 					if (n == 3 && op == '?:') // ternary op
 						return StringUtil.substitute("({0} ? {1} : {2})", params);
 				}
+
+				if (op == ST_VAR)
+				{
+					return ST_VAR + ' ' + ((cParams[0] as CompiledConstant).value as Array).join(', ');
+				}
 			}

 			// normal function syntax
@@ -1907,16 +2012,20 @@

 			const builtInSymbolTable:Object = {};
 			builtInSymbolTable['eval'] = undefined;
+
 			// set up Array of symbol tables in the correct scope order: built-in, local, params, this, global
-			const allSymbolTables:Array = [
-				builtInSymbolTable,
-				null/*localSymbolTable*/,
-				symbolTable,
-				null/*this*/,
-				constants
-			];
-			const LOCAL_SYMBOL_TABLE_INDEX:int = 1;
-			const THIS_SYMBOL_TABLE_INDEX:int = 3;
+			const allSymbolTables:Array = [builtInSymbolTable]; // buit-in first
+			const LOCAL_SYMBOL_TABLE_INDEX:int = allSymbolTables.push(null) - 1; // placeholder
+
+			// add custom symbol table(s)
+			if (symbolTable is Array)
+				for each (var _symbolTable:Object in symbolTable)
+					allSymbolTables.push(_symbolTable);
+			else
+				allSymbolTables.push(symbolTable);
+
+			const THIS_SYMBOL_TABLE_INDEX:int = allSymbolTables.push(null) - 1; // placeholder
+			allSymbolTables.push(constants); // constants last

 			// this function avoids unnecessary function call overhead by keeping its own call stack rather than using recursion.
 			var wrapperFunction:Function = function():*
@@ -2085,12 +2194,16 @@
 							if (builtInSymbolTable.hasOwnProperty(symbolName))
 								throw new Error("Cannot assign built-in symbol: " + symbolName);

+							// find the most local symbol table that has the variable
+							for (i = LOCAL_SYMBOL_TABLE_INDEX; i <= THIS_SYMBOL_TABLE_INDEX; i++)
+								if (allSymbolTables[i] && allSymbolTables[i].hasOwnProperty(symbolName))
+									break;
+							// if no symbol table has the variable, create a new local variable
+							if (i > THIS_SYMBOL_TABLE_INDEX)
+								i = LOCAL_SYMBOL_TABLE_INDEX;
+
 							// assignment operator expects parameters like (host, ...chain, value)
-							// if there is no matching local variable and 'this' has a matching one, assign the property of 'this'
-							if (useThisScope && this && this.hasOwnProperty(symbolName) && !localSymbolTable.hasOwnProperty(symbolName))
-								result = method(this, symbolName, call.evaluatedParams[1]);
-							else // otherwise, assign local variable
-								result = method(localSymbolTable, symbolName, call.evaluatedParams[1]);
+							result = method(allSymbolTables[i], symbolName, call.evaluatedParams[1]);
 						}
 						else if (method is Class)
 						{
@@ -2116,11 +2229,30 @@
 							else // all other single-parameter type casting operations
 								result = method(call.evaluatedParams[0]);
 						}
-						else if (method == operators[FUNCTION])
+						else if (method == operators[ST_VAR]) // variable initialization
 						{
-							// inline function
+							for each (result in call.evaluatedParams[0])
+								if (!localSymbolTable.hasOwnProperty(result))
+									localSymbolTable[result] = undefined;
+							result = undefined;
+						}
+						else if (method == operators[FUNCTION]) // inline function definition
+						{
+							// x = 'x'; function(){ x = 3; return x; }() == x
+
+							var _symbolTables:Array = [localSymbolTable].concat(symbolTable); // works whether symbolTable is an Array or Object
+							if (useThisScope)
+								_symbolTables.push(this);
+
 							var funcParams:Object = call.evaluatedParams[0];
-							result = compileObjectToFunction(funcParams[FUNCTION_CODE], symbolTable, ignoreRuntimeErrors, useThisScope, funcParams[FUNCTION_PARAM_NAMES], funcParams[FUNCTION_PARAM_VALUES]);
+							result = compileObjectToFunction(
+								funcParams[FUNCTION_CODE],
+								_symbolTables,
+								ignoreRuntimeErrors,
+								useThisScope,
+								funcParams[FUNCTION_PARAM_NAMES],
+								funcParams[FUNCTION_PARAM_VALUES]
+							);
 						}
 						else
 						{
@@ -2233,7 +2365,8 @@
 				"for (i = 0; i < 10; i++) { if (i == 3) continue; trace(i); if (i == 5) break; } trace('done');",
 				"i = 0; do { if (i == 3) continue; trace(i); if (i == 5) break; } while (i >= 0 && ++i < 10) trace('done');",
 				"i = -1; while (++i < 10) { if (i == 3) continue; trace(i); if (i == 5) break; } trace('done');",
-				"a = []; o = Object('a',1,'b',2,'c',3,'d',4,'e',5); for (k in o) { a.push(`{k} = {o[k]}`); o['?'+k]=k+'!'; delete o[k]; } for each (p in o) a.push(p); return [a,o];"
+				"a = []; o = Object('a',1,'b',2,'c',3,'d',4,'e',5); for (k in o) { a.push(`{k} = {o[k]}`); o['?'+k]=k+'!'; delete o[k]; } for each (p in o) a.push(p); return [a,o];",
+				"x = 3; var x = 4; x"
 			];
 			var values:Array = [-2, -1, -0.5, 0, 0.5, 1, 2];
 			var vars:Object = {};
@@ -2261,11 +2394,9 @@
 				var recompiled:String = compiler.decompileObject(compiler.compileTokens(tokens2, true));
 				trace("recompiled:", recompiled);

-				compiler.enableOptimizations = true;
 				var tokens3:Array = compiler.getTokens(recompiled);
-				var optimized:String = compiler.decompileObject(compiler.compileTokens(tokens3, true));
-				trace(" optimized:", optimized);
-				compiler.enableOptimizations = false;
+				var decompiled2:String = compiler.decompileObject(compiler.compileTokens(tokens3, true));
+				trace("decompiled(2):", decompiled2);

 				var f:Function = compiler.compileToFunction(eq, vars, false);
 				for each (var value:* in values)


Dispatch onActionValueChanged events on keyUp/keyDown as well as GameInput control changes.


FLEX-12628 fixed whitspaces

FLEX-12628 fixed whitspaces

--- frameworks/projects/framework/src/mx/formatters/DateFormatter.as
+++ frameworks/projects/framework/src/mx/formatters/DateFormatter.as
@@ -347,11 +347,11 @@
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
-    public function DateFormatter(formatString : String = null)
+    public function DateFormatter(formatString:String = null)
     {
         super();

-		this.formatString = formatString;
+        this.formatString = formatString;
 	}

     //--------------------------------------------------------------------------


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1269844 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/skins/halo/NumericStepperUpSkin.as
+++ frameworks/projects/mx/src/mx/skins/halo/NumericStepperUpSkin.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2004-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  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
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      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.
 //
 ////////////////////////////////////////////////////////////////////////////////


Update menuIdiomes.as

Update menuIdiomes.as

--- com/segonquart/menuIdiomes.as
+++ com/segonquart/menuIdiomes.as
@@ -1,27 +1,27 @@
-import mx.transitions.easing.*;
-import com.mosesSupposes.fuse.*;
-
-	class com.menuIdiomes extends MovieClip
-
-	{
-		public var fr:MovieClip;
-
-		public function menuIdiomes ()
-		{
-			this.onRollOver = this.over;
-			this.onRollOut = this.out;
-			this.onRelease =this.over;
-		}
-
-		private function over ()
-		{
-			fr.colorTo ("#95C60D", 0.3, "easeOutCirc");
-		}
-
-		private function out ()
-		{
-			fr.colorTo ("#010101", 0.3, "easeInCirc");
-		}
-
-
-	}
+import mx.transitions.easing.*;
+import com.mosesSupposes.fuse.*;
+
+	class menuIdiomes extends MovieClip
+
+	{
+		public var fr:MovieClip;
+
+		public function menuIdiomes ()
+		{
+			this.onRollOver = this.over;
+			this.onRollOut = this.out;
+			this.onRelease =this.over;
+		}
+
+		private function over ()
+		{
+			fr.colorTo ("#95C60D", 0.3, "easeOutCirc");
+		}
+
+		private function out ()
+		{
+			fr.colorTo ("#010101", 0.3, "easeInCirc");
+		}
+
+
+	}


Transferred from the Adobe Open Source Subversion Repository

Revision: 515
Author:   smgilson@adobe.com
Date:     2008-02-13T19:29:19.302734Z

Log Message:
-----------
Remove @private from AbstractProducer.as and update ASDoc comments.

Update ASDoc comments on MessagePerformanceUtils.as

Checkin Test Passed: Yes
QA: No
Bug:
Doc: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/AbstractProducer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/messages/MessagePerformanceUtils.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1273964 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/rpc/src/mx/messaging/messages/MessagePerformanceUtils.as
+++ frameworks/projects/rpc/src/mx/messaging/messages/MessagePerformanceUtils.as
@@ -14,21 +14,38 @@
     import mx.messaging.messages.MessagePerformanceInfo;

     /**
-     * The MessagePerformanceUtils utility class is used to retrieve various metrics about
+     * The MessagePerformanceUtils class is used to retrieve various metrics about
      * the sizing and timing of a message sent from a client to the server and its
      * response message, as well as pushed messages from the server to the client.
-     * Metrics are gathered when corresponding properties on the channel used are enabled:
-     * <record-message-times> denotes capturing of timing information,
-     * <record-message-sizes> denotes capturing of sizing information.
+     *
+     *
Metrics are gathered when the following properties on the channel are set to true:
+     * <record-message-times> enables capturing of timing information,
+     * <record-message-sizes> enables capturing of sizing information.
+     * Set these parameters to true or false,
+     * where the default value is false.
+     * You can set them to different values to capture only one type of metrics.
+     * For example, the following channel definition specifies to capture message timing information,
+     * but not message sizing information:

+     *
+     *

+     * <channel-definition id="my-streaming-amf"
+     *     class="mx.messaging.channels.StreamingAMFChannel">
+     *     <endpoint
+     *         url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf"
+     *         class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
+     *     <properties>
+     *         <record-message-times>true</record-message-times>
+     *         <record-message-sizes>false</record-message-sizes>
+     *     </properties>
+     * </channel-definition>

      *
-     *
You can then use methods of this utility class to retrieve various performance information
-     * about the message that you have just received.

+     *
In your client application, you use the methods and properties of this class
+     * to retrieve performance metrics about received messages.

      *
      *
When these metrics are enabled an instance of this class should be created from
-     * a response, acknowledgement, or message handler via something like:

-     * @example
-     *

-     *      var mpiutil:MessagePerformanceUtils = new MessagePerformanceUtils(event.message);
+     * a response, acknowledgement, or message handler in the form:

+     *
+     *
var mpiutil:MessagePerformanceUtils = new MessagePerformanceUtils(event.message);
      *

      *
      */
@@ -85,13 +102,14 @@
         //--------------------------------------------------------------------------

         /**
-         * Constructor
-         *
-         * Creates an MPUtils instance with information from the MPI headers
-         * of the passed in message
-         *
-         * @param message The message whose MPI headers will be used in retrieving
-         * MPI information
+         * Constructor.
+         *
+         * Creates an MessagePerformanceUtils instance with information from
+         * the message received by the client.
+         *
+         * @param message The message received from the server.
+         * This can be a message pushed from the server, or an acknowledge message received
+         * by the client after the client pushed a message to the server.
          */
         public function MessagePerformanceUtils(message:Object):void
         {
@@ -117,10 +135,10 @@
         //--------------------------------------------------------------------------

         /**
-         * Time between this client sending a message and receiving a response
-         * for it from the server
-         *
-         * @return Total time in milliseconds
+         * Time, in milliseconds, between this client sending a message and
+         * receiving a response from the server.
+         *
+         * This property contains 0 for an RTMP channel.
          */
         public function get totalTime():Number
         {
@@ -131,29 +149,29 @@
         }

         /**
-         * Time between server receiving the client message and either the time
-         * the server responded to the received message or had the pushed message ready
-         * to be sent to the receiving client.
-         *
-         * @return Server processing time in milliseconds
+         * Time, in milliseconds, between server receiving the client message and
+         * either the time the server responded to the received message or has
+         * the pushed message ready to be sent to a receiving client.
+         * For example, for an acknowledge message, this is the time from when the server receives
+         * a message from the producer and sends the acknowledge message back to the producer.
+         * For a consumer that uses polling, it is the time between the arrival of
+         * the consumers polling message and any message returned in response to the poll.
          */
         public function get serverProcessingTime():Number
         {
             if (pushedMessageFlag)
             {
-            	return mpip.serverPrePushTime - mpip.receiveTime;
+                return mpip.serverPrePushTime - mpip.receiveTime;
             }
             else
             {
-            	return mpio.sendTime - mpii.receiveTime;
+                return mpio.sendTime - mpii.receiveTime;
             }
         }

         /**
-         * Time between server receiving the client message and the server beginning to push
-         * messages out to other clients as a result of the original message.
-         *
-         * @return Server pre-push processing time in milliseconds
+         * Time, in milliseconds, between the server receiving the client message
+         * and the server beginning to push the message out to other clients.
          */
         public function get serverPrePushTime():Number
         {
@@ -166,106 +184,112 @@
         }

         /**
-         * Time spent in the adapter associated with the destination for this message before
-         * either the response to the message was ready or the message had been prepared
-         * to be pushed to the receiving client.
-         *
-         * @return Server adapter processing time in milliseconds
+         * Processing time, in milliseconds, of the message by the adapter
+         * associated with the destination before either the response to
+         * the message was ready or the message has been prepared to be pushed
+         * to the receiving client.
+         * This corresponds to the time that the message was processed by your code
+         * on the server.
          */
-		public function get serverAdapterTime():Number
-		{
-			if (pushedMessageFlag)
-			{
-				if (mpip == null)
-					return 0;
-				if (mpip.serverPreAdapterTime == 0 || mpip.serverPostAdapterTime == 0)
-					return 0;
-
-				return mpip.serverPostAdapterTime - mpip.serverPreAdapterTime;
-			}
-			else
-			{
-				if (mpii == null)
-					return 0;
-				if (mpii.serverPreAdapterTime == 0 || mpii.serverPostAdapterTime == 0)
-					return 0;
-
-				return mpii.serverPostAdapterTime - mpii.serverPreAdapterTime;
-			}
-		}
+        public function get serverAdapterTime():Number
+        {
+            if (pushedMessageFlag)
+            {
+                if (mpip == null)
+                    return 0;
+                if (mpip.serverPreAdapterTime == 0 || mpip.serverPostAdapterTime == 0)
+                    return 0;
+
+                return mpip.serverPostAdapterTime - mpip.serverPreAdapterTime;
+            }
+            else
+            {
+                if (mpii == null)
+                    return 0;
+                if (mpii.serverPreAdapterTime == 0 || mpii.serverPostAdapterTime == 0)
+                    return 0;
+
+                return mpii.serverPostAdapterTime - mpii.serverPreAdapterTime;
+            }
+        }

         /**
-         * Time spent in a module invoked from the adapter associated with the destination for this message
-         * but external to it, before either the response to the message was ready or the message had been
-         * prepared to be pushed to the receiving client.
-         *
-         * @return Server adapter-external processing time in milliseconds
-         */
-		public function get serverAdapterExternalTime():Number
-		{
-			if (pushedMessageFlag)
-			{
-				if (mpip == null)
-					return 0;
-				if (mpip.serverPreAdapterExternalTime == 0 || mpip.serverPostAdapterExternalTime == 0)
-					return 0;
-
-				return mpip.serverPostAdapterExternalTime - mpip.serverPreAdapterExternalTime;
-			}
-			else
-			{
-				if (mpii == null)
-					return 0;
-				if (mpii.serverPreAdapterExternalTime == 0 || mpii.serverPostAdapterExternalTime == 0)
-					return 0;
-
-				return mpii.serverPostAdapterExternalTime - mpii.serverPreAdapterExternalTime;
-			}
-		}
+         * Time, in milliseconds, spent in a module invoked from the adapter associated
+         * with the destination for this message, before either the response to the message
+         * was ready or the message had been prepared to be pushed to the receiving client.
+         * This corresponds to the time that the message was processed by the server,
+         * excluding the time it was processed by your custom code, as defined by the value in
+         * the serverAdapterTime property.
+         */
+        public function get serverAdapterExternalTime():Number
+        {
+            if (pushedMessageFlag)
+            {
+                if (mpip == null)
+                    return 0;
+                if (mpip.serverPreAdapterExternalTime == 0 || mpip.serverPostAdapterExternalTime == 0)
+                    return 0;
+
+                return mpip.serverPostAdapterExternalTime - mpip.serverPreAdapterExternalTime;
+            }
+            else
+            {
+                if (mpii == null)
+                    return 0;
+                if (mpii.serverPreAdapterExternalTime == 0 || mpii.serverPostAdapterExternalTime == 0)
+                    return 0;
+
+                return mpii.serverPostAdapterExternalTime - mpii.serverPreAdapterExternalTime;
+            }
+        }

         /**
-         * @return Time that the message waited on the server after it was ready to be pushed to the client
-         * but had not yet been polled for.
-         */
-		public function get serverPollDelay():Number
-		{
-			if (mpip == null)
-				return 0;
-			if (mpip.serverPrePushTime == 0 || mpio.sendTime == 0)
-				return 0;
-
-			return mpio.sendTime - mpip.serverPrePushTime;
-		}
-
-        /**
-         * Server processing time spent outside of the adapter associated with the destination of this message
-         *
-         * @return Non-adapter server processing time in milliseconds
-         */
-		public function get serverNonAdapterTime():Number
-		{
-			return serverProcessingTime - serverAdapterTime;
-		}
-
-        /**
-         * The network round trip time for a client message and the server response to it,
-         * calculated by the difference between total time and server processing time
-         *
-         * @return Network round trip time in milliseconds
+         * Time, in milliseconds, that this message sat on the server after it was ready
+         * to be pushed to this client but before it was picked up by a poll request.
+         * For an RTMP channel, this value is always 0.
+         */
+        public function get serverPollDelay():Number
+        {
+            if (mpip == null)
+                return 0;
+            if (mpip.serverPrePushTime == 0 || mpio.sendTime == 0)
+                return 0;
+
+            return mpio.sendTime - mpip.serverPrePushTime;
+        }
+
+        /**
+         * Server processing time spent outside of the adapter associated with
+         * the destination of this message.
+         * Calculated as serverProcessingTime - serverAdapterTime.
+         */
+        public function get serverNonAdapterTime():Number
+        {
+            return serverProcessingTime - serverAdapterTime;
+        }
+
+        /**
+         * The duration, in milliseconds, from when a client sent a message to the server
+         * until it received a response, excluding the server processing time.
+         * This value is calculated as totalTime - serverProcessingTime.
+         *
+         *
In the case of a pushed message using an RTMP channel, this metric is
+         * meaningless because client does not initiate the pushed message;
+         * the server sends a message to the client whenever a message is available.
+         * Therefore, for RTMP pushed message this value is 0,
+         * but for RTMP acknowledge messages it contains a valid number.

          */
         public function get networkRTT():Number
         {
-        	if (!pushedMessageFlag)
-            	return totalTime - serverProcessingTime;
+            if (!pushedMessageFlag)
+                return totalTime - serverProcessingTime;
             else
-            	return 0;
+                return 0;
         }

         /**
-         * Timestamp in milliseconds since epoch of when the server sent a response message back
-         * to the client
-         *
-         * @return Timestamp in milliseconds since epoch
+         * The number of milliseconds since the start of the Unix epoch,
+         * January 1, 1970, 00:00:00 GMT, to when the server sent a response message back to the client.
          */
         public function get serverSendTime():Number
         {
@@ -273,10 +297,8 @@
         }

         /**
-         * Timestamp in milliseconds since epoch of when the client received response message from
-         * the server
-         *
-         * @return Timestamp in milliseconds since epoch
+         * The number of milliseconds since the start of the Unix epoch,
+         * January 1, 1970, 00:00:00 GMT, to when the client received response message from the server.
          */
         public function get clientReceiveTime():Number
         {
@@ -284,10 +306,8 @@
         }

         /**
-         * The size of the original client message as measured during deserialization by the server
-         * endpoint
-         *
-         * @return Message size in Bytes
+         * The size of the original client message, in bytes,
+         * as measured during deserialization by the server endpoint.
          */
         public function get messageSize():int
         {
@@ -298,10 +318,8 @@
         }

         /**
-         * The size of the response message sent to the client by the server as measured during serialization
-         * at the server endpoint
-         *
-         * @return Message size in Bytes
+         * The size, in bytes, of the response message sent to the client by the server
+         * as measured during serialization at the server endpoint.
          */
         public function get responseMessageSize():int
         {
@@ -309,11 +327,12 @@
         }

         /**
-         * Returns true if message was pushed to the client and is not a response to a message that
-         * originated on the client
-         *
-         * @return true if this message was pushed to the client and is not a response to a message that
-         * originated on the client
+         * Contains true if the message was pushed to the client
+         * but is not a response to a message that originated on the client.
+         * For example, when the client polls the server for a message,
+         * pushedMessageFlag is false.
+         * When you are using a streaming channel, pushedMessageFlag is true.
+         * For an acknowledge message, pushedMessageFlag is false.
          */
         public function get pushedMessageFlag():Boolean
         {
@@ -321,11 +340,10 @@
         }

         /**
-         * Only populated in the case of a pushed message, this is the time between the push causing client
-         * sending its message and the push receving client receiving it.  Note that the two clients'
-         * clocks must be in sync for this to be meaningful.
-         *
-         * @return Total push time in milliseconds
+         * Time, in milliseconds, from when the originating client sent a message
+         * and the time that the receiving client received the pushed message.
+         * Note that this value is only relevant if the two clients have synchronized clocks.
+         * Only populated in the case of a pushed message, but not for an acknowledge message,
          */
         public function get totalPushTime():Number
         {
@@ -333,11 +351,11 @@
         }

         /**
-         * Only populated in the case of a pushed message, this is the network time between
-         * the server pushing the message and the client receiving it.  Note that the server
-         * and client clocks must be in sync for this to be meaningful.
-         *
-         * @return One way server push time in milliseconds
+         * Time, in milliseconds, from when the server pushed the message
+         * until the client received it.
+         * Note that this value is only relevant if the server and receiving client
+         * have synchronized clocks.
+         * Only populated in the case of a pushed message, but not for an acknowledge message.
          */
         public function get pushOneWayTime():Number
         {
@@ -345,10 +363,9 @@
         }

         /**
-         * Only populated in the case of a pushed message, timestamp in milliseconds since epoch of
-         * when the client that caused a push message sent its message.
-         *
-         * @return Timestamp in milliseconds since epoch
+         * The timestamp, in milliseconds since the start of the Unix epoch on
+         * January 1, 1970, 00:00:00 GMT, to when the client that caused a push message sent its message.
+         * Only populated in the case of a pushed message, but not for an acknowledge message.
          */
         public function get originatingMessageSentTime():Number
         {
@@ -356,10 +373,8 @@
         }

         /**
-         * Only populated in the case of a pushed message, size in Bytes of the message that originally
-         * caused this pushed message
-         *
-         * @return Pushed causer message size in Bytes
+         * Size, in bytes, of the message that originally caused this pushed message.
+         * Only populated in the case of a pushed message, but not for an acknowledge message.
          */
         public function get originatingMessageSize():Number
         {
@@ -367,15 +382,18 @@
         }

         /**
-         * Method returns a summary of all information available in MPI.  A suggested use of this
-         * is something like,
-         * @example
-         * <listing version="3.0">
+         * The prettyPrint() method returns a formatted String containing all
+         * non-zero and non-null properties of the class.
+         *
+         *
For example, you can use the Alert control to display the available metrics,
+         * as the following example shows:

+         *
+         *

          *      var mpiutil:MessagePerformanceUtils = new MessagePerformanceUtils(message);
          *      Alert.show(mpiutil.prettyPrint(), "MPI Output", Alert.NONMODAL);
-         * </listing>
-         *
-         * @return String containing a summary of all information available in MPI
+         *

+         *
+         * @return String containing a summary of all available non-zero and non-null metrics.
          */
         public function prettyPrint():String
         {
@@ -390,12 +408,12 @@
                 alertString +="Network Roundtrip time (s): " + (networkRTT / 1000) + "\n";
             if (serverProcessingTime != 0)
                 alertString +="Server processing time (s): " + (serverProcessingTime / 1000) + "\n";
-      		if (serverAdapterTime != 0)
-      			alertString +="Server adapter time (s): " + (serverAdapterTime / 1000) + "\n";
-      		if (serverNonAdapterTime != 0)
-      			alertString +="Server non-adapter time (s): " + (serverNonAdapterTime / 1000) + "\n"
-      		if (serverAdapterExternalTime != 0)
-      			alertString +="Server adapter external time (s): " + (serverAdapterExternalTime / 1000) + "\n";
+            if (serverAdapterTime != 0)
+                alertString +="Server adapter time (s): " + (serverAdapterTime / 1000) + "\n";
+            if (serverNonAdapterTime != 0)
+                alertString +="Server non-adapter time (s): " + (serverNonAdapterTime / 1000) + "\n"
+            if (serverAdapterExternalTime != 0)
+                alertString +="Server adapter external time (s): " + (serverAdapterExternalTime / 1000) + "\n";

             if (pushedMessageFlag)
             {
@@ -406,8 +424,8 @@
                     alertString += "Push one way time (s): " + (pushOneWayTime / 1000) + "\n";
                 if (originatingMessageSize != 0)
                     alertString += "Originating Message size (B): " + originatingMessageSize + "\n";
-      			if (serverPollDelay != 0)
-      				alertString +="Server poll delay (s): " + (serverPollDelay / 1000) + "\n";
+                if (serverPollDelay != 0)
+                    alertString +="Server poll delay (s): " + (serverPollDelay / 1000) + "\n";
             }

             return alertString;