Transferred from the Adobe Open Source Subversion Repository

Revision: 4435
Author:   egeorgie@adobe.com
Date:     2009-01-07T23:37:43.454875Z

Log Message:
-----------
Adding initial implementation of TileLayout.
Supported:
1. Properties: orientation, columnCount, rowCount, horizontalGap, verticalGap, columnWidth, rowHeight, justifyColumns enum, justifyRows enum, elementHorizontalAlign, elementVerticalAlign
2. Aligns elements to pixel boundaries

Not yet implemented:
1. Scrolling (row/column snapping)
2. Min/max limits for element dimensions for certain cases
3. Optimizations to eliminate duplicate work during measure & updateDisplayList
4. Correct includeInLayout element support.

QE Notes:
Doc Notes: API names are not finalized yet
Bugs: None
Reviewer: Hans
tests: checkintests

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/layout/TileLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/mxml-2009-manifest.xml</path>

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

--- frameworks/projects/spark/src/spark/layouts/TileLayout.as
+++ frameworks/projects/spark/src/spark/layouts/TileLayout.as
@@ -0,0 +1,1012 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2008 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 mx.layout
+{
+import mx.components.baseClasses.GroupBase;
+import mx.core.ILayoutElement;
+import mx.events.PropertyChangeEvent;
+import mx.layout.HorizontalAlign;
+import mx.layout.LayoutBase;
+import mx.layout.VerticalAlign;
+
+/**
+ *  Documentation is not currently available.
+ */
+public class TileLayout extends LayoutBase
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function TileLayout():void
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  horizontalGap
+    //----------------------------------
+
+    private var explicitHorizontalGap:Number = 6;
+    private var _horizontalGap:Number = 6;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Horizontal space between columns.
+     *
+     *  @see #verticalGap
+     *  @see #justifyColumns
+     *  @default 6
+     */
+    public function get horizontalGap():Number
+    {
+        return _horizontalGap;
+    }
+
+    /**
+     *  @private
+     */
+    public function set horizontalGap(value:Number):void
+    {
+        explicitHorizontalGap = value;
+        if (value == _horizontalGap)
+            return;
+
+        _horizontalGap = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  verticalGap
+    //----------------------------------
+
+    private var explicitVerticalGap:Number = 6;
+    private var _verticalGap:Number = 6;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Vertical space between rows.
+     *
+     *  @see #horizontalGap
+     *  @see #justifyRows
+     *  @default 6
+     */
+    public function get verticalGap():Number
+    {
+        return _verticalGap;
+    }
+
+    /**
+     *  @private
+     */
+    public function set verticalGap(value:Number):void
+    {
+        explicitVerticalGap = value;
+        if (value == _verticalGap)
+            return;
+
+        _verticalGap = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  columnCount
+    //----------------------------------
+
+    private var explicitColumnCount:int = -1;
+    private var _columnCount:int = -1;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Number of columns to be displayed.
+     *  This property will contain the actual column count after
+     *  updateDisplayList().
+     *  Set to -1 to remove explicit override and allow the TileLayout to determine
+     *  the column count automatically.
+     *
+     *  Setting this property won't have any effect, if orientation is
+     *  set to "rows", rowCount is explicitly set, and the
+     *  container width is explicitly set.
+     *
+     *  @see #rowCount
+     *  @see #justifyColumns
+     *  @default -1
+     */
+    public function get columnCount():int
+    {
+        return _columnCount;
+    }
+
+    /**
+     *  @private
+     */
+    public function set columnCount(value:int):void
+    {
+        explicitColumnCount = value;
+        if (value == _columnCount)
+            return;
+
+        _columnCount = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  rowCount
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the rowCount property.
+     */
+    private var explicitRowCount:int = -1;
+    private var _rowCount:int = -1;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Number of rows to be displayed.
+     *  This property will contain the actual row count after
+     *  updateDisplayList().
+     *  Set to -1 to remove explicit override and allow the TileLayout to determine
+     *  the row count automatically.
+     *
+     *  Setting this property won't have any effect, if orientation is
+     *  set to "columns", columnCount is explicitly set, and the
+     *  container height is explicitly set.
+     *
+     *  @see #columnCount
+     *  @see #justifyRows
+     *  @default -1
+     */
+    public function get rowCount():int
+    {
+        return _rowCount;
+    }
+
+    /**
+     *  @private
+     */
+    public function set rowCount(value:int):void
+    {
+        explicitRowCount = value;
+        if (value == _rowCount)
+            return;
+
+        _rowCount = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  columnWidth
+    //----------------------------------
+
+    private var explicitColumnWidth:Number = NaN;
+    private var _columnWidth:Number = NaN;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Explicit override for the column width.
+     *  This property will contain the actual column width after
+     *  updateDisplayList().
+     *
+     *
If not explicitly set, the column width will be
+     *  determined from the maximum of elements' width.
+     *  Set to NaN to remove explicit override.

+     *
+     *  If justifyColumns is set to "columnSize", the actual column width
+     *  will grow to justify the fully-visible columns to the container width.
+     *
+     *  @see #rowHeight
+     *  @see #justifyColumns
+     *  @default NaN
+     */
+    public function get columnWidth():Number
+    {
+        return _columnWidth;
+    }
+
+    /**
+     *  @private
+     */
+    public function set columnWidth(value:Number):void
+    {
+        explicitColumnWidth = value;
+        if (value == _columnWidth)
+            return;
+
+        _columnWidth = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  rowHeight
+    //----------------------------------
+
+    private var explicitRowHeight:Number = NaN;
+    private var _rowHeight:Number = NaN;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Explicit override for the row height.
+     *  This property will contain the actual row height after
+     *  updateDisplayList().
+     *
+     *
If not explicitly set, the row height will be
+     *  determined from the maximum of elements' height.
+     *  Set to NaN to remove explicit override.

+     *
+     *  If justifyRows is set to "rowSize", the actual row height
+     *  will grow to justify the fully-visible rows to the container height.
+     *
+     *  @see #columnWidth
+     *  @see #justifyRows
+     *  @default NaN
+     */
+    public function get rowHeight():Number
+    {
+        return _rowHeight;
+    }
+
+    /**
+     *  @private
+     */
+    public function set rowHeight(value:Number):void
+    {
+        explicitRowHeight = value;
+        if (value == _rowHeight)
+            return;
+
+        _rowHeight = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  horizontalAlign
+    //----------------------------------
+
+    private var _elementHorizontalAlign:String = HorizontalAlign.JUSTIFY;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Specifies how to align the elements within the cells in the horizontal direction.
+     *  Supported values are
+     *  HorizontalAlign.LEFT,
+     *  HorizontalAlign.CENTER,
+     *  HorizontalAlign.RIGHT,
+     *  HorizontalAlign.JUSTIFY.
+     *
+     *
When set to HorizontalAlign.JUSTIFY the width of each
+     *  element will be set to the columnWidth
.
+     *
+     *  @default HorizontalAlign.JUSTIFY
+     */
+    public function get elementHorizontalAlign():String
+    {
+        return _elementHorizontalAlign;
+    }
+
+    /**
+     *  @private
+     */
+    public function set elementHorizontalAlign(value:String):void
+    {
+        if (_elementHorizontalAlign == value)
+            return;
+
+        _elementHorizontalAlign = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  verticalAlign
+    //----------------------------------
+
+    private var _elementVerticalAlign:String = VerticalAlign.JUSTIFY;
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Specifies how to align the elements within the cells in the vertical direction.
+     *  Supported values are
+     *  VerticalAlign.TOP,
+     *  VerticalAlign.MIDDLE,
+     *  VerticalAlign.BOTTOM,
+     *  VerticalAlign.JUSTIFY.
+     *
+     *
When set to VerticalAlign.JUSTIFY, the height of each
+     *  element will be set to rowHeight
.
+     *
+     *  @default VerticalAlign.JUSTIFY
+     */
+    public function get elementVerticalAlign():String
+    {
+        return _elementVerticalAlign;
+    }
+
+    /**
+     *  @private
+     */
+    public function set elementVerticalAlign(value:String):void
+    {
+        if (_elementVerticalAlign == value)
+            return;
+
+        _elementVerticalAlign = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  justifyColumns
+    //----------------------------------
+
+    // TODO EGeorgie: add String enum
+    private var _justifyColumns:String = "none";
+
+    [Inspectable(category="General")]
+
+    /**
+     *  Specifies how to justify the fully visible columns to the container width.
+     *  Supported values are "none", "gapSize", "columnSize".
+     *
+     *
When set to "none" - turns column justification off, there may
+     *  be partially visible columns or whitespace between the last column and
+     *  the right edge of the container.  This is the default value.

+     *
+     *
When set to "gapSize" - the horizontalGap actual value will increase so that
+     *  the last fully visible column right edge aligns with the container's right edge.
+     *  In case there is only a single fully visible column, the horizontalGap actual value
+     *  will increase so that it pushes any partially visible column just beyond the right edge
+     *  of the container.  Note that explicitly setting the horizontalGap does not turn off
+     *  justification, but just determines the initial gap value, and after thatn justification
+     *  may increases it.

+     *
+     *
When set to "columnSize" - the columnWidth actual value will increase so that
+     *  the last fully visible column right edge aligns with the container's right edge.  Note that
+     *  explicitly setting the columnWidth does not turn off justification, but simply
+     *  determines the initial column width value, and after that justification may increases it.

+     *
+     *  @see #horizontalGap
+     *  @see #columnWidth
+     *  @see #justifyRows
+     *  @default "none"
+     */
+    public function get justifyColumns():String
+    {
+        return _justifyColumns;
+    }
+
+    /**
+     *  @private
+     */
+    public function set justifyColumns(value:String):void
+    {
+        if (_justifyColumns == value)
+            return;
+
+        _justifyColumns = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  justifyRows
+    //----------------------------------
+
+    private var _justifyRows:String = "none";
+
+    [Inspectable(category="General")]
+
+    /**
+     *  Specifies how to justify the fully visible rows to the container height.
+     *  Supported values are "none", "gapSize", "rowSize".
+     *
+     *
When set to "none" - turns column justification off, there may
+     *  be partially visible rows or whitespace between the last row and
+     *  the bottom edge of the container.  This is the default value.

+     *
+     *
When set to "gapSize" - the verticalGap actual value will increase so that
+     *  the last fully visible row bottom edge aligns with the container's bottom edge.
+     *  In case there is only a single fully visible row, the verticalGap actual value
+     *  will increase so that it pushes any partially visible row just beyond the bottom edge
+     *  of the container.  Note that explicitly setting the verticalGap does not turn off
+     *  justification, but just determines the initial gap value, and after that justification
+     *  may increases it.

+     *
+     *
When set to "rowSize" - the rowHeight actual value will increase so that
+     *  the last fully visible row bottom edge aligns with the container's bottom edge.  Note that
+     *  explicitly setting the rowHeight does not turn off justification, but simply
+     *  determines the initial row height value, and after that justification may increases it.

+     *
+     *  @see #verticalGap
+     *  @see #rowHeight
+     *  @see #justifyColumns
+     *  @default "none"
+     */
+    public function get justifyRows():String
+    {
+        return _justifyRows;
+    }
+
+    /**
+     *  @private
+     */
+    public function set justifyRows(value:String):void
+    {
+        if (_justifyRows == value)
+            return;
+
+        _justifyRows = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //----------------------------------
+    //  orientation
+    //----------------------------------
+
+    // TODO EGeorgie: add an enum instead of hardcoding
+    private var _orientation:String = "rows";
+
+    [Bindable("propertyChange")]
+    [Inspectable(category="General")]
+
+    /**
+     *  Determines whether elements are arranged row by row or
+     *  column by column.
+     *  Supported values are "rows", "columns".
+     *
+     *  @default "rows"
+     */
+    public function get orientation():String
+    {
+        return _orientation;
+    }
+
+    /**
+     *  @private
+     */
+    public function set orientation(value:String):void
+    {
+        if (_orientation == value)
+            return;
+
+        _orientation = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  storage for old property values, in order to dispatch change events.
+     */
+    private var oldColumnWidth:Number = NaN;
+    private var oldRowHeight:Number = NaN;
+    private var oldColumnCount:int = -1;
+    private var oldRowCount:int = -1;
+    private var oldHorizontalGap:Number = NaN;
+    private var oldVerticalGap:Number = NaN;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Dispatches events if Actual values have changed since the last call.
+     *  Checks columnWidth, rowHeight, columnCount, rowCount, horizontalGap, verticalGap.
+     *  This method is called from within updateDisplayList()
+     */
+    protected function dispatchEventsForActualValueChanges():void
+    {
+        if (oldColumnWidth != _columnWidth)
+            dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "columnWidth", oldColumnWidth, _columnWidth));
+        if (oldRowHeight != _rowHeight)
+            dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "rowHeight", oldRowHeight, _rowHeight));
+        if (oldColumnCount != _columnCount)
+            dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "columnCount", oldColumnCount, _columnCount));
+        if (oldRowCount != _rowCount)
+            dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "rowCount", oldRowCount, _rowCount));
+        if (oldHorizontalGap != _horizontalGap)
+            dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "horizontalGap", oldHorizontalGap, _horizontalGap));
+        if (oldVerticalGap != _verticalGap)
+            dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "verticalGap", oldVerticalGap, _verticalGap));
+
+        oldColumnWidth   = _columnWidth;
+        oldRowHeight     = _rowHeight;
+        oldColumnCount   = _columnCount;
+        oldRowCount      = _rowCount;
+        oldHorizontalGap = _horizontalGap;
+        oldVerticalGap   = _verticalGap;
+    }
+
+    /**
+     *  This method is called from measure() and updateDisplayList() to calculate the
+     *  actual values for columnWidth, rowHeight, columnCount, rowCount, horizontalGap and verticalGap.
+     *
+     *  @param width - the width during measure() is the layout target explicitWidth or NaN
+     *  and during updateDisplayList() is the unscaledWidth.
+     *  @param height - the height during measure() is the layout target explicitHeight or NaN
+     *  and during updateDisplayList() is the unscaledHeight.
+     */
+    protected function updateActualValues(width:Number, height:Number):void
+    {
+        _columnWidth = _rowHeight = NaN;
+        _horizontalGap = _verticalGap = NaN;
+        _columnCount = _rowCount = -1;
+
+        // First, figure the tile size
+        calculateTileSize();
+
+        // Second, figure out number of rows/columns
+        var elementCount:int = calculateElementCount();
+        calculateColumnAndRowCount(width, height, elementCount);
+
+        // Third, adjust the gaps and column and row sizes based on justification settings
+        _horizontalGap = explicitHorizontalGap;
+        _verticalGap = explicitVerticalGap;
+
+        // Justify
+        switch(justifyColumns)
+        {
+            case "gapSize":
+                _horizontalGap = justifyByGapSize(width, _columnWidth, _horizontalGap, _columnCount);
+            break;
+            case "columnSize":
+                _columnWidth = justifyByElementSize(width, _columnWidth, _horizontalGap, _columnCount);
+            break;
+        }
+
+        switch(justifyRows)
+        {
+            case "gapSize":
+                _verticalGap = justifyByGapSize(height, _rowHeight, _verticalGap, _rowCount);
+            break;
+            case "rowSize":
+                _rowHeight = justifyByElementSize(height, _rowHeight, _verticalGap, _rowCount);
+            break;
+        }
+
+        // Last, if we have explicit overrides for both rowCount and columnCount, then
+        // make sure that the count along the minor axis is deduced from the element count
+        // and the count along the major axis.
+        // Note that we do this *after* justification is taken into account as we want to
+        // justify based on the explicit user settings.
+        if (-1 != explicitColumnCount && -1 != explicitRowCount)
+        {
+            if (orientation == "rows")
+                _rowCount = Math.max(_rowCount, Math.ceil(elementCount / Math.max(1, explicitColumnCount)));
+            else
+                _columnCount = Math.max(_columnCount, Math.ceil(elementCount / Math.max(1, explicitRowCount)));
+        }
+    }
+
+    /**
+     *  @private
+     *  Calculates _columnCount and _rowCount based on width, height,
+     *  orientation, explicitColumnCount, explicitRowCount, _columnWidth, _rowHeight.
+     *  _columnWidth and _rowHeight must be valid before calling.
+     */
+    private function calculateColumnAndRowCount(width:Number, height:Number, elementCount:int):void
+    {
+        if (-1 != explicitColumnCount || -1 != explicitRowCount)
+        {
+            if (-1 != explicitRowCount)
+                _rowCount = Math.max(1, explicitRowCount);
+
+            if (-1 != explicitColumnCount)
+                _columnCount = Math.max(1, explicitColumnCount);
+        }
+        // Figure out number of columns or rows based on the explicit size along one of the axes
+        else if (!isNaN(width) && (orientation == "rows" || isNaN(height)))
+        {
+            if (_columnWidth + explicitHorizontalGap > 0)
+                _columnCount = Math.max(1, Math.floor((width + explicitHorizontalGap) / (_columnWidth + explicitHorizontalGap)));
+            else
+                _columnCount = 1;
+        }
+        else if (!isNaN(height) && (orientation == "columns" || isNaN(width)))
+        {
+            if (_rowHeight + explicitVerticalGap > 0)
+                _rowCount = Math.max(1, Math.floor((height + explicitVerticalGap) / (_rowHeight + explicitVerticalGap)));
+            else
+                _rowCount = 1;
+        }
+        else // Figure out the number of columns and rows so that pixels area occupied is as square as possible
+        {
+            // Calculate number of rows and columns so that
+            // pixel area is as square as possible
+            var hGap:Number = explicitHorizontalGap;
+            var vGap:Number = explicitVerticalGap;
+
+            // 1. columnCount * (columnWidth + hGap) - hGap == rowCount * (rowHeight + vGap) - vGap
+            // 1. columnCount * (columnWidth + hGap) == rowCount * (rowHeight + vGap) + hGap - vGap
+            // 1. columnCount == (rowCount * (rowHeight + vGap) + hGap - vGap) / (columnWidth + hGap)
+            // 2. columnCount * rowCount == elementCount
+            // substitute 1. in 2.
+            // rowCount * rowCount + (hGap - vGap) * rowCount - elementCount * (columnWidth + hGap ) == 0
+
+            var a:Number = Math.max(0, (rowHeight + vGap));
+            var b:Number = (hGap - vGap);
+            var c:Number = -elementCount * (_columnWidth + hGap);
+            var d:Number = b * b - 4 * a * c; // Always guaranteed to be greater than zero, since c <= 0
+            d = Math.sqrt(d);
+
+            // We are guaranteed that we have only one positive root, since d >= b:
+            var rowCount:Number = (a != 0) ? (b + d) / (2 * a) : elementCount;
+
+            var row1:int = Math.max(1, Math.round(rowCount));
+            var col1:int = Math.max(1, Math.ceil(elementCount / row1));
+
+            // Now try to reduce the bigger dimension and see if we can come up with a better distribution
+            var row2:int;
+            var col2:int;
+            if (col1 * (_columnWidth + hGap) - hGap > row1 * (_rowHeight + vGap) - vGap)
+            {
+                col2 = Math.max(1, col1 - 1);
+                row2 = Math.max(1, Math.ceil(elementCount / col2));
+            }
+            else
+            {
+                row2 = Math.max(1, row2 - 1);
+                col2 = Math.max(1, Math.ceil(elementCount / row2));
+            }
+
+            // Pick the better one of the two
+            if (Math.abs(col1 * (_columnWidth + hGap) - hGap - row1 * (_rowHeight + vGap) + vGap) <=
+                Math.abs(col2 * (_columnWidth + hGap) - hGap - row2 * (_rowHeight + vGap) + vGap))
+            {
+                _columnCount = col1;
+                _rowCount = row1;
+            }
+            else
+            {
+                _columnCount = col2;
+                _rowCount = row2;
+            }
+        }
+
+        // In case we determined only columns or rows (from explicit overrides or explicit width/height)
+        // calculate the other from the number of elements
+        if (-1 == _rowCount)
+            _rowCount = Math.max(1, Math.ceil(elementCount / _columnCount));
+        if (-1 == _columnCount)
+            _columnCount = Math.max(1, Math.ceil(elementCount / _rowCount));
+    }
+
+    /**
+     *  @private
+     *  Increases the gap so that elements are justified to exactly fit totalSize
+     *  leaving no partially visible elements in view.
+     *  @return Returs the new gap size.
+     */
+    private function justifyByGapSize(totalSize:Number, elementSize:Number,
+                                      gap:Number, elementCount:int):Number
+    {
+        // If element + gap collapses to zero, then don't adjust the gap.
+        if (elementSize + gap <= 0)
+            return gap;
+
+        // Find the number of fully visible elements
+        var visibleCount:int =
+            Math.min(elementCount, Math.floor((totalSize + gap) / (elementSize + gap)));
+
+        // If there isn't even a singel fully visible element, don't adjust the gap
+        if (visibleCount < 1)
+            return gap;
+
+        // Special case: if there's a singe fully visible element and a partially
+        // visible element, then make the gap big enough to push out the partially
+        // visible element out of view.
+        if (visibleCount == 1)
+            return elementCount > 1 ? Math.max(gap, totalSize - elementSize) : gap;
+
+        // Now calculate the gap such that the fully visible elements and gaps
+        // add up exactly to totalSize:
+        // <==> totalSize == visibleCount * elementSize + (visibleCount - 1) * gap
+        // <==> totalSize - visibleCount * elementSize == (visibleCount - 1) * gap
+        // <==> (totalSize - visibleCount * elementSize) / (visibleCount - 1) == gap
+        return (totalSize - visibleCount * elementSize) / (visibleCount - 1);
+    }
+
+    /**
+     *  @private
+     *  Increases the element size so that elements are justified to exactly fit
+     *  totalSize leaving no partially visible elements in view.
+     *  @return Returns the the new element size.
+     */
+    private function justifyByElementSize(totalSize:Number, elementSize:Number,
+                                          gap:Number, elementCount:int):Number
+    {
+        var elementAndGapSize:Number = elementSize + gap;
+        var visibleCount:int = 0;
+        // Find the number of fully visible elements
+        if (elementAndGapSize == 0)
+            visibleCount = elementCount;
+        else
+            visibleCount = Math.min(elementCount, Math.floor((totalSize + gap) / elementAndGapSize));
+
+        // If there isn't event a single fully visible element, don't adjust
+        if (visibleCount < 1)
+            return elementSize;
+
+        // Now calculate the elementSize such that the fully visible elements and gaps
+        // add up exactly to totalSize:
+        // <==> totalSize == visibleCount * elementSize + (visibleCount - 1) * gap
+        // <==> totalSize - (visibleCount - 1) * gap == visibleCount * elementSize
+        // <==> (totalSize - (visibleCount - 1) * gap) / visibleCount == elementSize
+        return (totalSize - (visibleCount - 1) * gap) / visibleCount;
+    }
+
+    /**
+     *  @private
+     *  Calculates _columnWidth and _rowHeight from maximum of
+     *  elements preferred size and any explicit overrides.
+     */
+    private function calculateTileSize():void
+    {
+        _columnWidth = explicitColumnWidth;
+        _rowHeight = explicitRowHeight;
+
+        if (!isNaN(_columnWidth) && !isNaN(_rowHeight))
+            return;
+
+        // TODO EGeorgie: make sure we cache the values so that we don't calculate twice
+        // on measure and updateDisplayList
+        var columnWidth:Number = 0;
+        var rowHeight:Number = 0;
+
+        var layoutTarget:GroupBase = target;
+        var count:int = layoutTarget.numLayoutElements;
+        for (var i:int = 0; i < count; i++)
+        {
+            var el:ILayoutElement = layoutTarget.getLayoutElementAt(i);
+            if (!el || !el.includeInLayout)
+                continue;
+
+            if (isNaN(_columnWidth))
+                columnWidth = Math.max(columnWidth, el.getPreferredBoundsWidth());
+            if (isNaN(_rowHeight))
+                rowHeight = Math.max(rowHeight, el.getPreferredBoundsHeight());
+        }
+
+        if (isNaN(_columnWidth))
+            _columnWidth = columnWidth;
+        if (isNaN(_rowHeight))
+            _rowHeight = rowHeight;
+    }
+
+    /**
+     *  @private
+     *  @return Returns the number of layout elements.
+     */
+    private function calculateElementCount():int
+    {
+        // TODO EGeorgie: make sure we cache the values so that we don't calculate twice
+        // on measure and updateDisplayList.
+        // TODO EGeorgie: subtract number of "includeInLayout==false" elements.
+        return target.numLayoutElements;
+    }
+
+    /**
+     *  Sets the size and the position of the specified layout element and cell bounds.
+     *  @param element - the element to resize and position.
+     *  @param cellX - the x coordinate of the cell.
+     *  @param cellY - the y coordinate of the cell.
+     *  @param cellWidth - the width of the cell.
+     *  @param cellHeight - the height of the cell.
+     */
+    protected function sizeAndPositionElement(element:ILayoutElement,
+                                              cellX:int,
+                                              cellY:int,
+                                              cellWidth:int,
+                                              cellHeight:int):void
+    {
+        var childWidth:Number = NaN;
+        var childHeight:Number = NaN;
+
+        // Determine size of the element
+        // TODO EGeorgie: Should we respect minimum element width?
+        if (!isNaN(element.percentWidth))
+            childWidth = Math.round(cellWidth * Math.min(100, element.percentWidth) / 100);
+
+        // TODO EGeorgie: Should we respect minimum element height?
+        if (!isNaN(element.percentHeight))
+            childHeight = Math.round(cellHeight * Math.min(100, element.percentHeight) / 100);
+
+        if (elementHorizontalAlign == "justify")
+            childWidth = cellWidth;
+        if (elementVerticalAlign == "justify")
+            childHeight = cellHeight;
+
+        // TODO EGeorgie: compare childWidth/childHeight against min/max.
+        // The cell size should be a maximum for the element (in cases where the cell has explicit width/height).
+
+        // Size the element
+        element.setLayoutBoundsSize(childWidth, childHeight, true /*postTransform*/);
+
+        var x:Number = cellX;
+        switch (elementHorizontalAlign)
+        {
+            case "right":
+                x += cellWidth - element.getLayoutBoundsWidth();
+            break;
+            case "center":
+                // Make sure division result is integer - Math.floor() the result.
+                x = cellX + Math.floor((cellWidth - element.getLayoutBoundsWidth()) / 2);
+            break;
+        }
+
+        var y:Number = cellY;
+        switch (elementVerticalAlign)
+        {
+            case "bottom":
+                y += cellHeight - element.getLayoutBoundsHeight();
+            break;
+            case "middle":
+                // Make sure division result is integer - Math.floor() the result.
+                y += Math.floor((cellHeight - element.getLayoutBoundsHeight()) / 2);
+            break;
+        }
+
+        // Position the element
+        element.setLayoutBoundsPosition(x, y);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overriden methods from LayoutBase
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override public function measure():void
+    {
+        var layoutTarget:GroupBase = target;
+        if (!layoutTarget)
+            return;
+
+        updateActualValues(layoutTarget.explicitWidth, layoutTarget.explicitHeight);
+
+        // For measure, any explicit overrides for rowCount and columnCount take precedence
+        var columnCount:int = explicitColumnCount != -1 ? explicitColumnCount : _columnCount;
+        var rowCount:int = explicitRowCount != -1 ? explicitRowCount : _rowCount;
+
+        layoutTarget.measuredWidth = Math.round(columnCount * (_columnWidth + _horizontalGap) - _horizontalGap);
+        layoutTarget.measuredHeight = Math.round(rowCount * (_rowHeight + _verticalGap) - _verticalGap);
+
+        // Minimum size is just enough to display a single cell
+        layoutTarget.measuredMinWidth = Math.round(_columnWidth);
+        layoutTarget.measuredMinHeight = Math.round(_rowHeight);
+    }
+
+    /**
+     *  @private
+     */
+    override public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+        var layoutTarget:GroupBase = target;
+        if (!layoutTarget)
+            return;
+
+        updateActualValues(unscaledWidth, unscaledHeight);
+
+        var xPos:Number = 0;
+        var yPos:Number = 0;
+
+        // Use counter and counterLimit to track when to move along the minor axis
+        var counter:int = 0;
+        var counterLimit:int;
+
+        // Use MajorDelta when moving along the major axis
+        var xMajorDelta:Number;
+        var yMajorDelta:Number;
+
+        // Use MinorDelta when moving along the minor axis
+        var xMinorDelta:Number;
+        var yMinorDelta:Number;
+
+        // Setup counterLimit and deltas based on orientation
+        if (orientation == "rows")
+        {
+            counterLimit = _columnCount;
+            xMajorDelta = _columnWidth + _horizontalGap;
+            xMinorDelta = 0;
+            yMajorDelta = 0;
+            yMinorDelta = _rowHeight + _verticalGap;
+        }
+        else
+        {
+            counterLimit = _rowCount;
+            xMajorDelta = 0;
+            xMinorDelta = _columnWidth + _horizontalGap;
+            yMajorDelta = _rowHeight + _verticalGap;
+            yMinorDelta = 0;
+        }
+
+        var count:int = layoutTarget.numLayoutElements;
+        for (var i:int = 0; i < count; i++)
+        {
+            var el:ILayoutElement = layoutTarget.getLayoutElementAt(i);
+            if (!el || !el.includeInLayout)
+                continue;
+
+            // To calculate the cell extents as integers, first calculate
+            // the extents and then use Math.round()
+            var cellX:int = Math.round(xPos);
+            var cellY:int = Math.round(yPos);
+            var cellWidth:int = Math.round(xPos + _columnWidth) - cellX;
+            var cellHeight:int = Math.round(yPos + _rowHeight) - cellY;
+
+            sizeAndPositionElement(el, cellX, cellY, cellWidth, cellHeight);
+
+            // Move along the major axis
+            xPos += xMajorDelta;
+            yPos += yMajorDelta;
+
+            // Move along the minor axis
+            if (++counter >= counterLimit)
+            {
+                counter = 0;
+                if (orientation == "rows")
+                {
+                    xPos = 0;
+                    yPos += yMinorDelta;
+                }
+                else
+                {
+                    xPos += xMinorDelta;
+                    yPos = 0;
+                }
+            }
+        }
+
+        layoutTarget.setContentSize(Math.round(_columnCount * (_columnWidth + _horizontalGap) - _horizontalGap),
+                                    Math.round(_rowCount * (_rowHeight + _verticalGap) - _verticalGap));
+
+        // If actual values have chnaged, notify listeners
+        dispatchEventsForActualValueChanges();
+    }
+}
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 12850
Author:   jimurphy@adobe.com
Date:     2009-12-11T14:57:14.623098Z

