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

--- frameworks/projects/advancedgrids/src/mx/olap/OLAPCube.as
+++ frameworks/projects/advancedgrids/src/mx/olap/OLAPCube.as
@@ -0,0 +1,1142 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.olap
+{
+
+import flash.events.Event;
+import flash.events.EventDispatcher;
+import flash.events.IEventDispatcher;
+import flash.events.TimerEvent;
+import flash.utils.Dictionary;
+import flash.utils.Proxy;
+import flash.utils.Timer;
+import flash.utils.getTimer;
+
+import mx.collections.ArrayCollection;
+import mx.collections.ICollectionView;
+import mx.collections.IList;
+import mx.collections.Sort;
+import mx.core.mx_internal;
+import mx.events.CubeEvent;
+import mx.messaging.messages.ErrorMessage;
+import mx.resources.ResourceManager;
+import mx.rpc.AsyncToken;
+import mx.rpc.IResponder;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+*  Dispatched when a cube has been created
+*  and is ready to be queried.
+*
+*  @eventType mx.events.CubeEvent.CUBE_COMPLETE
+*
+*  @langversion 3.0
+*  @playerversion Flash 9
+*  @playerversion AIR 1.1
+*  @productversion Flex 3
+*/
+[Event(name="complete", type="mx.events.CubeEvent")]
+
+/**
+*  Dispatched continuously as a cube is being created
+*  by a call to the refresh() method.
+*
+*  @eventType mx.events.CubeEvent.CUBE_PROGRESS
+*
+*  @langversion 3.0
+*  @playerversion Flash 9
+*  @playerversion AIR 1.1
+*  @productversion Flex 3
+*/
+[Event(name="progress", type="mx.events.CubeEvent")]
+
+/**
+*  Dispatched continuously as a query result is being generated
+*  by a call to the execute() method.
+*
+*  @eventType mx.events.CubeEvent.QUERY_PROGRESS
+*
+*  @langversion 3.0
+*  @playerversion Flash 9
+*  @playerversion AIR 1.1
+*  @productversion Flex 3
+*/
+[Event(name="queryProgress", type="mx.events.CubeEvent")]
+
+//--------------------------------------
+//  metadata
+//--------------------------------------
+
+[DefaultProperty("elements")]
+
+[ResourceBundle("olap")]
+
+/**
+ *  The OLAPCube class represents an OLAP cube.
+ *
+ *  @mxml
+ *

+ *  The <mx:OLAPCube> tag inherits all of the tag attributes
+ *  of its superclass, and adds the following tag attributes:
+ *

+ *

+ *  <mx:OLAPCube
+ *    Properties
+ *    dataProvider=""
+ *    dimensions=""
+ *    elements=""
+ *    measures=""
+ *  />
+ *.
+ *  @see mx.olap.IOLAPCube
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class OLAPCube extends Proxy implements IOLAPCube, IEventDispatcher
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param name The name of the OLAP cube.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function OLAPCube(name:String=null)
+    {
+        OLAPTrace.traceMsg("Creating cube: " + name, OLAPTrace.TRACE_LEVEL_3);
+        super();
+
+        this.name = name;
+
+        ev = new EventDispatcher(this);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  A map of dimensions based on their name.
+     */
+    private var _dimensionMap:Dictionary = new Dictionary(true);
+
+    //flag indicating whether we have prepared the dataProvider for processing
+    private var prepare:Boolean = false;
+
+    //saved sort property of the source dataProvider.
+    private var oldSort:Sort;
+
+    // index of the dimension being processed.
+    private var dimIndex:int = 0;
+
+    //progress in cube building
+    private var progress:int;
+
+    //total number of dimensions/data rows to process
+    private var total:int;
+
+    //the embedded event dispatcher object to support IEventDispatcher interface.
+    private var ev:EventDispatcher;
+
+    /**
+     *  @private
+     *  Timer used to build the cube.
+     */
+    private var cubeBuildingTimer:Timer;
+
+    /**
+     *  @private
+     *  Timer used to compute query results.
+     */
+    private var queryTimer:Timer;
+
+    /**
+     *  @private
+     *  Array holding all queries to be executed
+     */
+    private var _queriesPending:Array = [];
+
+    /**
+     *  @private
+     *  Map of query objects to their AsyncToken
+     */
+    private var _queryToken:Dictionary = new Dictionary(true);
+
+    private var _cubeImpl:IOLAPCubeImpl = new DefaultCubeImpl;
+
+    mx_internal var defaultMeasure:OLAPMeasure;
+
+    mx_internal var attributeToIndex:Dictionary;
+
+    /**
+     *  Sets the name of the dimension for the measures of the OLAP cube.
+     *
+     *  @default "Measures"
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected var measureDimensionName:String = "Measures";
+
+    /**
+     *  The class used by an OLAPCube instance to return the result.
+     *  You can replace the default class, OLAPResult, with your own implementation
+     *  of the IOLAPResult interface to customize the result.
+     *
+     *  @default OLAPResult
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected var resultClass:Class = OLAPResult;
+
+    /**
+     *  The time interval, in milliseconds, used by the timer of the refresh() method
+     *  to iteratively build the cube.
+     *  You can set it to a higher value if you can wait longer before the cube is built.
+     *  You can set it to a lower value, but it might negatively impact responsiveness of your application.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected var cubeBuildingTimeInterval:int = 5;
+
+    /**
+     *  The time interval, in milliseconds, used by the timer of the execute() method
+     *  to iteratively process queries.
+     *  You can set it to a higher value if you can wait for longer
+     *  before the cube generates the query result.
+     *  You can set it to a lower value to obtain query results faster,
+     *  but it might negatively impact the responsiveness of your application.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected var queryBuildingTimeInterval:int = 1;
+
+    /**
+     *  The time, in milliseconds, used by the refresh() method
+     *  to iteratively build the cube.
+     *  A higher value would mean more rows would get processed at each timer event.
+     *  You can set it to a higher value if you want the cube to be built faster,
+     *  but it might negatively impact responsiveness of your application.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected var workDuration:int = 50;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    // attributeLevels
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Returns an array of all levels in the cube.
+     *  Attribute levels duplicated in user defined hierarchy are skipped.
+     */
+    private var _attributeLevels:Array;
+
+    mx_internal function get attributeLevels():Array
+    {
+        if (_attributeLevels)
+            return _attributeLevels;
+
+        _attributeLevels = [];
+
+        var a:OLAPAttribute;
+        for each (var dim:IOLAPDimension in dimensions)
+        {
+            //skip measure dimension
+            if (dim.isMeasure)
+                continue;
+
+            //including attributes which are not part of any user defined hierarchy.
+            for each (a in dim.attributes)
+            {
+                // if the attribute is used in a user defined hierarchy we want to
+                // pick the attributes in the user specified order.
+                // so we skip it here.
+                if (!a.userHierarchyLevel)
+                    _attributeLevels = _attributeLevels.concat(a.allLevels.toArray());
+            }
+
+            //attributes in user defined hierarchy
+            for each (var h:OLAPHierarchy in dim.hierarchies)
+            {
+                var hLevels:IList = h.levels;
+                var length:int = hLevels.length;
+                for (var i:int = 0; i < length; ++i)
+                {
+                    a = OLAPLevel(hLevels.getItemAt(i)).attribute;
+                    _attributeLevels = _attributeLevels.concat(a.allLevels.toArray());
+                }
+            }
+        }
+
+        return _attributeLevels;
+    }
+
+    //----------------------------------
+    // dataProvider
+    //----------------------------------
+
+    private var _dataProvider:ICollectionView;
+
+    /**
+     *  The flat data used to populate the OLAP cube.
+     *  You must call the refresh() method
+     *  to initialize the cube after setting this property.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get dataProvider():ICollectionView
+    {
+        return _dataProvider;
+    }
+
+    /**
+     *  @private
+     */
+    public function set dataProvider(value:ICollectionView):void
+    {
+        var collection:ICollectionView = value as ICollectionView;
+
+        _dataProvider = collection;
+    }
+
+    //----------------------------------
+    // defaultTupleMembers
+    //----------------------------------
+
+    mx_internal var _defaultTupleMembers:Array;
+
+    mx_internal function get defaultTupleMembers():Array
+    {
+        if (!_defaultTupleMembers)
+        {
+            _defaultTupleMembers = new Array(attributeLevels.length/2);
+            attributeToIndex = new Dictionary;
+            var aIndex:int = 0;
+            var n:int = attributeLevels.length;
+            for (var i:int = 0; i < n; i += 2)
+            {
+                var attr:OLAPAttribute = attributeLevels[i].attribute;
+                attributeToIndex[attr] = aIndex;
+                _defaultTupleMembers[aIndex++] = attr.defaultMember;
+            }
+        }
+
+        return _defaultTupleMembers.slice();
+    }
+
+    //----------------------------------
+    // dimensions
+    //----------------------------------
+
+    /**
+     * @private
+     */
+    private var _dimensions:IList = new ArrayCollection;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get dimensions():IList
+    {
+        return _dimensions;
+    }
+
+    /**
+     *  @private
+     */
+    public function set dimensions(value:IList):void
+    {
+        //reset the cache of levels
+        _attributeLevels = null;
+        _dimensions = value;
+        var n:int = value.length;
+        for (var i:int = 0; i < n; ++i)
+        {
+            var dim:OLAPDimension = value.getItemAt(i) as OLAPDimension;
+            dim.cube = this;
+            _dimensionMap[dim.name] = dim;
+        }
+    }
+
+    //----------------------------------
+    // elements
+    //----------------------------------
+
+    /**
+    *  Processes the input Array and initializes the dimensions
+    *  and measures properties based on the elements of the Array.
+    *  Dimensions are represented in the Array by instances of the OLAPDimension class,
+    *  and measures are represented by instances of the OLAPMeasure class.
+    *
+    *
Use this property to define the dimensions and measures of a cube in a single Array.

+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 9
+    *  @playerversion AIR 1.1
+    *  @productversion Flex 3
+    */
+    public function set elements(value:Array):void
+    {
+        var dims:ArrayCollection = new ArrayCollection();
+        var userMeasures:ArrayCollection = new ArrayCollection();
+        for each (var element:Object in value)
+        {
+            if (element is OLAPDimension)
+                dims.addItem(element);
+            else if (element is OLAPMeasure)
+                userMeasures.addItem(element);
+            else
+                OLAPTrace.traceMsg("Invalid element specified for cube elements");
+        }
+
+        dimensions = dims;
+        measures = userMeasures;
+    }
+
+    //----------------------------------
+    // measures
+    //----------------------------------
+
+    /**
+     * @private
+     */
+    private var _measures:IList; //of OLAPMeasures
+
+    /**
+     *  Sets the measures of the OLAP cube, as a list of OLAPMeasure instances.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function set measures(value:IList):void
+    {
+        _measures = value;
+    }
+
+    //----------------------------------
+    // name
+    //----------------------------------
+
+    /**
+     * @private
+     */
+    private var _name:String;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get name():String
+    {
+        return _name;
+    }
+
+    /**
+     *  @private
+     */
+    public function set name(value:String):void
+    {
+        _name = value;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function cancelQuery(query:IOLAPQuery):void
+    {
+        var queryIndex:int = _queriesPending.indexOf(query);
+        if (queryIndex != -1)
+        {
+            // if the query was the current query ask cubeImpl to
+            // abort the query.
+            if (queryIndex == 0)
+                _cubeImpl.cancelQuery(query);
+            _queriesPending.splice(queryIndex, 1);
+
+            //TODO make a fault call?
+            delete _queryToken[query];
+            if (_queriesPending.length == 0)
+            {
+                queryTimer.stop();
+                queryTimer = null;
+            }
+        }
+    }
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function cancelRefresh():void
+    {
+        prepare = false;
+        progress = 0;
+
+        _cubeImpl.cancelRefresh();
+
+        if (cubeBuildingTimer)
+        {
+            cubeBuildingTimer.stop();
+            cubeBuildingTimer.removeEventListener(TimerEvent.TIMER,  updateDimensions);
+            cubeBuildingTimer.removeEventListener(TimerEvent.TIMER,  buildCube);
+            cubeBuildingTimer = null;
+        }
+
+        if (oldSort)
+        {
+            dataProvider.sort = oldSort;
+            dataProvider.refresh();
+        }
+    }
+
+    /**
+     *  @private
+     *  Creates a new dimension of the cube with the specified name.
+     *
+     *  @param name The name of the new dimension.
+     *
+     *  @return An OLAPDimension instance representing the new dimension.
+     */
+    public function createDimension(name:String):OLAPDimension
+    {
+        var dim:OLAPDimension = new OLAPDimension(name);
+        dim.cube = this;
+        _dimensions.addItem(dim);
+        _dimensionMap[name] = dim;
+        return dim;
+    }
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function findDimension(name:String):IOLAPDimension
+    {
+        return _dimensionMap[name];
+    }
+
+     /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function refresh():void
+    {
+        // check if the refresh is already in progress and return in that case.
+        // we can get into a infinite loop if refresh is being called in
+		// a collection change handler because a call to refresh sorts the dataProvider
+		// resulting in a collection changed event
+        if(cubeBuildingTimer)
+            return;
+
+        _attributeLevels = null;
+
+        //TODO if user sets new dimensions after refreshing we need to again
+        // position the measures dimension to the end of the list
+
+        // is this the right place to do this creation of Measures Level?
+        if (!findDimension(measureDimensionName))
+        {
+            var measuresDim:OLAPDimension = createDimension(measureDimensionName);
+            var measuresHierarchy:OLAPHierarchy = measuresDim.createHierarchy(measureDimensionName);
+            measuresHierarchy.hasAll = false;
+            measuresHierarchy.dimension = measuresDim;
+            var measuresLevel:OLAPLevel  = measuresHierarchy.createLevel(measureDimensionName);
+            measuresDim.setAsMeasure(true);
+
+            measuresDim.refresh();
+
+            if (!_measures || _measures.length == 0)
+            {
+                var message:String = ResourceManager.getInstance().getString(
+                            "olap", "noMeasures");
+                throw Error(message);
+            }
+
+            // loop: create measure members
+            var n:int = _measures.length;
+            for (var i:int = 0; i < n; ++i)
+            {
+                var m:OLAPMeasure = _measures.getItemAt(i) as OLAPMeasure;
+                m.dimension = measuresDim;
+                measuresLevel.addMember(m);
+            }
+        }
+
+        defaultMeasure = _measures.getItemAt(0) as OLAPMeasure;
+
+        //TODO a warning message to the user
+        if (!dataProvider)
+            return;
+
+        cubeBuildingTimer = new Timer(cubeBuildingTimeInterval);
+        cubeBuildingTimer.addEventListener(TimerEvent.TIMER,  updateDimensions);
+        cubeBuildingTimer.start();
+    }
+
+    /**
+     *  @private
+     */
+    private function dispatchCubeProgress(progress:int, total:int, message:String=null):void
+    {
+        var ev:CubeEvent = new CubeEvent(CubeEvent.CUBE_PROGRESS);
+        ev.progress = progress;
+        ev.total = total;
+        ev.message = message;
+        dispatchEvent(ev);
+    }
+
+    /**
+     *  @private
+     */
+    private function updateDimensions(event:TimerEvent):void
+    {
+        if (!prepare)
+        {
+	        //TODO may have to do it for each dimension if they have individual
+    	    // dataProviders (to support star schema?)
+            oldSort = dataProvider.sort;
+            prepare = true;
+            dimIndex = 0;
+            dispatchCubeProgress(dimIndex, dimensions.length,
+            				ResourceManager.getInstance().getString("olap",
+            				"dimensionProcessingMessage", [dimensions.getItemAt(dimIndex).name]));
+            return;
+        }
+
+        if (dimIndex < dimensions.length)
+        {
+            dispatchCubeProgress(dimIndex, dimensions.length,
+            			ResourceManager.getInstance().getString("olap",
+            			"dimensionProcessingMessage", [dimensions.getItemAt(dimIndex).name]));
+            dimensions.getItemAt(dimIndex).refresh();
+            ++dimIndex;
+            return;
+        }
+
+        dispatchCubeProgress(dimIndex, dimensions.length);
+
+        prepare = false;
+        cubeBuildingTimer.stop();
+        cubeBuildingTimer.removeEventListener(TimerEvent.TIMER,  updateDimensions);
+
+        dataProvider.sort = oldSort;
+        oldSort = null;
+
+        dataProvider.refresh();
+
+        if (cubeImpl)
+        {
+            cubeImpl.cube = this;
+            cubeImpl.refresh();
+            cubeBuildingTimer.addEventListener(TimerEvent.TIMER,  buildCube);
+            cubeBuildingTimer.start();
+            progress = 0;
+            total = dataProvider.length;
+        }
+    }
+
+    /**
+    *  @private
+    */
+    private function buildCube(event:TimerEvent):void
+    {
+        //once we have processed all rows cube would be doing a final pass
+        //which takes a longer time. So we skip a loop to provide
+        // a chance for the progress to be shown
+        if (progress == (total + 1))
+        {
+            //TODO use resource bundle
+            dispatchCubeProgress(progress - 1, total,
+            			ResourceManager.getInstance().getString("olap",
+            						"finalizingMessage"));
+            ++progress;
+            return;
+        }
+
+        var startTime:int = getTimer();
+        var timeTaken:int = 0;
+        var cubeBuilt:Boolean;
+
+        // if total time taken for a action is less than 10 ms
+        // call the action function again
+        while (timeTaken < workDuration)
+        {
+            cubeBuilt = cubeImpl.buildCubeIteratively();
+            if (cubeBuilt)
+                break;
+            if (progress > total)
+                dispatchCubeProgress(total, total,
+                		ResourceManager.getInstance().getString("olap",
+            									"finalizingMessage"));
+            else
+                dispatchCubeProgress(progress++, total,
+                			ResourceManager.getInstance().getString("olap",
+                			"progressMessage", [progress, total]));
+
+            timeTaken = getTimer() - startTime;
+        }
+
+        if (cubeBuilt)
+        {
+            dispatchEvent(new CubeEvent(CubeEvent.CUBE_COMPLETE));
+            cubeBuildingTimer.stop();
+            cubeBuildingTimer = null;
+        }
+    }
+
+    /**
+     *  Registers an event listener object with an EventDispatcher object so that the listener
+     *  receives notification of an event.
+     *
+     *  @param type The type of event.
+     *
+     *  @param listener The listener function that processes the event.
+     *
+     *  @param useCapture Determines whether the listener works in the capture phase
+     *  or the target and bubbling phases.
+     *
+     *  @param priority The priority level of the event listener.
+     *
+     *  @param useWeakReference Determines whether the reference to the listener is strong or weak.
+     *  A strong reference (the default) prevents your listener from being garbage-collected.
+     *  A weak reference does not.
+     *
+     *  @see flash.events.EventDispatcher#addEventListener()
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addEventListener(type:String, listener:Function,
+    			useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
+    {
+        ev.addEventListener(type, listener, useCapture, priority, useWeakReference);
+    }
+
+    /**
+     *  Removes a listener.
+     *  If there no matching listener is registered,
+     *  a call to this method has no effect.
+     *
+     *  @param type The type of event.
+     *
+     *  @param listener The listener object to remove.
+     *
+     *  @param useCapture Specifies whether the listener was registered for
+     *  the capture phase or the target and bubbling phases.
+     *
+     *  @see flash.events.EventDispatcher#removeEventListener()
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
+    {
+        ev.removeEventListener(type, listener, useCapture);
+    }
+
+    /**
+     *  Checks whether an event listener is registered with this object or any of its ancestors for the specified event type.
+     *  This method returns true if an event listener is triggered during any phase of the event flow
+     *  when an event of the specified type is dispatched to this object or to any of its descendants.
+     *
+     *  @param type The type of event.
+     *
+     *  @return A value of true if a listener of the
+     *  specified type is triggered; false otherwise.
+     *
+     *  @see flash.events.EventDispatcher#willTrigger()
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function willTrigger(type:String):Boolean
+    {
+        return ev.willTrigger(type);
+    }
+
+    /**
+     *  Dispatches an event into the event flow.
+     *  The event target is the object upon which the dispatchEvent() method is called.
+     *
+     *  @param event The Event object that is dispatched into the event flow.
+     *
+     *  @return A value of true if the event was successfully dispatched.
+     *  A value of false indicates failure or that the
+     *  preventDefault() method was called on the event.
+     *
+     *  @see flash.events.EventDispatcher#dispatchEvent()
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function dispatchEvent(event:Event):Boolean
+    {
+        return ev.dispatchEvent(event);
+    }
+
+    /**
+     *  Checks whether the object has any listeners registered for a specific type of event.
+     *  This lets you determine where an object has altered handling of
+     *  an event type in the event flow hierarchy.
+     *
+     *  @param type The type of event.
+     *
+     *  @return A value of true if a listener of the specified type
+     *  is registered; false otherwise.
+     *
+     *  @see flash.events.EventDispatcher#hasEventListener()
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function hasEventListener(type:String):Boolean
+    {
+        return ev.hasEventListener(type);
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function get cubeImpl():IOLAPCubeImpl
+    {
+        return _cubeImpl;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function set cubeImpl(value:IOLAPCubeImpl):void
+    {
+        _cubeImpl = value;
+        _cubeImpl.cube = this;
+    }
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function execute(query:IOLAPQuery):AsyncToken
+    {
+    	// attempt is being made by the user to execute
+    	// a query which has been already submitted for execution.
+    	if (_queriesPending.indexOf(query) != -1)
+    		return null;
+
+        var token:AsyncToken = new AsyncToken(null);
+
+        _queriesPending.push(query);
+        _queryToken[query] = { tok:token };
+
+        if (!queryTimer)
+        {
+            queryTimer = new Timer(queryBuildingTimeInterval);
+            queryTimer.addEventListener(TimerEvent.TIMER, executeQuery);
+            queryTimer.start();
+        }
+
+        return token;
+    }
+
+    /**
+     * @private
+     *
+     * Query validation functions should be moved to a interface/class whcih can be implemented/extended.
+     */
+    private function getAxisHierarchies(axis:IOLAPQueryAxis):Array
+    {
+        var axisHierarchies:Array = [];
+        var sets:Array = axis.sets;
+        var n:int = sets.length;
+        for (var i:int = 0; i < n; ++i)
+        {
+            var tempSet:OLAPSet = sets[i];
+            var tuples:Array = tempSet.tuples;
+            var m:int = tuples.length;
+            for (var j:int = 0; j < m; ++j)
+            {
+                var tempTuple:OLAPTuple = tuples[j];
+                var list:IList = tempTuple.explicitMembers;
+                var l:int = list.length;
+                for (var k:int = 0; k < l; ++k)
+                {
+                    var tempHeirarchy:OLAPHierarchy = list.getItemAt(k).hierarchy as OLAPHierarchy;
+                    if (tempHeirarchy)
+                        axisHierarchies.push(tempHeirarchy);
+                }
+            }
+        }
+
+        return axisHierarchies;
+    }
+
+    /**
+     * @private
+     *
+     */
+    private function findDuplicateHierarchies(axisHierarchies1:Array, axisHierarchies2:Array):OLAPHierarchy
+    {
+        //TODO is it possible that same hierarchy is represented by different object?
+        // then we need to change this find logic
+        for each (var h:OLAPHierarchy in axisHierarchies1)
+        {
+            var foundIndex:int = axisHierarchies2.indexOf(h);
+            if (foundIndex > -1)
+                return h;
+        }
+
+        return null;
+    }
+
+    /**
+     * @private
+     *
+     */
+    private function validateQuery(q:IOLAPQuery):void
+    {
+        //check usage of same hierarchy on different axis.
+        var axes:Array = OLAPQuery(q).axes;
+
+        var n:int = axes.length;
+        for (var i:int = 0; i < n; ++i)
+        {
+            var queryAxis:OLAPQueryAxis = axes[i];
+
+            if (queryAxis.axisOrdinal != OLAPQuery.SLICER_AXIS)
+                checkZeroLengthAxis(queryAxis, queryAxis.axisOrdinal);
+
+            var axisHierarchies1:Array = getAxisHierarchies(queryAxis);
+            var m:int = axes.length;
+            for (var j:int = i + 1; j < m; ++j)
+            {
+                var axisHierarchies2:Array = getAxisHierarchies(axes[j]);
+                var dup:OLAPHierarchy = findDuplicateHierarchies(axisHierarchies1, axisHierarchies2);
+                if (dup)
+                {
+                    var message:String = ResourceManager.getInstance().getString(
+                        "olap", "duplicateHierarchyOnAxes", [dup.name, i ,j]);
+                    throw new QueryError(message);
+                }
+            }
+        }
+    }
+
+    /**
+     * @private
+     * Checks if the axis has no tuples
+     */
+    private function checkZeroLengthAxis(queryAxis:IOLAPQueryAxis, index:int):void
+    {
+    	if (queryAxis.tuples.length == 0)
+    	{
+                var message:String = ResourceManager.getInstance().getString(
+                    "olap", "zeroElementsOnAxis", [index]);
+                throw new QueryError(message);
+    	}
+    }
+
+    /**
+     *  @private
+     *  The query execution callback function.
+     */
+    private function executeQuery(event:TimerEvent):void
+    {
+        var holder:Object = _queryToken[_queriesPending[0]];
+        var token:AsyncToken = holder.tok;
+        if (token.hasResponder())
+        {
+            var responder:IResponder;
+            var result:OLAPResult;
+            var q:IOLAPQuery = _queriesPending[0];
+            var deleteEntry:Boolean = true;
+
+            try
+            {
+                if (!holder.hasOwnProperty("result"))
+                {
+                    validateQuery(q);
+                    holder["result"] = result = new resultClass;
+                }
+                else
+                {
+                    result = holder.result;
+                }
+
+                if (!_cubeImpl.execute(q, result))
+                {
+                    deleteEntry = false;
+                    return;
+                }
+            }
+            catch(qe:QueryError)
+            {
+                for each (responder in token.responders)
+                {
+                    responder.fault(qe.message);
+                }
+                result = null;
+            }
+            catch (e:Error)
+            {
+                for each (responder in token.responders)
+                {
+                    responder.fault(e.message);
+                }
+                result = null;
+            }
+            finally
+            {
+                if (deleteEntry)
+                {
+                    _queriesPending.splice(0, 1);
+                    delete _queryToken[q];
+                    if (_queriesPending.length == 0)
+                    {
+                        queryTimer.stop();
+                        queryTimer = null;
+                    }
+               }
+            }
+
+            if (result)
+            {
+                for each (responder in token.responders)
+                {
+                    responder.result(result);
+                }
+            }
+        }
+    }
+
+    /**
+     *  @private
+     *  Returns true if the tuple addresses a valid cell in the cube.
+     *  If the members of the tuple form a invalid combination returns false.
+     *
+     *  @param tuple the tuple whose validity is to be checked.
+     */
+    mx_internal function isTupleValid(tuple:OLAPTuple):Boolean
+    {
+        return DefaultCubeImpl(cubeImpl).isTupleValid(tuple);
+    }
+
+    /**
+     *  Returns the name of the cube
+     *
+     *  @return The name of the cube.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function toString():String
+    {
+        return name;
+    }
+}
+
+}


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

--- frameworks/projects/automation_air/src/mx/core/Version.as
+++ frameworks/projects/automation_air/src/mx/core/Version.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.
-//
-////////////////////////////////////////////////////////////////////////////////

 import mx.core.mx_internal;


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

--- frameworks/projects/rpc/src/mx/rpc/xml/SchemaConstants.as
+++ frameworks/projects/rpc/src/mx/rpc/xml/SchemaConstants.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2006-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.rpc.xml
 {


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

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

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

QE: Yes!
Reviewer: Chet, Gordon, Jason

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

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

--- frameworks/projects/spark/src/spark/components/Spinner.as
+++ frameworks/projects/spark/src/spark/components/Spinner.as
@@ -16,6 +16,7 @@
 import flash.events.KeyboardEvent;
 import flash.events.MouseEvent;
 import flash.ui.Keyboard;
+
 import mx.events.FlexEvent;
 import mx.managers.IFocusManagerComponent;

@@ -31,7 +32,7 @@
  *  A Spinner is used to select a value from an
  *  ordered set. It uses two buttons that increase or
  *  decrease the current value based on the current
- *  step size.
+ *  stepSize.
  *
  *
This control extends the Range class and
  *  is the base class for controls that select a value
@@ -41,10 +42,11 @@
  *  one to increase the value and one to decrease the
  *  value.

  *
- *
Spinner has the addition property of valueWrap
- *  which enables value wrapping.

+ *
Spinner has the addition property of
+ *  valueWrap which enables value wrapping.

  *
  *  @see flex.component.Range
+ *  @see flex.component.NumericStepper
  */
 public class Spinner extends Range implements IFocusManagerComponent
 {
@@ -71,20 +73,22 @@
     //--------------------------------------------------------------------------

     [SkinPart]
-    /**
-     *  incrButton is a SkinPart that defines a button that, when
-     *  pressed, will cause the value to increment to the next value (based on
-     *  the step size).
-     */
-    public var incrButton:Button;
+
+    /**
+     *  incrementButton is a SkinPart that defines
+     *  a button that, when pressed, will cause value
+     *  to increment by stepSize.
+     */
+    public var incrementButton:Button;

     [SkinPart]
-    /**
-     *  decrButton is a SkinPart that defines a button that, when
-     *  pressed, will cause the value to decrement to the previous value (based
-     *  on the step size).
-     */
-    public var decrButton:Button;
+
+    /**
+     *  decrementButton is a SkinPart that defines
+     *  a button that, when pressed, will cause value
+     *  to decrement by stepSize.
+     */
+    public var decrementButton:Button;

     //--------------------------------------------------------------------------
     //
@@ -97,10 +101,8 @@
     //----------------------------------

     /**
-     *  Enable/disable this component. This also enables/disables
-     *  any of the skin parts for this component.
-     *
-     *  @default true
+     *  Enable/disable this component. This also enables/disables any of the
+     *  skin parts for this component.
      */
     override public function set enabled(value:Boolean):void
     {
@@ -108,54 +110,28 @@
         enableSkinParts(value);
     }

-    //----------------------------------
-    //  stepSize
-    //----------------------------------
-
-    private var stepSizeChanged:Boolean = false;
-
-    /**
-     *  The stepSize property determines the allowed values of
-     *  the Spinner. See nearestValidValue() for a complete
-     *  description of the allowed values. Also, a stepSize of
-     *  less than 0 is not supported.
-     *
-     *  @default 1
-     */
-    override public function set stepSize(value:Number):void
-    {
-        if (stepSize == value)
-            return;
-
-        super.stepSize = value;
-        stepSizeChanged = true;
-
-        invalidateProperties()
-    }
-
     //--------------------------------------------------------------------------
     //
     // Properties
     //
     //--------------------------------------------------------------------------
-
+
     //----------------------------------
     //  valueWrap
     //----------------------------------

     /**
      *  @private
-     *  Internal storage for the valueWrap property.
      */
     private var _valueWrap:Boolean = false;

     /**
-     *  Value wrapping determines the behavior of stepping beyond
-     *  the maximum or minimum value. If the valueWrap property
-     *  is set when stepping beyond an extreme, it will set the value
-     *  to the opposite extreme instead of not changing the value.
+     *  valueWrap determines the behavior of stepping
+     *  beyond the maximum or minimum value. If
+     *  valueWrap is true when stepping beyond an
+     *  extreme, it will set value to the opposite
+     *  extreme.
      *
-     *  @return Returns whether this Spinner allows value wrapping.
      *  @default false
      */
     public function get valueWrap():Boolean
@@ -163,9 +139,6 @@
         return _valueWrap;
     }

-    /**
-     *  Sets whether this Spinner allows value wrapping.
-     */
     public function set valueWrap(value:Boolean):void
     {
         _valueWrap = value;
@@ -180,61 +153,39 @@
     /**
      *  @private
      */
-    override protected function commitProperties():void
-    {
-        super.commitProperties();
-
-        // Changing the stepSize affects the value
-        if (stepSizeChanged)
-        {
-            var temp:Number = value;
-            setValue(nearestValidValue(value));
-
-            if (value != temp)
-                dispatchEvent(new Event(FlexEvent.VALUE_COMMIT));
-            stepSizeChanged = false;
-        }
-    }
-
-    /**
-     *  Called when either button is added. It adds the button's
-     *  event handlers and also enables the buttons using
-     *  enableSkinParts().
-     */
     override protected function partAdded(partName:String, instance:*):void
     {
-        // TODO: autoRepeat as a property?
-        if (instance == incrButton)
-        {
-            incrButton.addEventListener(FlexEvent.BUTTON_DOWN,
-                                        incrButton_buttonDownHandler);
-            incrButton.autoRepeat = true;
-        }
-        else if (instance == decrButton)
-        {
-            decrButton.addEventListener(FlexEvent.BUTTON_DOWN,
-                                        decrButton_buttonDownHandler);
-            decrButton.autoRepeat = true;
+        // TODO: autoRepeat as a property on Spinner?
+        if (instance == incrementButton)
+        {
+            incrementButton.addEventListener(FlexEvent.BUTTON_DOWN,
+                                        incrementButton_buttonDownHandler);
+            incrementButton.autoRepeat = true;
+        }
+        else if (instance == decrementButton)
+        {
+            decrementButton.addEventListener(FlexEvent.BUTTON_DOWN,
+                                        decrementButton_buttonDownHandler);
+            decrementButton.autoRepeat = true;
         }

         enableSkinParts(enabled);
     }

     /**
-     *  Called when either button is removed. partRemoved
-     *  removes the event handlers.
+     *  @private
      */
     override protected function partRemoved(partName:String, instance:*):void
     {
-        if (instance == incrButton)
-        {
-            incrButton.removeEventListener(FlexEvent.BUTTON_DOWN,
-                                           incrButton_buttonDownHandler);
-        }
-        else if (instance == decrButton)
-        {
-            decrButton.removeEventListener(FlexEvent.BUTTON_DOWN,
-                                           decrButton_buttonDownHandler);
+        if (instance == incrementButton)
+        {
+            incrementButton.removeEventListener(FlexEvent.BUTTON_DOWN,
+                                           incrementButton_buttonDownHandler);
+        }
+        else if (instance == decrementButton)
+        {
+            decrementButton.removeEventListener(FlexEvent.BUTTON_DOWN,
+                                           decrementButton_buttonDownHandler);
         }
     }

@@ -243,54 +194,16 @@
      */
     protected function enableSkinParts(value:Boolean):void
     {
-        if (incrButton)
-            incrButton.enabled = value;
-        if (decrButton)
-            decrButton.enabled = value;
-    }
-
-    /**
-     *  Returns the nearest valid value. This is determined by
-     *  stepSize. The allowed values are multiples of stepSize
-     *  away from 0 and restricted to between the maximum and
-     *  minimum. However, maximum and minimum are included in the
-     *  allowed values even if the distance between of the extremes
-     *  and the next or previous allowed value is less
-     *  than stepSize.
-     */
-    override protected function nearestValidValue(value:Number):Number
-    {
-        if (isNaN(value))
-            value = 0;
-
-        if (stepSize == 0)
-            return value;
-
-        // Find the closest multiple of stepSize
-        var closest:Number = Math.round(value / stepSize) * stepSize;
-        if (closest >= maximum)
-            return maximum;
-        else if (closest <= minimum)
-            return minimum;
-
-        // Round to the closest value (closest multiple, min, or max).
-        var cdiff:Number = Math.abs(closest - value);
-        var mindiff:Number = Math.abs(minimum - value);
-        var maxdiff:Number = Math.abs(maximum - value);
-        var min:Number = Math.min(cdiff, mindiff, maxdiff);
-
-        // Return order maintains rounding up when in the middle.
-        if (min == maxdiff)
-            return maximum;
-        else if (min == cdiff)
-            return closest;
-        else
-            return minimum;
-    }
-
-    /**
-     *  Steps value up if increase is true
-     *  and down if false. trigger is passed to commitValue.
+        if (incrementButton)
+            incrementButton.enabled = value;
+        if (decrementButton)
+            decrementButton.enabled = value;
+    }
+
+    /**
+     *  @private
+     *  Adds complex behavior to step in order to adhere to
+     *  multiples of stepSize (including maximum and minimum).
      */
     override public function step(increase:Boolean = true):void
     {
@@ -315,7 +228,7 @@
             }
             else
             {
-                setValue(nearestValidValue(value + stepSize));
+                setValue(nearestValidValue(value + stepSize, stepSize));
             }
         }
         else
@@ -336,7 +249,7 @@
             }
             else
             {
-                setValue(nearestValidValue(value - stepSize));
+                setValue(nearestValidValue(value - stepSize, stepSize));
             }
         }
     }
@@ -352,32 +265,37 @@
     //---------------------------------

     /**
-     *  Handle a click on the incrButton. This should step to the next value.
-     */
-    protected function incrButton_buttonDownHandler(event:Event):void
+     *  Handle a click on the incrementButton. This should
+     *  increment value by stepSize.
+     */
+    protected function incrementButton_buttonDownHandler(event:Event):void
     {
         var prevValue:Number = this.value;
+
         step(true);
+
         if (value != prevValue)
             dispatchEvent(new Event("change"));
     }

     /**
-     *  Handle a click on the decrButton. This should step to the previous
-     *  value.
-     */
-    protected function decrButton_buttonDownHandler(event:Event):void
+     *  Handle a click on the decrementButton. This should
+     *  decrement value by stepSize.
+     */
+    protected function decrementButton_buttonDownHandler(event:Event):void
     {
         var prevValue:Number = this.value;
+
         step(false);
+
         if (value != prevValue)
             dispatchEvent(new Event("change"));
     }

     /**
-     *  Handles keyboard input. Right and up arrows increment. Left and down
-     *  arrows decrement. Home and end set the value to maximum and minimum
-     *  respectively.
+     *  Handles keyboard input. Up arrow increments. Down arrow
+     *  decrements. Home and End keys set the value to maximum
+     *  and minimum respectively.
      */
     override protected function keyDownHandler(event:KeyboardEvent):void
     {
@@ -386,14 +304,14 @@
         switch (event.keyCode)
         {
             case Keyboard.DOWN:
-            case Keyboard.LEFT:
+            //case Keyboard.LEFT:
             {
                 step(false);
                 break;
             }

             case Keyboard.UP:
-            case Keyboard.RIGHT:
+            //case Keyboard.RIGHT:
             {
                 step(true);
                 break;
@@ -420,8 +338,9 @@

         if (value != prevValue)
             dispatchEvent(new Event("change"));
-    }
-
+
+        event.stopImmediatePropagation();
+    }
 }

-}
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 20149
Author:   klin@adobe.com
Date:     2011-02-04T21:39:31.000080Z