Log Message:
-----------
add 6 new DMV projects to the SDK:
automation
automation_air
automation_dmv
automation_flashflexkit
automation_spark
datavisualization

These projects are setup to build in an ant main call.  There are currently several warnings in the datavisualization project that will be cleaned up.  No checkintests exist for these projects as of yet.

I also modified the exisitng projects build files for easier management of the localization targets, bundle and fat-swc. If the projects that I updated:airframework,airspark,framework,playerglobal,rpc,and spark.  All the new projects have been implemented this same way.

QE notes: DMV folks should run through their tests
Doc notes: probably
Bugs: nope
Reviewer:
Tests run: ran the following targets: compile,checkintests,other.locales and doc
Is noteworthy for integration: no

Modified Paths:
--------------
1404 paths were modified

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

--- frameworks/projects/charts/src/mx/charts/effects/SeriesSlide.as
+++ frameworks/projects/charts/src/mx/charts/effects/SeriesSlide.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 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 mx.charts.effects
+{
+
+import mx.charts.effects.effectClasses.SeriesSlideInstance;
+import mx.effects.IEffectInstance;
+
+/**
+ *  The SeriesSlide effect slides a data series
+ *  into and out of the chart's boundaries.
+ *  You use the direction property
+ *  to specify the location from which the series slides.
+ *
+ *
If you use SeriesSlide with a hideDataEffect effect trigger,
+ *  the series slides from the current position onscreen to a position
+ *  off of the screen, in the indicated direction.
+ *  If you use SeriesSlide as a showDataEffect,
+ *  the series slides from offscreen to a position onto the screen,
+ *  in the indicated direction.

+ *
+ *  @mxml
+ *
+ *
The <mx:SeriesSlide> tag
+ *  inherits all the properties of its parent classes,
+ *  and adds the following properties:

+ *
+ *

+ *  <mx:SeriesSlide
+ *    Properties
+ *    direction="left|right|up|down"
+ *  />
+ *

+ *
+ *  @includeExample examples/SeriesSlideExample.mxml
+ *
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class SeriesSlide extends SeriesEffect
+{
+    include "../../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor.
+	 *
+	 *  @param target The target of the effect.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function SeriesSlide(target:Object = null)
+	{
+		super(target);
+
+		instanceClass = SeriesSlideInstance;
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+ 	//----------------------------------
+	//  direction
+	//----------------------------------
+
+	[Inspectable(category="General", enumeration="left,right,up,down", defaultValue="left")]
+
+	/**
+	 *  Defines the location from which the series slides.
+	 *  Valid values are "left", "right",
+	 *  "up", and "down".
+	 *  The default value is "left".
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var direction:String = "left";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  @inheritDoc
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	override protected function initInstance(inst:IEffectInstance):void
+	{
+		super.initInstance(inst);
+
+		SeriesSlideInstance(inst).direction = direction;
+	}
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 11319
Author:   aharui@adobe.com
Date:     2009-10-30T18:42:01.565515Z

Log Message:
-----------
Allow for resizing of sub-apps after they initialize

QE Notes: Two Mustella Tests need updating:
MP_Controls_Tests2:MP_ComboBox_closeOnMouseDown_untrusted
MP_Controls_Tests2:MP_ComboBox_closeOnMouseDownOutside_untrusted
The new sub-app resize closes the dropdown.  Probably have to wait a bit longer before opening the dropdown
Doc Notes: New API in ISystemManager
Bugs: SDK-23892
Reviewer: Darrell
API Change: yes
Is noteworthy for integration: No
tests: checkintests mustella/MarshallPlan

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/systemClasses/MarshallingSupport.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ISystemManager.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/airframework/src/mx/managers/WindowedSystemManager.as</path>

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

--- frameworks/projects/framework/src/mx/managers/ISystemManager.as
+++ frameworks/projects/framework/src/mx/managers/ISystemManager.as
@@ -471,6 +471,18 @@
      *  @productversion Flex 3
      */
     function deployMouseShields(deploy:Boolean):void;
+
+    /**
+     *  Attempt to notify the parent SWFLoader that the application's size may
+     *  have changed.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    function invalidateParentSizeAndDisplayList():void;
+
 }

 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 8627
Author:   jszeto@adobe.com
Date:     2009-07-16T18:40:07.408921Z

Log Message:
-----------
Adding copyright headers to filter classes

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/ConvolutionFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/ColorMatrixFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/BlurFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/DisplacementMapFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GradientGlowFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/ShaderFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GlowFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/DropShadowFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GradientBevelFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/BevelFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GradientFilter.as</path>

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

--- frameworks/projects/spark/src/spark/filters/DropShadowFilter.as
+++ frameworks/projects/spark/src/spark/filters/DropShadowFilter.as
@@ -1,3 +1,14 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2008 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.filters
 {
 import flash.filters.BitmapFilter;


Transferred from the Adobe Open Source Subversion Repository

Revision: 17290
Author:   gauravj@adobe.com
Date:     2010-08-11T23:07:53.010551Z

Log Message:
-----------
Updating to latest localized DITA files.

QE notes: None
Doc notes: None
Bugs:
Reviewer:
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
442 paths were modified

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

--- frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as
+++ frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as
@@ -6,7 +6,7 @@
 //
 //  NOTICE: Adobe permits you to use, modify, and distribute this file
 //  in accordance with the terms of the license agreement accompanying it.
-//
+// foo
 ////////////////////////////////////////////////////////////////////////////////

 package spark.layouts


Stick the conf filename in the title bar.

--- exporter/src/main/as/flump/export/Exporter.as
+++ exporter/src/main/as/flump/export/Exporter.as
@@ -133,15 +133,15 @@
         });

         function openConf () :void {
-            if (_confFile.exists) {
-                try {
-                    _conf = FlumpConf.fromJSON(JSONFormat.readJSON(_confFile));
-                } catch (e :Error) {
-                    log.warning("Unable to parse conf", e);
-                    _errors.dataProvider.addItem(new ParseError(_confFile.nativePath,
-                        ParseError.CRIT, "Unable to read configuration"));
-                }
-            } else _confFile = null;
+            try {
+                _conf = FlumpConf.fromJSON(JSONFormat.readJSON(_confFile));
+                _win.title = _confFile.name;
+            } catch (e :Error) {
+                log.warning("Unable to parse conf", e);
+                _errors.dataProvider.addItem(new ParseError(_confFile.nativePath,
+                    ParseError.CRIT, "Unable to read configuration"));
+                _confFile = null;
+            }
         };

         const saveAsMenuItem :NativeMenuItem =


Transferred from the Adobe Open Source Subversion Repository

Revision: 20690
Author:   mhorn@adobe.com
Date:     2011-03-08T20:26:51.755036Z

Log Message:
-----------
ASDoc updates

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/Legend.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/PieChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/PlotChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/series/items/LineSeriesSegment.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/series/ColumnSeries.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/CandlestickChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/HLOCChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/InstanceCache.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/series/BarSeries.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/Series.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/LineChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/CartesianChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/ChartBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/BubbleChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/PolarChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/effects/SeriesZoom.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/CartesianDataCanvas.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/ColumnChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/DateTimeAxis.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/PolarDataCanvas.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/BarChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/AreaChart.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/charts/src/mx/charts/chartClasses/ChartElement.as</path>

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

--- frameworks/projects/charts/src/mx/charts/series/items/LineSeriesSegment.as
+++ frameworks/projects/charts/src/mx/charts/series/items/LineSeriesSegment.as
@@ -35,39 +35,39 @@
     //
     //--------------------------------------------------------------------------

-	/**
-	 *  Constructor.
-	 *
-	 *	@param element The owning series.
-	 *
-	 *	@param index The index of the segment in the Array of segments
-	 *  representing the line series.
-	 *
-	 *	@param items The Array of LineSeriesItems
-	 *  representing the full line series.
-	 *
-	 *	@param start The index in the items Array
-	 *  of the first item in this segment.
-	 *
-	 *	@param end The index in the items Array
-	 *  of the last item in this segment, inclusive.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public function LineSeriesSegment(element:LineSeries, index:uint,
-									  items:Array /* of LineSeriesItem */, start:uint, end:uint)
-	{
-		super();
+    /**
+     *  Constructor.
+     *
+     *  @param element The owning series.
+     *
+     *  @param index The index of the segment in the Array of segments
+     *  representing the line series.
+     *
+     *  @param items The Array of LineSeriesItems
+     *  representing the full line series.
+     *
+     *  @param start The index in the items Array
+     *  of the first item in this segment.
+     *
+     *  @param end The index in the items Array
+     *  of the last item in this segment, inclusive.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function LineSeriesSegment(element:LineSeries, index:uint,
+                                      items:Array /* of LineSeriesItem */, start:uint, end:uint)
+    {
+        super();

-		this.element = element;
-		this.items = items;
-		this.index = index;
-		this.start = start;
-		this.end = end;
-	}
+        this.element = element;
+        this.items = items;
+        this.index = index;
+        this.start = start;
+        this.end = end;
+    }

     //--------------------------------------------------------------------------
     //
@@ -76,87 +76,87 @@
     //--------------------------------------------------------------------------

     //----------------------------------
-	//  element
+    //  element
     //----------------------------------

-	[Inspectable(environment="none")]
+    [Inspectable(environment="none")]

-	/**
-	 *  The series or element that owns this segment.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public var element:LineSeries;
+    /**
+     *  The series or element that owns this segment.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var element:LineSeries;

     //----------------------------------
-	//  end
+    //  end
     //----------------------------------

-	[Inspectable(environment="none")]
+    [Inspectable(environment="none")]

-	/**
-	 *  The index into the items array of the last item
-	 *  in this segment, inclusive.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public var end:uint;
+    /**
+     *  The index into the items array of the last item
+     *  in this segment, inclusive.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var end:uint;

     //----------------------------------
-	//  index
+    //  index
     //----------------------------------

-	[Inspectable(environment="none")]
+    [Inspectable(environment="none")]

-	/**
-	 *  The index of this segment in the array of segments
-	 *  representing the line series.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public var index:uint;
+    /**
+     *  The index of this segment in the array of segments
+     *  representing the line series.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var index:uint;

     //----------------------------------
-	//  items
+    //  items
     //----------------------------------

-	[Inspectable(environment="none")]
+    [Inspectable(environment="none")]

-	/**
-	 *  The array of chartItems representing the full line series
-	 *  that owns this segment.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public var items:Array /* of LineSeriesItem */;
+    /**
+     *  The array of chartItems representing the full line series
+     *  that owns this segment.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var items:Array /* of LineSeriesItem */;

     //----------------------------------