Log Message:
-----------
Add and update [Inspectable] metadata across spark components.

QE notes: No
Doc notes: No
Bugs: SDK-28942
Reviewer: Carol
Tests run: cyclone server, checkintests
Is noteworthy for integration: Yes

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/HGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/NumericStepper.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ScrollBarBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/ComboBox.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/SkinnableContainer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/TileGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Button.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/List.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Spinner.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/DataGrid.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/VGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Image.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Grid.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.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/supportClasses/Range.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/DropDownList.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/TrackBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Panel.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/modules/ModuleLoader.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/ButtonBar.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/mediaClasses/DynamicStreamingVideoItem.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ToggleButtonBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/SkinnableDataContainer.as</path>

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

--- frameworks/projects/spark/src/spark/components/Spinner.as
+++ frameworks/projects/spark/src/spark/components/Spinner.as
@@ -319,6 +319,8 @@
      */
     private var _allowValueWrap:Boolean = false;

+    [Inspectable(category="General", defaultValue="false")]
+
     /**
      *  Determines the behavior of the control for a step when the current
      *  value is either the maximum


add rect to swc

add rect to swc

--- frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -132,6 +132,7 @@
     import org.apache.flex.core.DropType; DropType;
     import org.apache.flex.core.DataBindingBase; DataBindingBase;
     import org.apache.flex.effects.PlatformWiper; PlatformWiper;
+    import org.apache.flex.geom.Rectangle; Rectangle;

 	import mx.core.ClassFactory; ClassFactory;
     import mx.states.AddItems; AddItems;


Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

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

--- frameworks/projects/rpc/src/mx/messaging/FlexClient.as
+++ frameworks/projects/rpc/src/mx/messaging/FlexClient.as
@@ -0,0 +1,172 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 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
+{
+
+import flash.events.EventDispatcher;
+
+import mx.core.mx_internal;
+import mx.events.PropertyChangeEvent;
+
+use namespace mx_internal;
+
+/**
+ *  Dispatched when a property of the FlexClient singleton changes.
+ *  Listeners must be added via FlexClient.getInstance().addEventListener(...).
+ *
+ *  @eventType mx.events.PropertyChangeEvent.PROPERTY_CHANGE
+ */
+[Event(name="propertyChange", type="mx.events.PropertyChangeEvent")]
+
+/**
+ *  Singleton class that stores the global Id for this Player instance that is
+ *  server assigned when the client makes its initial connection to the server.
+ */
+public class FlexClient extends EventDispatcher
+{
+    //--------------------------------------------------------------------------
+	//
+	//  Class constants
+	//
+	//--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  This value is passed to the server in an initial client connect to
+     *  indicate that the client needs a server-assigned FlexClient Id.
+     */
+    mx_internal static const NULL_FLEXCLIENT_ID:String = "nil";
+
+    //--------------------------------------------------------------------------
+	//
+	//  Class variables
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 *  The sole instance of this singleton class.
+     */
+	private static var _instance:FlexClient;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Returns the sole instance of this singleton class,
+	 *  creating it if it does not already exist.
+     */
+	public static function getInstance():FlexClient
+	{
+		if (_instance == null)
+			_instance = new FlexClient();
+
+		return _instance;
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 *  Constructor.
+	 */
+	public function FlexClient()
+	{
+		super();
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  id
+	//----------------------------------
+
+	/**
+	 *  @private
+     *  Storage for the global FlexClient Id for the Player instance.
+     *  This value is server assigned and is set as part of the Channel connect process.
+     */
+    private var _id:String;
+
+    [Bindable(event="propertyChange")]
+    /**
+     *  The global FlexClient Id for this Player instance.
+     *  This value is server assigned and is set as part of the Channel connect process.
+     *  Once set, it will not change for the duration of the Player instance's lifespan.
+     *  If no Channel has connected to a server this value is null.
+     */
+    public function get id():String
+    {
+        return _id;
+    }
+
+	/**
+	 *  @private
+	 */
+    public function set id(value:String):void
+    {
+        if (_id != value)
+        {
+            var event:PropertyChangeEvent = PropertyChangeEvent.createUpdateEvent(this, "id", _id, value);
+            _id = value;
+            dispatchEvent(event);
+        }
+    }
+
+	//----------------------------------
+	//  waitForFlexClientId
+	//----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _waitForFlexClientId:Boolean = false; // Initialize to false so the first Channel that checks this can attempt to connect.
+
+    [Bindable(event="propertyChange")]
+    /**
+     *  @private
+     *  Guard condition that Channel instances use to coordinate their connect attempts during application startup
+     *  when a FlexClient Id has not yet been returned by the server.
+     *  The initial Channel connect process must be serialized.
+     *  Once a FlexClient Id is set further Channel connects and disconnects do not require synchronization.
+     */
+    mx_internal function get waitForFlexClientId():Boolean
+    {
+        return _waitForFlexClientId;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function set waitForFlexClientId(value:Boolean):void
+    {
+        if (_waitForFlexClientId != value)
+        {
+            var event:PropertyChangeEvent = PropertyChangeEvent.createUpdateEvent(this, "waitForFlexClientId", _waitForFlexClientId, value);
+            _waitForFlexClientId = value;
+            dispatchEvent(event);
+        }
+    }
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 2464
Author:   jimurphy@adobe.com
Date:     2008-07-14T19:50:33.449468Z

Log Message:
-----------
add flex 4 to trunk

Modified Paths:
--------------
134 paths were modified

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

--- frameworks/projects/spark/src/spark/components/List.as
+++ frameworks/projects/spark/src/spark/components/List.as
@@ -0,0 +1,380 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 flex.component
+{
+import flash.display.DisplayObject;
+import flash.events.MouseEvent;
+
+import flex.events.ItemExistenceChangedEvent;
+import flex.skin.DefaultItemRenderer;
+
+import mx.core.ClassFactory;
+import mx.core.IFactory;
+
+/**
+ *  The List class.
+ */
+public class List extends Selector
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constants
+    //
+    //--------------------------------------------------------------------------
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function List()
+    {
+        super();
+        itemRenderer = new ClassFactory(DefaultItemRenderer);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Flag that determines if the items in a list are rendered directly or
+     *  wrapped by an item renderer.
+     *
+     *
For example, a list may contain Image components. In this case, you want
+     *  the images to be wrapped by the item renderer so highlighting and
+     *  selection works correctly. Another list may have ToggleButtons as items.
+     *  In this case, the buttons themselves are the renderers, and do not
+     *  need to be wrapped.

+     *
+     *  @default false
+     */
+    public var itemsAreRenderers:Boolean = false;
+
+    /**
+     *  Flag that determines if the list supports multiple selection.
+     *
+     *  TODO: description of how single selection properties
+     *  work when multiple selection is enabled. multiple selection
+     *  doesn't support selectionChanging event. etc.
+     *
+     *  @default false
+     */
+    public var allowMultipleSelection:Boolean = false;
+
+    //----------------------------------
+    //  selectedIndex
+    //----------------------------------
+
+   /**
+     *  The 0-based index of the selected item, or -1 if no item is selected.
+     *  Setting the selectedIndex property de-selects the currently selected
+     *  item and selects the item at the specified index.
+     *
+     *  The value of selectedIndex is always pinned between -1 and
+     *  (numItems - 1). If items at a lower index than selectedIndex are
+     *  removed from the component, the selected index is adjusted downward
+     *  accordingly.
+     *
+     *  When the value of the allowMultipleSelection property
+     *  is true, the getter returns the first selected item.
+     *
+     *  @default -1
+     */
+
+    [Bindable("selectionChanged")]
+    override public function get selectedIndex():int
+    {
+        if (!allowMultipleSelection)
+            return super.selectedIndex;
+
+        if (_selectedIndices && _selectedIndices.length > 0)
+            return _selectedIndices[0];
+
+        return NO_SELECTION;
+    }
+
+    override public function set selectedIndex(value:int):void
+    {
+        if (!allowMultipleSelection)
+        {
+            super.selectedIndex = value;
+            return;
+        }
+
+        selectedIndices = [value];
+        invalidateProperties();
+    }
+
+
+    /**
+     *  @private
+     *  Internal storage for the selectedIndices property and invalidation variables.
+     */
+    private var _selectedIndices:Array;
+    private var _proposedSelectedIndices:Array;
+    private var multipleSelectionChanged:Boolean = false;
+
+    /**
+     *  Selected indices for this component.
+     *
+     *  TODO: describe
+     *
+     *  @default null
+     */
+    [Bindable("selectionChanged")]
+    public function get selectedIndices():Array
+    {
+        if (!allowMultipleSelection)
+            return null;
+
+        return _selectedIndices;
+    }
+
+    public function set selectedIndices(value:Array):void
+    {
+        if (!allowMultipleSelection)
+            return;
+
+        // ?? should we check to see if the selection changed?
+
+        multipleSelectionChanged = true;
+        _proposedSelectedIndices = value;
+        invalidateProperties();
+    }
+
+    /**
+     *  Selected items for this component.
+     *
+     *  TODO: describe
+     *
+     *  @default null
+     */
+    [Bindable("selectionChanged")]
+    public function get selectedItems():Array
+    {
+        var result:Array;
+
+        if (selectedIndices)
+        {
+            result = [];
+
+            var count:int = selectedIndices.length;
+
+            for (var i:int = 0; i < count; i++)
+                result[i] = getItemAt(selectedIndices[i]);
+        }
+
+        return result;
+    }
+
+    public function set selectedItems(value:Array):void
+    {
+        var indices:Array;
+
+        if (value)
+        {
+            indices = [];
+
+            var count:int = value.length;
+
+            for (var i:int = 0; i < count; i++)
+                indices[i] = getItemIndex(value[i]);
+        }
+
+        selectedIndices = value;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function commitProperties():void
+    {
+        super.commitProperties();
+
+        if (multipleSelectionChanged)
+        {
+            multipleSelectionChanged = false;
+            commitMultipleSelection();
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override protected function itemSelected(item:Object, selected:Boolean):void
+    {
+        var item:* = contentGroup.getItemSkin(item);
+
+        if (item)
+            item.selected = selected;
+    }
+
+    /**
+     *  Called when a skin part has been added or assigned.
+     *  This method sets the "alwaysUseItemRenderer" flag on the
+     *  contentGroup part.
+     */
+    override protected function partAdded(partName:String, instance:*):void
+    {
+        super.partAdded(partName, instance);
+
+        if (instance == contentGroup && !itemsAreRenderers)
+            contentGroup.alwaysUseItemRenderer = true;
+    }
+
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    //--------------------------------------------------------------------------
+    //
+    //  Private Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Returns true if a is null or an empty array.
+     */
+    private function isEmpty(a:Array):Boolean
+    {
+        return a == null || a.length == 0;
+    }
+
+    /**
+     *  @private
+     */
+    private function commitMultipleSelection():void
+    {
+        var removedItems:Array = [];
+        var addedItems:Array = [];
+        var i:int;
+        var count:int;
+
+        if (!isEmpty(_selectedIndices) && !isEmpty(_proposedSelectedIndices))
+        {
+            // Changing selection, determine which items were added
+            count = _proposedSelectedIndices.length;
+            for (i = 0; i < count; i++)
+            {
+                if (_selectedIndices.indexOf(_proposedSelectedIndices[i]) < 0)
+                    addedItems.push(_proposedSelectedIndices[i]);
+            }
+
+            // determine which items were removed
+            for (i = 0; i < count; i++)
+            {
+                if (_proposedSelectedIndices.indexOf(_selectedIndices[i]) < 0)
+                    removedItems.push(_selectedIndices[i]);
+            }
+        }
+        else if (!isEmpty(_selectedIndices))
+        {
+            // Going to a null selection, remove all
+            removedItems = _selectedIndices;
+        }
+        else if (!isEmpty(_proposedSelectedIndices))
+        {
+            // Going from a null selection, add all
+            addedItems = _proposedSelectedIndices;
+        }
+
+        // Commit
+        _selectedIndices = _proposedSelectedIndices;
+        _proposedSelectedIndices = null;
+
+        // un-select the old
+        if (removedItems.length > 0)
+        {
+            count = removedItems.length;
+            for (i = 0; i < count; i++)
+            {
+                itemSelected(getItemAt(removedItems[i]), false);
+            }
+        }
+
+        // select the new
+        if (addedItems.length > 0)
+        {
+            count = addedItems.length;
+            for (i = 0; i < count; i++)
+            {
+                itemSelected(getItemAt(addedItems[i]), true);
+            }
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event Handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Called when an item has been added to this component.
+     */
+    override protected function itemAddedHandler(event:ItemExistenceChangedEvent):void
+    {
+        super.itemAddedHandler(event);
+
+        var skin:* = contentGroup.getItemSkin(event.relatedObject);
+
+        if (skin)
+            skin.addEventListener("click", item_clickHandler);
+    }
+
+    /**
+     *  @private
+     *  Called when an item has been removed from this component.
+     */
+    override protected function itemRemovedHandler(event:ItemExistenceChangedEvent):void
+    {
+        super.itemRemovedHandler(event);
+
+        var skin:* = contentGroup.getItemSkin(event.relatedObject);
+
+        if (skin)
+            skin.removeEventListener("click", item_clickHandler);
+    }
+
+    /**
+     *  @private
+     *  Called when an item is clicked.
+     */
+    private function item_clickHandler(event:MouseEvent):void
+    {
+        // Multiple selection needs to be added here....
+
+        selectedItem = contentGroup.getSkinItem(DisplayObject(event.currentTarget));
+    }
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 6201
Author:   dsubrama@adobe.com
Date:     2009-04-22T21:15:50.846343Z

Log Message:
-----------
Introduces a new method to the IItemRendererOwner contract, updateRendererInformation(), which handles the setting of a renderer's data and data-dependant properties.

We also now support the CollectionEvent of kind UPDATE in DataGroup.

Checkintests: Pass
Reviewer: Ryan

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/IItemRendererOwner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/ButtonBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableDataContainer.as</path>

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

--- frameworks/projects/spark/src/spark/components/List.as
+++ frameworks/projects/spark/src/spark/components/List.as
@@ -514,15 +514,12 @@
     private function dataGroup_rendererAddHandler(event:RendererExistenceEvent):void
     {
         var index:int = event.index;
-        var renderer:Object = event.renderer;
+        var renderer:IVisualElement = event.renderer;

         if (renderer)
         {
         	renderer.addEventListener("click", item_clickHandler);
-        	if (renderer is IVisualElement)
-        		IVisualElement(renderer).owner = this;
-            if (renderer is IItemRenderer)
-                IItemRenderer(renderer).labelText = itemToLabel(renderer.data);
+            updateRendererInformation(IVisualElement(renderer));
         }

         if (isItemIndexSelected(index))


Transferred from the Adobe Open Source Subversion Repository

Revision: 8459
Author:   clucier@adobe.com
Date:     2009-07-08T19:39:23.905302Z

Log Message:
-----------
Fixing current point after CloseSegment command in Path sequences.  Also fixing up cubic and quadratic smooth/shorthand logic (t/s) when preceding command is not a curve command).
Bugs: SDK-21866, SDK-21862, SDK-21607
Reviewer: Jason, Peter F.
QE Notes: None
Doc Notes: None

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

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

--- frameworks/projects/spark/src/spark/primitives/Path.as
+++ frameworks/projects/spark/src/spark/primitives/Path.as
@@ -14,22 +14,21 @@

 import flash.display.Graphics;
 import flash.display.GraphicsPath;
-import flash.display.LineScaleMode;
 import flash.display.Shape;
 import flash.geom.Matrix;
 import flash.geom.Point;
 import flash.geom.Rectangle;

+import mx.core.mx_internal;
 import mx.utils.MatrixUtil;
-import mx.core.mx_internal;
-import spark.primitives.pathSegments.LineSegment;
-import spark.primitives.supportClasses.FilledElement;
+
 import spark.primitives.pathSegments.CloseSegment;
 import spark.primitives.pathSegments.CubicBezierSegment;
+import spark.primitives.pathSegments.LineSegment;
 import spark.primitives.pathSegments.MoveSegment;
 import spark.primitives.pathSegments.PathSegment;
 import spark.primitives.pathSegments.QuadraticBezierSegment;
-
+import spark.primitives.supportClasses.FilledElement;

 use namespace mx_internal;
@@ -238,8 +237,11 @@
         var newSegments:Array = [];

         var identifier:String;
+        var prevIdentifier:String;
         var prevX:Number = 0;
         var prevY:Number = 0;
+        var lastMoveX:Number = 0;
+        var lastMoveY:Number = 0;
         var x:Number;
         var y:Number;
         var controlX:Number;
@@ -273,6 +275,8 @@
                     x = getNumber(useRelative, i++, prevX);
                     y = getNumber(useRelative, i++, prevY);
                     newSegments.push(new MoveSegment(x, y));
+                    lastMoveX = x;
+                    lastMoveY = y;
                     break;

                 case "l":
@@ -303,8 +307,17 @@

                 case "t":
                     // control is a reflection of the previous control point
-                    controlX = prevX + (prevX - controlX);
-                    controlY = prevY + (prevY - controlY);
+                    if (prevIdentifier == "t" || prevIdentifier == "q")
+                    {
+                        controlX = prevX + (prevX - controlX);
+                        controlY = prevY + (prevY - controlY);
+                    }
+                    else
+                    {
+                        controlX = prevX;
+                        controlY = prevY;
+                    }
+
                     x = getNumber(useRelative, i++, prevX);
                     y = getNumber(useRelative, i++, prevY);
                     newSegments.push(new QuadraticBezierSegment(controlX, controlY, x, y));
@@ -323,8 +336,16 @@

                 case "s":
                     // Control1 is a reflection of the previous control2 point
-                    controlX = prevX + (prevX - control2X);
-                    controlY = prevY + (prevY - control2Y);
+                    if (prevIdentifier == "s" || prevIdentifier == "c")
+                    {
+                        controlX = prevX + (prevX - control2X);
+                        controlY = prevY + (prevY - control2Y);
+                    }
+                    else
+                    {
+                        controlX = prevX;
+                        controlY = prevY;
+                    }

                     control2X = getNumber(useRelative, i++, prevX);
                     control2Y = getNumber(useRelative, i++, prevY);
@@ -335,6 +356,8 @@
                     break;
                 case "z":
                     newSegments.push(new CloseSegment());
+                    x = lastMoveX;
+                    y = lastMoveY;
                     break;

                 default:
@@ -345,6 +368,7 @@

             prevX = x;
             prevY = y;
+            prevIdentifier = identifier.toLowerCase();
         }

         segments = newSegments;
@@ -553,22 +577,23 @@
         var sx:Number = naturalBounds.width == 0 ? 1 : width / naturalBounds.width;
         var sy:Number = naturalBounds.height == 0 ? 1 : height / naturalBounds.height;

-        var currentSubPathStartIndex:int = 0;
         var prevSegment:PathSegment;
         var pathBBox:Rectangle;
+        var lastMoveX:Number = 0;
+        var lastMoveY:Number = 0;

         for (var i:int = 0; i < segments.length; i++)
         {
             var segment:PathSegment = segments[i];

-            if (segment is CloseSegment)
+            if (segment is MoveSegment)
+            {
+                lastMoveX = segment.x;
+                lastMoveY = segment.y;
+            }
+            else if (segment is CloseSegment)
             {
-                if (segments[currentSubPathStartIndex] is MoveSegment)
-                    segment = new LineSegment(segments[currentSubPathStartIndex].x, segments[currentSubPathStartIndex].y);
-                else
-                    segment = new LineSegment();
-
-                currentSubPathStartIndex = i+1;
+                segment = new LineSegment(lastMoveX, lastMoveY);
             }

             pathBBox = segment.getBoundingBox(prevSegment, sx, sy, m, pathBBox);
@@ -825,27 +850,27 @@
         graphicsPath.commands = null;
         graphicsPath.data = null;

-
         // Always start by moving to drawX, drawY. Otherwise
         // the path will begin at the previous pen location
         // if it does not start with a MoveSegment.
         graphicsPath.moveTo(tx, ty);
-        var currentSubPathStartIndex:int = 0;
+        var lastMoveX:Number = tx;
+        var lastMoveY:Number = ty;

         for (var i:int = 0; i < segments.length; i++)
         {
             var segment:PathSegment = segments[i];

             segment.draw(graphicsPath, tx,ty,sx,sy, (i > 0 ? segments[i - 1] : null));
-
-            if (segment is CloseSegment)
+
+            if (segment is MoveSegment)
+            {
+                lastMoveX = segment.x;
+                lastMoveY = segment.y;
+            }
+            else if (segment is CloseSegment)
             {
-                if (segments[currentSubPathStartIndex] is MoveSegment)
-                    graphicsPath.lineTo(tx + segments[currentSubPathStartIndex].x*sx, ty + segments[currentSubPathStartIndex].y*sy);
-                else
-                    graphicsPath.lineTo(tx, ty);
-
-                currentSubPathStartIndex = i+1;
+                graphicsPath.lineTo(tx + lastMoveX * sx, ty + lastMoveY * sy);
             }
         }
     }


Removed whitespace

Removed whitespace

--- test/laml/layout/FlowLayoutTest.as
+++ test/laml/layout/FlowLayoutTest.as
@@ -2,6 +2,7 @@

 	import laml.LAMLTestCase;
 	import laml.display.Component;
+	import laml.display.ComponentMock;
 	import laml.display.Layoutable;
 	import laml.xml.LAMLParser;

@@ -19,7 +20,7 @@
 			parser = new LAMLParser();

 			component = new Component();
-			component.backgroundColor = 0xFFCC00;
+			component.backgroundColor = 0x666666;
 			component.width = 640;
 			component.height = 480;
 			component.padding = 10;
@@ -202,5 +203,28 @@
 			child = box.getChildAt(2);
 			assertRectangle(child, 5, 165, 200, 25);
 		}
+
+
+		public function testNestedChildrenCallCount():void {
+			var xml:XML = <VBox id="root" xmlns="laml.display" x="200" y="10" padding="5" backgroundColor="#FFCC00">
+				<ComponentMock id="child1" width="100%" height="80" backgroundColor="#FF0000" />
+				<Label id="child2" width="100" height="100" text="what" backgroundColor="#00FF00" />
+				<Component id="child3" width="100%" height="105" backgroundColor="#0000FF" />
+			</VBox>;
+
+			removeChild(component.view);
+
+			box = parser.parseLayoutable(xml);
+
+			box.width = 400;
+			box.height = 330;
+
+			addChild(box.view);
+
+			var child:ComponentMock = box.getChildById('child1') as ComponentMock;
+			assertNotNull(child);
+			assertEquals(2, child.widths.length);
+			assertEquals(1, child.heights.length);
+		}
 	}
 }


bitmap height width

bitmap height width

--- src/flash/display/Bitmap.as
+++ src/flash/display/Bitmap.as
@@ -42,7 +42,7 @@
 			SpriteFlexjs.dirtyGraphics = true;
 		}

-		override public function __getRect():Rectangle
+		override public function getRect(v:DisplayObject):Rectangle
 		{
 			if (bitmapData) return bitmapData.rect;
 			return null;


organize imports

organize imports

--- WeaveUI/src/weave/menus/FileMenu.as
+++ WeaveUI/src/weave/menus/FileMenu.as
@@ -17,7 +17,6 @@
 {
 	import flash.events.Event;
 	import flash.net.FileReference;
-	import flash.system.Capabilities;

 	import mx.controls.Alert;

@@ -36,8 +35,7 @@
 	import weave.ui.ExportSessionStateOptions;
 	import weave.utils.ColumnUtils;
 	import weave.utils.HierarchyUtils;
-	import weave.utils.PopUpUtils;
-	import weave.visualization.tools.ExternalTool;
+	import weave.utils.PopUpUtils;

 	public class FileMenu extends WeaveMenuItem
 	{


#SUP-1027 #comment fix playlist auto continue #time 3h

--- plugins/playlistApiPlugin/src/playlistAPIPluginCode.as
+++ plugins/playlistApiPlugin/src/playlistAPIPluginCode.as
@@ -385,11 +385,12 @@
 		 * @param evt
 		 */
 		private function onChangeItem(evt:Event):void {
+			if (isNaN(_dataProvider.selectedIndex)) {
+				_dataProvider.selectedIndex = 0;
+			}
+			_playlistAPIMediator.sendNotification(NotificationType.DO_PAUSE);
 			if (_started) {
 				_playlistAPIMediator.setMediaProxySingleAutoPlay(true);
-			}
-			if (isNaN(_dataProvider.selectedIndex)) {
-				_dataProvider.selectedIndex = 0;
 			}
 			sendChangeMedia(_dataProvider.selectedIndex);
 			_started = true;


helpers cleanup and test coverage improvements

--- test/com/gigya/WildfireTest.as
+++ test/com/gigya/WildfireTest.as
@@ -14,10 +14,6 @@
 				{
 					so(wildfire).should.be.a.kind_of(Wildfire);
 				});
-
-				it ('should contain real code', function () :void
-				{
-				});
 			});
 		}
 	}


Replaced CRLF with LF in Method.as - autocorrect from Git

--- asunit-4.0/src/asunit/framework/Method.as
+++ asunit-4.0/src/asunit/framework/Method.as
@@ -1,80 +1,80 @@
-package asunit.framework {
-
-    import p2.reflect.Reflection;
-    import p2.reflect.ReflectionMethod;
-    import p2.reflect.ReflectionMetaData;
-
-	public class Method {
-
-        private var _scopeName:String;
-
-		public var expects:String;
-		public var ignore:Boolean;
-        public var ignoreDescription:String;
-		public var metadata:ReflectionMetaData;
-		public var name:String;
-		public var order:int      = 0;
-		public var scope:Object;
-		public var timeout:int = -1;
-		public var value:Function;
-
-		public function Method(scope:Object, reflection:ReflectionMethod) {
-            this.scope = scope;
-            this.name = reflection.name;
-            this.value = scope[reflection.name];
-
-            metadata = reflection.getMetaDataByName('Test');
-
-            if(metadata != null) {
-                var ignoreReflection:ReflectionMetaData = reflection.getMetaDataByName('Ignore');
-                if(ignoreReflection) {
-                    ignore = true;
-                    ignoreDescription = ignoreReflection.getValueFor('description');
-                }
-
-                handleTimeoutMetaData();
-                applyMetaData('expects');
-                applyMetaData('order');
-            }
-        }
-
-        public function get scopeName():String {
-            return _scopeName ||= Reflection.create(scope).name
-        }
-
-        private function handleTimeoutMetaData():void {
-            var value:* = metadata.getValueFor('timeout');
-            if(value != null) {
-                var message:String = "It seems you're using [Test(timeout=n)] for " + name + ", but this has been deprecated.\n";
-                message += "If you'd like to set a different timeout value, please send it to your Async instance methods like: async.add(null, timeoutInMilliseconds)";
-                trace("[DEPRECATION WARNING] " + message);
-            }
-        }
-
-        // The null response for timeout was updating the
-        // int field to zero when it needs to be -1...
-        private function applyMetaData(name:String):void {
-            var value:* = metadata.getValueFor(name);
-            if(value != null) {
-                this[name] = value;
-            }
-        }
-
-        public function execute():void {
-            value.call(scope);
-        }
-
-        public function get isTest():Boolean {
-            return (metadata != null || isLegacyTest);
-        }
-
-        public function get isLegacyTest():Boolean {
-            return (metadata == null && name.match(/^test/));
-        }
-
-		public function toString():String {
-			return name;
-		}
-	}
-}
-
+package asunit.framework {
+
+    import p2.reflect.Reflection;
+    import p2.reflect.ReflectionMethod;
+    import p2.reflect.ReflectionMetaData;
+
+	public class Method {
+
+        private var _scopeName:String;
+
+		public var expects:String;
+		public var ignore:Boolean;
+        public var ignoreDescription:String;
+		public var metadata:ReflectionMetaData;
+		public var name:String;
+		public var order:int      = 0;
+		public var scope:Object;
+		public var timeout:int = -1;
+		public var value:Function;
+
+		public function Method(scope:Object, reflection:ReflectionMethod) {
+            this.scope = scope;
+            this.name = reflection.name;
+            this.value = scope[reflection.name];
+
+            metadata = reflection.getMetaDataByName('Test');
+
+            if(metadata != null) {
+                var ignoreReflection:ReflectionMetaData = reflection.getMetaDataByName('Ignore');
+                if(ignoreReflection) {
+                    ignore = true;
+                    ignoreDescription = ignoreReflection.getValueFor('description');
+                }
+
+                handleTimeoutMetaData();
+                applyMetaData('expects');
+                applyMetaData('order');
+            }
+        }
+
+        public function get scopeName():String {
+            return _scopeName ||= Reflection.create(scope).name
+        }
+
+        private function handleTimeoutMetaData():void {
+            var value:* = metadata.getValueFor('timeout');
+            if(value != null) {
+                var message:String = "It seems you're using [Test(timeout=n)] for " + name + ", but this has been deprecated.\n";
+                message += "If you'd like to set a different timeout value, please send it to your Async instance methods like: async.add(null, timeoutInMilliseconds)";
+                trace("[DEPRECATION WARNING] " + message);
+            }
+        }
+
+        // The null response for timeout was updating the
+        // int field to zero when it needs to be -1...
+        private function applyMetaData(name:String):void {
+            var value:* = metadata.getValueFor(name);
+            if(value != null) {
+                this[name] = value;
+            }
+        }
+
+        public function execute():void {
+            value.call(scope);
+        }
+
+        public function get isTest():Boolean {
+            return (metadata != null || isLegacyTest);
+        }
+
+        public function get isLegacyTest():Boolean {
+            return (metadata == null && name.match(/^test/));
+        }
+
+		public function toString():String {
+			return name;
+		}
+	}
+}
+


Optimize object spawn via script in Editor. Closes #1664.

--- bin/Data/Scripts/Editor/EditorUI.as
+++ bin/Data/Scripts/Editor/EditorUI.as
@@ -1247,7 +1247,13 @@
 void HandleRunScript(StringHash eventType, VariantMap& eventData)
 {
     CloseFileSelector(uiScriptFilter, uiScriptPath);
+
+    suppressSceneChanges = true;
     ExecuteScript(ExtractFileName(eventData));
+    suppressSceneChanges = false;
+
+    UpdateHierarchyItem(editorScene, true);
+    UpdateHierarchyItem(editorUIElement, true);
 }

 void HandleResourcePath(StringHash eventType, VariantMap& eventData)


Bugfix in Set.pop()

Bugfix in Set.pop()

--- raw/src/org/yellcorp/lib/core/Set.as
+++ raw/src/org/yellcorp/lib/core/Set.as
@@ -167,6 +167,7 @@
             break;
         }
         delete dict[item];
+        _length--;
         return item;
     }


added check for missing state

added check for missing state

--- WeaveJS/src/weavejs/api/core/DynamicState.as
+++ WeaveJS/src/weavejs/api/core/DynamicState.as
@@ -155,6 +155,8 @@
 		{
 			if (!path.length)
 				return newValue === undefined ? state : newValue;
+			if (!state)
+				return undefined;

 			var property:* = path[0];
 			path = path.slice(1);


Prevent unnecessary update on attribute inspector if it is not showing attributes of UI-element having the attribute changed event detected.

--- Bin/Data/Scripts/Editor/EditorSceneWindow.as
+++ Bin/Data/Scripts/Editor/EditorSceneWindow.as
@@ -930,7 +930,12 @@
     if (suppressUIElementChanges)
         return;

-    attributesDirty = true;
+    UIElement@ element = eventData["Element"].GetUIElement();
+    for (uint i = 0; i < editUIElements.length; ++i)
+    {
+        if (editUIElements[i] is element)
+            attributesDirty = true;
+    }
 }

 // Hierarchy window edit functions


Cleaned up some issues:
- While Menu.popUpMenu() takes a DisplayObjectContainer as a parent,
  it will hork unless the parent is really a UIComponent.
  Omit that parameter from our convenience function and allow the parent
  to be set to the application.
- Changed show() with no args to show at the mouse location.

git-svn-id: b675b909355d5cf946977f44a8ec5a6ceb3782e4@131 ed5b42cb-e716-0410-a449-f6a68f950b19

--- src/as/com/threerings/flex/CommandMenu.as
+++ src/as/com/threerings/flex/CommandMenu.as
@@ -7,12 +7,15 @@

 import mx.controls.Menu;
 import mx.core.mx_internal;
+import mx.core.Application;
 import mx.core.ScrollPolicy;
 import mx.events.MenuEvent;

 import com.dougmccune.controls.ScrollableArrowMenu;

 import com.threerings.util.CommandEvent;
+
+use namespace mx_internal;

 /**
  * A pretty standard menu that can submit CommandEvents if menu items
@@ -45,16 +48,15 @@
     /**
      * Factory method to create a command menu.
      *
-     * @param parent The parent of this menu.
      * @param items an array of menu items.
      */
-    public static function createMenu (
-        parent :DisplayObjectContainer, items :Array) :CommandMenu
+    public static function createMenu (items :Array) :CommandMenu
     {
         var menu :CommandMenu = new CommandMenu();
+        menu.owner = DisplayObjectContainer(Application.application);
         menu.tabEnabled = false;
         menu.showRoot = true;
-        Menu.popUpMenu(menu, parent, items);
+        Menu.popUpMenu(menu, null, items);
         return menu;
     }

@@ -72,9 +74,25 @@
             y = r.y - getExplicitOrMeasuredHeight();

         } else {
-            // simply position it below the trigger
+            // position it below the trigger
             show(r.x, r.y + r.height);
         }
+    }
+
+    /**
+     * Just like our superclass's show(), except that when invoked
+     * with no args, causes the menu to show at the current mouse location
+     * instead of the top-left corner of the application.
+     */
+    override public function show (xShow :Object = null, yShow :Object = null) :void
+    {
+        if (xShow == null) {
+            xShow = DisplayObject(Application.application).mouseX;
+        }
+        if (yShow == null) {
+            yShow = DisplayObject(Application.application).mouseY;
+        }
+        super.show(xShow, yShow);
     }

     /**
@@ -108,15 +126,6 @@
             }
         }
     }
-
-//    /**
-//     * Callback for MenuEvent.MENU_SHOW.
-//     */
-//    protected function handleMenuShown (event :MenuEvent) :void
-//    {
-//        // just ensure that every menu can scroll
-//        event.menu.verticalScrollPolicy = ScrollPolicy.ON;
-//    }

     /**
      * Get the command for the specified item, if any.