-	//  start
+    //  start
     //----------------------------------

-	[Inspectable(environment="none")]
+    [Inspectable(environment="none")]

-	/**
-	 *  The index into the items array of the first item in this segment.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public var start:uint;
+    /**
+     *  The index into the items array of the first item in this segment.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public var start:uint;

     //--------------------------------------------------------------------------
     //
@@ -164,18 +164,20 @@
     //
     //--------------------------------------------------------------------------

-	/**
-	 *  Returns a copy of this segment.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public function clone():LineSeriesSegment
-	{
-		return new LineSeriesSegment(element, index, items, start, end);
-	}
+    /**
+     *  Returns a copy of this segment.
+     *
+     *  @return A copy of this segment.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function clone():LineSeriesSegment
+    {
+        return new LineSeriesSegment(element, index, items, start, end);
+    }
 }

 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 16560
Author:   smgilson@adobe.com
Date:     2010-06-14T21:14:37.093170Z

Log Message:
-----------
Fix ASDoc version tags for several Flex 4 classes makred as Flex 3

QE notes:
Doc notes:
Bugs:
Reviewer:
Tests run: checkintests
Is noteworthy for integration:

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/NavigatorContent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/RadioButtonGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/core/SpriteVisualElement.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/events/LoaderInvalidationEvent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Group.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ListDropIndicator.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Application.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/SkinnableDataContainer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
@@ -308,9 +308,9 @@
      *  @inheritDoc
      *
      *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
      */
     override public function get baselinePosition():Number
     {


Transferred from the Adobe Open Source Subversion Repository

Revision: 5104
Author:   clucier@adobe.com
Date:     2009-02-27T14:51:34.248850Z

Log Message:
-----------
Default button support for Spark containers and editable text controls.
QE Notes:
Doc Notes:
Bugs: SDK-19420
Reviewer: Glenn, Gordon

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/FxContainerBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ContainerGlobals.as</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/projects/flex4/src/mx/components/FxButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/IFocusManagerContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/colorPickerClasses/SwatchPanel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Menu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/FocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/TextView.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/skins/spark/FxDefaultButtonSkin.mxml</path>

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

--- frameworks/projects/spark/src/SparkClasses.as
+++ frameworks/projects/spark/src/SparkClasses.as
@@ -25,6 +25,7 @@
  */
 import mx.skins.spark.FxApplicationSkin; FxApplicationSkin;
 import mx.skins.spark.FxButtonSkin; FxButtonSkin;
+import mx.skins.spark.FxDefaultButtonSkin; FxDefaultButtonSkin;
 import mx.skins.spark.FxButtonBarSkin; FxButtonBarSkin;
 import mx.skins.spark.FxButtonBarFirstButtonSkin; FxButtonBarFirstButtonSkin;
 import mx.skins.spark.FxButtonBarMiddleButtonSkin; FxButtonBarMiddleButtonSkin;


Transferred from the Adobe Open Source Subversion Repository

Revision: 9771
Author:   gauravj@adobe.com
Date:     2009-08-28T21:33:53.512703Z

Log Message:
-----------
Include class that were moved from framework_textLayout to spark project into spark.swc

QE notes: None.
Doc notes: None
Reviewed By: Pete
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/spark/src/SparkClasses.as

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

--- frameworks/projects/spark/src/SparkClasses.as
+++ frameworks/projects/spark/src/SparkClasses.as
@@ -23,6 +23,9 @@
  *  For example, Button does not have a reference to ButtonSkin,
  *  but ButtonSkin needs to be in framework.swc along with Button.
  */
+import mx.core.UITLFTextField; UITLFTextField;
+import mx.controls.dataGridClasses.TLFDataGridItemRenderer; TLFDataGridItemRenderer ;
+
 import spark.core.SpriteVisualElement; SpriteVisualElement;
 import spark.skins.spark.ApplicationSkin; ApplicationSkin;
 import spark.skins.spark.BorderSkin; BorderSkin;


Attach presence data to a user's departure

git-svn-id: c197267f952b24206666de142881703007ca05d5@9510 b35dd754-fafc-0310-a699-88a17e54d16e

--- src/org/jivesoftware/xiff/conference/Room.as
+++ src/org/jivesoftware/xiff/conference/Room.as
@@ -962,6 +962,7 @@
 		           		// Notify listeners that a user has left the room
 		           		e = new RoomEvent(RoomEvent.USER_DEPARTURE);
 		            	e.nickname = userNickname
+		            	e.data = aPresence;
 		            	dispatchEvent(e);
 		            	removeItemAt (i);
 		            }


Remove trailing ResultAttributes#toResultAttributes() content newlines.

--- src/widgets/supportClasses/ResultAttributes.as
+++ src/widgets/supportClasses/ResultAttributes.as
@@ -75,7 +75,7 @@

         resultAttributes.attributes = graphic.attributes;
         resultAttributes.title = title ? title : fallbackTitle;
-        resultAttributes.content = content;
+        resultAttributes.content = content.replace(/\n$/, '');
         resultAttributes.link = link ? link : null;
         resultAttributes.linkAlias = linkAlias;


[utils] Adds DateUtil class

[utils] Adds DateUtil class

--- skein-utils/src/skein/utils/DateUtil.as
+++ skein-utils/src/skein/utils/DateUtil.as
@@ -5,8 +5,17 @@
 {
 public class DateUtil
 {
-    public function DateUtil()
+    public static function same(date1:Date, date2:Date):Boolean
     {
+        if (date1 == date2) return true;
+
+        if (date1 == null && date2 == null) return true;
+
+        if (date1 == null || date2 == null) return false;
+
+        if (date1.time == date2.time) return true;
+
+        return false;
     }
 }
 }


Added error reporting if evaluateExpression() is given a bad
assignVariableName parameter.

Change-Id: Iebc1ca5f02dac59ee91fc920a24b32db3724cbda

--- WeaveCore/src/weave/core/ExternalSessionStateInterface.as
+++ WeaveCore/src/weave/core/ExternalSessionStateInterface.as
@@ -284,6 +284,9 @@
 					_compiler.includeLibraries.apply(null, staticLibraries);

 				var isAssignment:Boolean = (assignVariableName != null); // allows '' to be used to ignore resulting value
+				if (assignVariableName && !_compiler.isValidSymbolName(assignVariableName))
+					throw new Error("Invalid variable name: " + Compiler.encodeString(assignVariableName));
+
 				var thisObject:Object = getObjectFromPathOrVariableName(scopeObjectPathOrVariableName);
 				var compiledObject:ICompiledObject = _compiler.compileToObject(expression);
 				var isFuncDef:Boolean = _compiler.compiledObjectIsFunctionDefinition(compiledObject);


- bugfix: Adapted FormSet to changes in how child elements are added to the display list

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@912 bc4816be-ef27-423a-9c4d-fc420be121a2

--- src/reprise/controls/html/FormSet.as
+++ src/reprise/controls/html/FormSet.as
@@ -136,20 +136,44 @@
 			{
 				if (m_activeFormIndex == -1)
 				{
-					setActiveFormIndex(0);
+					if (m_forms.length)
+					{
+						setActiveFormIndex(0);
+					}
 					return;
 				}
 			}
 			setActiveFormIndex(m_activeFormIndex);
 		}

+		protected function addForm(form : Form) : void
+		{
+			m_forms.push(form);
+			form.addEventListener(FormEvent.SUBMIT, form_submit);
+			form.addEventListener(FormEvent.BACK, form_back);
+
+			if (m_firstDraw)
+			{
+				if (m_activeFormIndex == -1 || m_activeFormIndex == m_forms.length - 1)
+				{
+					setActiveFormIndex(m_forms.length - 1);
+				}
+			}
+		}
+
+		protected function removeForm(form : Form) : void
+		{
+			var index:int = m_forms.indexOf(form);
+			form.removeEventListener(FormEvent.SUBMIT, form_submit);
+			form.removeEventListener(FormEvent.BACK, form_back);
+			m_forms.splice(index, 1);
+		}
+
 		protected function self_displayObjectAdded(e:Event):void
 		{
 			if (e.target is Form)
 			{
-				m_forms.push(e.target);
-				(e.target as Form).addEventListener(FormEvent.SUBMIT, form_submit);
-				(e.target as Form).addEventListener(FormEvent.BACK, form_back);
+				addForm(Form(e.target));
 			}
 		}

@@ -157,10 +181,7 @@
 		{
 			if (e.target is Form)
 			{
-				var index:int = m_forms.indexOf(e.target);
-				(m_forms[index] as Form).removeEventListener(FormEvent.SUBMIT, form_submit);
-				(m_forms[index] as Form).removeEventListener(FormEvent.BACK, form_back);
-				m_forms.splice(index, 1);
+				removeForm(Form(e.target));
 			}
 		}


Various ways in which references were completely broken during decoding, now fixed.

--- tamarin-central/thane/AMF3Decoder.as
+++ tamarin-central/thane/AMF3Decoder.as
@@ -100,9 +100,12 @@
         }

         // if not, read N bytes
-        var str :String = _ctx.bytes.readUTFBytes(code >> 1);
-        _ctx.sRef.table[str] = _ctx.sRef.ix ++;
-        return str;
+        if ((code >> 1) > 0) {
+            var str :String = _ctx.bytes.readUTFBytes(code >> 1);
+            _ctx.sRef.push(str);
+            return str;
+        }
+        return "";
     }

     private static function decodeArray () :Array
@@ -116,7 +119,7 @@

         // if not, create our array & note its reference
         var result :Array = [ ];
-        _ctx.oRef.table[result] = _ctx.oRef.ix ++;
+        _ctx.oRef.push(result);

         // then first read associative pairs
         var key :String;
@@ -149,14 +152,14 @@
         } else if ((code & 0x04) == 0) {
             // it's a new trait, read class name & N sealed variable names
             var alias :String = decodeString();
-            var className = (alias.length > 0) ? AMF3.getClassNameByAlias(alias) : "";
+            var className = (alias.length > 0) ? AMF3.getClassNameByAlias(alias) : null;
             var N :uint = code >> 4;
             var vars :Array = new Array(N);
             for (var ii :int = 0; ii < N; ii ++) {
                 vars[ii] = decodeString();
             }
             traits = new Traits(className, (code & 0x08) != 0, vars);
-            _ctx.tRef.table[traits] = _ctx.tRef.ix ++;
+            _ctx.tRef.push(traits);

         } else {
             throw new Error("IExternalizable serialization not supported");
@@ -171,7 +174,7 @@
         }

         // register the reference
-        _ctx.oRef.table[obj] = _ctx.oRef.ix ++;
+        _ctx.oRef.push(obj);

         // read the sealed values
         for (var ii :int = 0; ii < traits.vars.length; ii ++) {
@@ -200,7 +203,7 @@
         var bytes :ByteArray = new ByteArray();

         // register
-        _ctx.oRef.table[bytes] = _ctx.oRef.ix ++;
+        _ctx.oRef.push(bytes);

         // and read the bytes
         _ctx.bytes.readBytes(bytes, 0, code >> 1);
@@ -219,20 +222,14 @@
 {
     public var bytes :ByteArray;

-    public var oRef :References = new References();
-    public var sRef :References = new References();
-    public var tRef :References = new References();
+    public var oRef :Array = new Array();
+    public var sRef :Array = new Array();
+    public var tRef :Array = new Array();

     public function Context (bytes :ByteArray)
     {
         this.bytes = bytes;
     }
-}
-
-class References
-{
-    public var table :Dictionary = new Dictionary();
-    public var ix :uint = 0;
 }

 class Traits


added muteAndPause method to fade out volume

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@163 bc4816be-ef27-423a-9c4d-fc420be121a2

--- src/reprise/media/AbstractPlayer.as
+++ src/reprise/media/AbstractPlayer.as
@@ -13,13 +13,15 @@
 {

 	import flash.events.EventDispatcher;
+	import com.robertpenner.easing.Linear;
+	import flash.events.TimerEvent;
 	import flash.utils.getTimer;
 	import flash.utils.Timer;
-	import flash.events.TimerEvent;
 	import reprise.events.CommandEvent;
+	import reprise.events.MediaEvent;
 	import reprise.events.StateChangeEvent;
-	import reprise.events.MediaEvent;
 	import reprise.external.IResource;
+	import reprise.tweens.SimpleTween;
 	import reprise.utils.MathUtil;

@@ -76,6 +78,8 @@
 		protected var m_speed:Number;
 		protected var m_lastLoadProgress:uint = 0;
 		protected var m_lastSpeedCheck:uint;
+		protected var m_muteTween:SimpleTween;
+		protected var m_volumeBeforeFade:Number;

@@ -236,6 +240,21 @@
 			vol = Math.min(1, vol);
 			m_volume = vol;
 			doSetVolume(vol);
+		}
+
+		public function muteAndPause(duration:uint):void
+		{
+			if (m_state != STATE_PLAYING)
+			{
+				return;
+			}
+			m_volumeBeforeFade = volume();
+			cancelMuteTween();
+			m_muteTween = new SimpleTween(duration);
+			m_muteTween.addTweenProperty(this, 'setVolume', m_volumeBeforeFade, 0,
+				Linear.easeNone, false, true);
+			m_muteTween.addEventListener(CommandEvent.COMPLETE, muteTween_complete);
+			m_muteTween.execute();
 		}

 		public function volume():Number
@@ -393,6 +412,15 @@
 				return;
 			}
 			setState(STATE_IDLE);
+		}
+
+		protected function cancelMuteTween():void
+		{
+			if (m_muteTween && m_muteTween.isRunning())
+			{
+				m_muteTween.removeEventListener(CommandEvent.COMPLETE, muteTween_complete);
+				m_muteTween.cancel();
+			}
 		}

 		protected function setState(state:uint):void
@@ -624,5 +652,11 @@
 				}
 			}
 		}
+
+		protected function muteTween_complete(e:CommandEvent):void
+		{
+			pause();
+			setVolume(m_volumeBeforeFade);
+		}
 	}
 }


lockData() and unlockData() methods for bulk update of stream data

--- src/aerys/minko/type/stream/VertexStream.as
+++ src/aerys/minko/type/stream/VertexStream.as
@@ -27,6 +27,8 @@
 		private var _invalidMinMax	: Boolean					= true;
 		private var _maximum		: Vector.<Number>			= null;
 		private var _minimum		: Vector.<Number>			= null;
+
+		private var _dataLocked		: Boolean					= false;

 		private var _changed		: Signal					= new Signal('VertexStream.changed');
 		private var _boundsChanged	: Signal					= new Signal('VertexStream.boundsChanged');
@@ -104,7 +106,7 @@
 		{
 			if (!_invalidMinMax)
 				return ;
-
+
 			_invalidMinMax = false;

 			var size		: uint	= format.dwordsPerVertex;
@@ -141,6 +143,8 @@

 		public function deleteVertexByIndex(index : uint) : Boolean
 		{
+			checkWriteUsage(this);
+
 			if (index > length)
 				return false;

@@ -196,6 +200,24 @@
 			_changed.execute(this, null);
 			_boundsChanged.execute(this);
 		}
+
+		public function lockData(): Vector.<Number> {
+			if (_dataLocked)
+				throw new Error("Data lock is already active");
+			if (_localDispose)
+				throw new Error("Can not lock stream data which is marked for disposal");
+			checkWriteUsage(this);
+			_dataLocked = true;
+			return _data;
+		}
+
+		public function unlockData(): void {
+			if (!_dataLocked)
+				throw new Error("Data is not locked");
+			_dataLocked = false;
+			_invalidMinMax = true;
+			_changed.execute(this, null);
+		}

 		public function push(data : Vector.<Number>) : void
 		{
@@ -215,6 +237,8 @@

 		public function disposeLocalData(waitForUpload : Boolean = true) : void
 		{
+			if (_dataLocked)
+				throw new Error("Stream data can not be disposed since it's locked for update");
 			if (waitForUpload)
 				_localDispose = true;
 			else
@@ -336,6 +360,11 @@
 					+ "is not set to StreamUsage.WRITE."
 				);
 			}
+			if (stream._dataLocked)
+				throw new Error(
+					"Unable to write in vertex stream: stream data "
+					+ "is locked for bulk update"
+				);
 		}

 		public static function concat(streams : Vector.<IVertexStream>, usage : uint) : VertexStream
@@ -416,4 +445,4 @@
 			return stream;
 		}
 	}
-}+}


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@1262302 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/skins/halo/ListDropIndicator.as
+++ frameworks/projects/framework/src/mx/skins/halo/ListDropIndicator.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2003-2006 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 mx.skins.halo
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 22626
Author:   jasonsj@adobe.com
Date:     2011-09-19T22:10:23.057304Z

Log Message:
-----------
Set maxWidth/maxHeight in Callout (SDK-31522). When Callout content grows larger than the screen size, maxWidth and maxHeight keep the callout constrainted to the screen bounds based on horizontalPosition and verticalPosition. Users may override by providing their own maxWidth and maxHeight.
Support minimum hit area in mobile skins. Currently disabled (SDK-31494).

QE notes: Verify that we have tests where the callout is not explicitly sized and where the callout content is larger than the screen size.
Doc notes:
Bugs:
SDK-31522 Callout sized incorrectly when used with SplitViewNavigator
Reviewer: gruehle
Tests run: checkintests, mustella-mobile
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/ListSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/SplitViewNavigatorSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/MobileSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/ToggleSwitchSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/Callout.as</path>

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

--- frameworks/projects/mobilecomponents/src/spark/components/Callout.as
+++ frameworks/projects/mobilecomponents/src/spark/components/Callout.as
@@ -27,6 +27,7 @@
 import mx.core.UIComponent;
 import mx.core.mx_internal;
 import mx.events.ResizeEvent;
+import mx.managers.ISystemManager;
 import mx.managers.SystemManager;
 import mx.styles.StyleProtoChain;
 import mx.utils.MatrixUtil;
@@ -535,6 +536,32 @@
     //  Overridden methods
     //
     //--------------------------------------------------------------------------
+
+    private var calloutMaxWidth:Number = NaN;
+
+    /**
+     *  @private
+     */
+    override public function get explicitMaxWidth():Number
+    {
+        if (!isNaN(super.explicitMaxWidth))
+            return super.explicitMaxWidth;
+
+        return calloutMaxWidth;
+    }
+
+    private var calloutMaxHeight:Number = NaN;
+
+    /**
+     *  @private
+     */
+    override public function get explicitMaxHeight():Number
+    {
+        if (!isNaN(super.explicitMaxHeight))
+            return super.explicitMaxHeight;
+
+        return calloutMaxHeight;
+    }

     /**
      *  @private
@@ -576,7 +603,7 @@
      */
     override public function updatePopUpPosition():void
     {
-        if (!owner)
+        if (!owner || !systemManager)
             return;

         var popUpPoint:Point = calculatePopUpPosition();
@@ -620,6 +647,10 @@
     {
         if (isOpen)
             return;
+
+        // Reset max size for new owner before this callout is added
+        // to PopUpManager
+        determineMaxSize(owner);

         // Add to PopUpManager, calls updatePopUpPosition(), and change state
         super.open(owner, modal);
@@ -776,6 +807,9 @@
                 // Add owner offset
                 if (ownerX > 0)
                     arrowX += Math.abs(ownerX - getLayoutBoundsX());
+
+                if (ownerX < margin)
+                    arrowX -= (margin - ownerX);
             }

             // arrow should not extend past the callout bounds
@@ -812,6 +846,9 @@
                 // Add owner offset
                 if (ownerY > 0)
                     arrowY += Math.abs(ownerY - getLayoutBoundsY());
+
+                if (ownerY < margin)
+                    ownerY -= (margin - ownerY);
             }

             // arrow should not extend past the callout bounds
@@ -1221,6 +1258,104 @@
             }
         }
     }
+
+    /**
+     *  @private
+     */
+    mx_internal function determineMaxSize(owner:DisplayObject = null):void
+    {
+        var calloutOwner:UIComponent = owner as UIComponent;
+        var sbRoot:DisplayObject = (calloutOwner) ? calloutOwner.systemManager.getSandboxRoot() : null;
+
+        // Sanity check
+        if (!sbRoot)
+            return;
+
+        // Clear previous max size values
+        calloutMaxWidth = calloutMaxHeight = NaN;
+
+        // Set maxWidth and maxHeight based on owner bounds. Prefer top/bottom
+        // and left/right max based on most available space. The owner can
+        // still be obscured only if horizontalPosition and verticalPosition
+        // are explicitly set START or END.
+        var screen:Rectangle = calloutOwner.screen;
+        var ownerBounds:Rectangle = calloutOwner.getBounds(sbRoot);
+        var isLandscape:Boolean = (screen.width > screen.height);
+
+        var ownerLeft:Number = ownerBounds.left;
+        var ownerRight:Number = ownerBounds.right;
+        var calloutMaxW:Number = NaN;
+
+        // Compute max width based on preferred position. Actual position
+        // is later based on this max width.
+        switch (horizontalPosition)
+        {
+            case CalloutPosition.AUTO:
+            {
+                // fall through to middle when portrait
+                if (isLandscape)
+                    break;
+            }
+            case CalloutPosition.MIDDLE:
+            {
+                // Callout matches screen width
+                calloutMaxW = screen.width - (margin * 2);
+                break;
+            }
+            case CalloutPosition.START:
+            case CalloutPosition.END:
+            {
+                // Swap left and right when using inner positions
+                ownerLeft = ownerBounds.right;
+                ownerRight = ownerBounds.left;
+                break;
+            }
+        }
+
+        if (!isNaN(calloutMaxW))
+            calloutMaxWidth = calloutMaxW;
+        else
+            calloutMaxWidth = Math.max(ownerLeft, screen.right - ownerRight) - margin;
+
+        var ownerTop:Number = ownerBounds.top;
+        var ownerBottom:Number = ownerBounds.bottom;
+        var calloutMaxH:Number = NaN;
+
+        // Compute max height based on preferred position. Actual position
+        // is later based on this max height.
+        switch (verticalPosition)
+        {
+            case CalloutPosition.AUTO:
+            {
+                // fall through to middle when landscape
+                if (!isLandscape)
+                    break;
+            }
+            case CalloutPosition.MIDDLE:
+            {
+                // Callout matches screen height
+                calloutMaxH = screen.height - (margin * 2);
+                break;
+            }
+            case CalloutPosition.START:
+            case CalloutPosition.END:
+            {
+                // Swap top and bottom when using inner positions
+                ownerTop = ownerBounds.bottom;
+                ownerBottom = ownerBounds.top;
+                break;
+            }
+        }
+
+        if (!isNaN(calloutMaxH))
+            calloutMaxHeight = calloutMaxH;
+        else
+            calloutMaxHeight = Math.max(ownerTop, screen.bottom - ownerBottom) - margin;
+
+        // invalidate size if no explicit max sizes are set
+        if (skin && ((isNaN(super.explicitMaxWidth) || isNaN(super.explicitMaxHeight))))
+            skin.invalidateSize();
+    }

     /**
      *  @private
@@ -1287,6 +1422,8 @@
         var ownerVisualElement:ILayoutElement = owner as ILayoutElement;
         var ownerWidth:Number = (ownerVisualElement) ? ownerVisualElement.getLayoutBoundsWidth() : owner.width;
         var ownerHeight:Number = (ownerVisualElement) ? ownerVisualElement.getLayoutBoundsHeight() : owner.height;
+        var calloutWidth:Number = getLayoutBoundsWidth();
+        var calloutHeight:Number = getLayoutBoundsHeight();

         switch (horizontalPos)
         {
@@ -1306,7 +1443,7 @@
             case CalloutPosition.END:
             {
                 // The ends of the owner and callout are aligned
-                registrationPoint.x = (ownerWidth - width);
+                registrationPoint.x = (ownerWidth - calloutWidth);
                 break;
             }
             case CalloutPosition.AFTER:
@@ -1318,7 +1455,7 @@
             }
             default: // case CalloutPosition.MIDDLE:
             {
-                registrationPoint.x = Math.floor((ownerWidth - width) / 2);
+                registrationPoint.x = Math.floor((ownerWidth - calloutWidth) / 2);
                 break;
             }
         }
@@ -1340,13 +1477,13 @@
             }
             case CalloutPosition.MIDDLE:
             {
-                registrationPoint.y = Math.floor((ownerHeight - height) / 2);
+                registrationPoint.y = Math.floor((ownerHeight - calloutHeight) / 2);
                 break;
             }
             case CalloutPosition.END:
             {
                 // The ends of the owner and callout are aligned
-                registrationPoint.y = (ownerHeight - height);
+                registrationPoint.y = (ownerHeight - calloutHeight);
                 break;
             }
             default: //case CalloutPosition.AFTER:
@@ -1359,7 +1496,7 @@
         }

         var topLeft:Point = registrationPoint.clone();
-        var size:Point = MatrixUtil.transformBounds(width, height, matrix, topLeft);
+        var size:Point = MatrixUtil.transformBounds(calloutWidth, calloutHeight, matrix, topLeft);
         var bounds:Rectangle = new Rectangle();

         bounds.left = topLeft.x;
@@ -1400,6 +1537,7 @@
     {
         // Screen resize might require a new arrow direction and callout position
         invalidatePosition();
+        determineMaxSize(owner);
     }
 }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 17997
Author:   jszeto@adobe.com
Date:     2010-10-01T23:51:16.437475Z

Log Message:
-----------
ViewMenu appearance and layout update

Changed ViewMenuItem appearance
ViewMenuItem now subclasses ButtonSkin and uses fxg files for the three states
Changed ViewMenuSkin appearance
Implemented a new brick style layout for ViewMenuLayout

QE notes:
Doc notes:
Bugs:
Reviewer:
Tests run:
Is noteworthy for integration:

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/layouts/ViewMenuLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ViewMenuItemSkin.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/assets/ViewMenuItem_showsCaret.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/assets/ViewMenuItem_up.fxg</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/defaults.css</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/assets/ViewMenuItem_down.fxg</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ViewMenu.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/MobileApplicationBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ViewMenuSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ButtonSkin.as</path>

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

--- frameworks/projects/mobiletheme/src/spark/skins/mobile/ButtonSkin.as
+++ frameworks/projects/mobiletheme/src/spark/skins/mobile/ButtonSkin.as
@@ -16,6 +16,7 @@
 import flash.display.GradientType;
 import flash.geom.Matrix;

+import mx.core.mx_internal;
 import mx.states.SetProperty;
 import mx.states.State;
 import mx.utils.ColorUtil;
@@ -24,7 +25,9 @@
 import spark.skins.mobile.assets.Button_down;
 import spark.skins.mobile.assets.Button_up;
 import spark.skins.mobile.supportClasses.ButtonSkinBase;
-
+
+use namespace mx_internal;
+
 /*
     ISSUES:
     - should we support textAlign
@@ -114,10 +117,7 @@
     {
         super.commitCurrentState();

-        if (currentState == "down")
-            borderClass = downBorderSkin;
-        else
-            borderClass = upBorderSkin;
+        borderClass = getBorderClassForCurrentState();

         if (!(bgImg is borderClass))
         {
@@ -178,8 +178,6 @@
      *  @playerversion Flash 10
      *  @playerversion AIR 2.5
      *  @productversion Flex 4.5
-     *
-     *  @default Button_down
      */
     protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
     {
@@ -201,6 +199,22 @@
         graphics.drawRect(1, 1, unscaledWidth - 1, unscaledHeight - 1);
         graphics.endFill();
     }
+
+    /**
+     *  Returns the borderClass to use based on the currentState
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function getBorderClassForCurrentState():Class
+    {
+        if (currentState == "down")
+            return downBorderSkin;
+        else
+            return upBorderSkin;
+    }

 }
 }


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@1273739 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/rpc/src/mx/messaging/channels/amfx/AMFXHeader.as
+++ frameworks/projects/rpc/src/mx/messaging/channels/amfx/AMFXHeader.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2005-2007 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 mx.messaging.channels.amfx
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 23246
Author:   cframpto@adobe.com
Date:     2011-12-20T17:40:08.069454Z

Log Message:
-----------
Rollback 23243.  If comment followed header it was stripped as well.

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

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

--- frameworks/projects/spark/src/spark/accessibility/CheckBoxAccImpl.as
+++ frameworks/projects/spark/src/spark/accessibility/CheckBoxAccImpl.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 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.accessibility
 {