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

--- frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as
+++ frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as
@@ -0,0 +1,896 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.resources
+{
+
+import flash.events.Event;
+import flash.events.EventDispatcher;
+import flash.events.IEventDispatcher;
+import flash.events.TimerEvent;
+import flash.system.ApplicationDomain;
+import flash.system.SecurityDomain;
+import flash.utils.Timer;
+import mx.core.IFlexModuleFactory;
+import mx.core.mx_internal;
+import mx.core.Singleton;
+import mx.events.ModuleEvent;
+import mx.events.ResourceEvent;
+import mx.modules.IModuleInfo;
+import mx.modules.ModuleManager;
+import mx.utils.StringUtil;
+
+/**
+ *  @copy mx.resources.IResourceManager#change
+ */
+[Event(name="change", type="flash.events.Event")]
+
+[ExcludeClass]
+
+/**
+ *  This class provides an implementation of the IResourceManager interface.
+ *  The IResourceManager and IResourceBundle interfaces work together
+ *  to provide internationalization support for Flex applications.
+ *
+ *
A single instance of this class manages all localized resources
+ *  for a Flex application.

+ *
+ *  @see mx.resources.IResourceManager
+ *  @see mx.resources.IResourceBundle
+ */
+public class ResourceManagerImpl extends EventDispatcher implements IResourceManager
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  The sole instance of the ResourceManager.
+     */
+    private static var instance:IResourceManager;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Gets the single instance of the ResourceManagerImpl class.
+     *  This object manages all localized resources for a Flex application.
+     *
+     *  @return An object implementing IResourceManager.
+     */
+    public static function getInstance():IResourceManager
+    {
+        if (!instance)
+            instance = new ResourceManagerImpl();
+
+        return instance;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function ResourceManagerImpl()
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  A map whose keys are locale strings like "en_US"
+     *  and whose values are "bundle maps".
+     *  A bundle map is a map whose keys are bundle names
+     *  like "SharedResources" and whose values are ResourceBundle instances.
+     *  You can get to an individual resource value like this:
+     *  localeMap["en_US"]["SharedResources"].content["currencySymbol"]
+     */
+    private var localeMap:Object = {};
+
+    /**
+     *  @private
+     *  A map whose keys are URLs for resource modules that have been loaded
+     *  and whose values are ResourceModuleInfo instances for those modules.
+     */
+    private var resourceModules:Object = {};
+
+    /**
+     *  @private
+     */
+    private var initializedForNonFrameworkApp:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  localeChain
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the localeChain property.
+     */
+    private var _localeChain:Array /* of String */;
+
+    /**
+     *  @copy mx.resources.IResourceManager#localeChain
+     */
+    public function get localeChain():Array /* of String */
+    {
+        return _localeChain;
+    }
+
+    /**
+     *  @private
+     */
+    public function set localeChain(value:Array /* of String */):void
+    {
+        _localeChain = value;
+
+        update();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  This method is called by the SystemManager class of an Application
+     *  when the application starts.
+     *  It is also called by the FlexModuleFactory class of a code module
+     *  when that module gets loaded.
+     *
+     *  The MXML compiler autogenerated code which set the
+     *  "compiledLocales" and "compiledResourceBundleNames" properties
+     *  of the info() Object required by the IFlexModuleFactory
+     *  interface that these classes implement.
+     *  These two properties together indicate which resource bundle
+     *  classes the MXML compiler autogenerated and linked into the
+     *  application or module.
+     *
+     *  The "compiledLocales" property has been set to the locales
+     *  which were specified at compile time using the -locale option.
+     *  For example, if you compile with -locale=en_US,ja_JP
+     *  then the "compiledLocales" property is the array [ "en_US", "ja_JP" ].
+     *
+     *  The "compiledResourceBundleNames" property has been set
+     *  to the names of the resource bundles which are used by
+     *  the application or module, as determined by the compiler
+     *  from [ResourceBundle] metadata and ~~Resource() directives.
+     *  For example, if the classes in the application or module
+     *  declare that they use resource bundles named "core" and "MyApp",
+     *  then the "compiledResourceBundleNames" property is the array
+     *  [ "core", "MyApp" ].
+     *
+     *  The compiler autogenerated a ResourceBundle subclass for each
+     *  (locale, bundle name) pair.
+     *  For example, with the above locales and bundle names,
+     *  there would be four classes:
+     *    en_US$core_properties
+     *    en_US$MyApp_properties
+     *    ja_JP$core_properties
+     *    ja_JP$MyApp_properties
+     *
+     *  This method creates one instance of each such class
+     *  and installs it into the ResourceManager with addResourceBundle().
+     *  If a bundle for a given locale and bundle name already exists
+     *  in the ResourceManager already exists, it does not get replaced.
+     *  This can happen when a code module gets loaded into an application.
+     */
+    public function installCompiledResourceBundles(
+                                applicationDomain:ApplicationDomain,
+                                locales:Array /* of String */,
+                                bundleNames:Array /* of String */):void
+    {
+        //trace("locales", locales);
+        //trace("bundleNames", bundleNames);
+
+        var n:int = locales ? locales.length : 0;
+        var m:int = bundleNames ? bundleNames.length : 0;
+
+        // Loop over the locales.
+        for (var i:int = 0; i < n; i++)
+        {
+            var locale:String = locales[i];
+
+            // Loop over the bundle names.
+            for (var j:int = 0; j < m; j++)
+            {
+                var bundleName:String = bundleNames[j];
+
+                mx_internal::installCompiledResourceBundle(
+                    applicationDomain, locale, bundleName);
+            }
+        }
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function installCompiledResourceBundle(
+                                applicationDomain:ApplicationDomain,
+                                locale:String, bundleName:String):void
+    {
+        var packageName:String = null;
+        var localName:String = bundleName;
+        var colonIndex:int = bundleName.indexOf(":");
+        if (colonIndex != -1)
+        {
+            packageName = bundleName.substring(0, colonIndex);
+            localName = bundleName.substring(colonIndex + 1);
+        }
+
+        // If a bundle with that locale and bundle name already exists
+        // in the ResourceManager, don't replace it.
+        if (getResourceBundle(locale, bundleName))
+            return;
+
+        // The autogenerated resource bundle classes produced by the
+        // mxmlc and compc compilers have names that incorporate
+        // the locale and bundle name, such as "en_US$core_properties".
+        var resourceBundleClassName:String =
+            locale + "$" + localName + "_properties";
+        if (packageName != null)
+            resourceBundleClassName = packageName + "." + resourceBundleClassName;
+
+        // Find the bundle class by its name.
+        // We do a hasDefinition() check before calling getDefinition()
+        // because getDefinition() will throw an RTE
+        // if the class doesn't exist.
+        var bundleClass:Class = null;
+        if (applicationDomain.hasDefinition(resourceBundleClassName))
+        {
+            bundleClass = Class(applicationDomain.getDefinition(
+                                    resourceBundleClassName));
+        }
+
+        if (!bundleClass)
+        {
+            resourceBundleClassName = bundleName;
+            if (applicationDomain.hasDefinition(resourceBundleClassName))
+            {
+                bundleClass = Class(applicationDomain.getDefinition(
+                                        resourceBundleClassName));
+            }
+        }
+
+        // In case we linked against a Flex 2 SWC, look for the old
+        // class name.
+        if (!bundleClass)
+        {
+            resourceBundleClassName = bundleName + "_properties";
+            if (applicationDomain.hasDefinition(resourceBundleClassName))
+            {
+                bundleClass = Class(applicationDomain.getDefinition(
+                                        resourceBundleClassName));
+            }
+        }
+
+        if (!bundleClass)
+        {
+            throw new Error(
+                "Could not find compiled resource bundle '" + bundleName +
+                "' for locale '" + locale + "'.");
+        }
+
+        // Create an instance of the bundle class.
+        var resourceBundle:ResourceBundle =
+            ResourceBundle(new bundleClass());
+
+        // In case we just created a ResourceBundle from a Flex 2 SWC,
+        // set its locale and bundleName, because the old constructor
+        // didn't used to do this.
+        resourceBundle.mx_internal::_locale = locale;
+        resourceBundle.mx_internal::_bundleName = bundleName;
+
+        // Add that resource bundle instance to the ResourceManager.
+        addResourceBundle(resourceBundle);
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#loadResourceModule()
+     */
+    public function loadResourceModule(url:String, updateFlag:Boolean = true,
+                                       applicationDomain:ApplicationDomain = null,
+                                       securityDomain:SecurityDomain = null):
+                                       IEventDispatcher
+    {
+        var moduleInfo:IModuleInfo = ModuleManager.getModule(url);
+
+        // Create the per-load IEventDispatcher that we'll return.
+        var resourceEventDispatcher:ResourceEventDispatcher =
+            new ResourceEventDispatcher(moduleInfo);
+
+        // Set up a handler for the "ready" event from the module.
+        // We use a local Function rather than a method
+        // so that it can access the 'update' argument.
+        var readyHandler:Function = function(event:ModuleEvent):void
+        {
+            //trace("readyHandler");
+
+            var resourceModule:* = // IResourceModule
+                event.module.factory.create();
+
+            //dumpResourceModule(resourceModule);
+
+            resourceModules[event.module.url].resourceModule = resourceModule;
+
+            if (updateFlag)
+                update();
+        }
+        moduleInfo.addEventListener(ModuleEvent.READY, readyHandler,
+                                    false, 0, true);
+
+        // Set up a handler for the "error" event from the module.
+        // We use a local Function rather than a method
+        // for symmetry with the readyHandler.
+        var errorHandler:Function = function(event:ModuleEvent):void
+        {
+            var message:String = "Unable to load resource module from " + url;
+
+            if (resourceEventDispatcher.willTrigger(ResourceEvent.ERROR))
+            {
+                var resourceEvent:ResourceEvent = new ResourceEvent(
+                    ResourceEvent.ERROR, event.bubbles, event.cancelable);
+                resourceEvent.bytesLoaded = 0;
+                resourceEvent.bytesTotal = 0;
+                resourceEvent.errorText = message;
+                resourceEventDispatcher.dispatchEvent(resourceEvent);
+            }
+            else
+            {
+                throw new Error(message);
+            }
+        }
+        moduleInfo.addEventListener(ModuleEvent.ERROR, errorHandler,
+                                    false, 0, true);
+
+        resourceModules[url] =
+            new ResourceModuleInfo(moduleInfo, readyHandler, errorHandler);
+
+        // This Timer gives the loadResourceModules() caller a chance
+        // to add event listeners to the return value, before the module
+        // is loaded.
+        // We use a local Function for the timerHandler rather than a method
+        // so that it can access the 'moduleInfo' local var.
+        var timer:Timer = new Timer(0);
+        var timerHandler:Function = function(event:TimerEvent):void
+        {
+            timer.removeEventListener(TimerEvent.TIMER, timerHandler);
+            timer.stop();
+
+            //trace("loading");
+
+            // Start loading the module.
+            moduleInfo.load(applicationDomain, securityDomain);
+        }
+        timer.addEventListener(TimerEvent.TIMER, timerHandler,
+                               false, 0, true);
+        timer.start();
+
+        return resourceEventDispatcher;
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#unloadResourceModule()
+     */
+    public function unloadResourceModule(url:String, update:Boolean = true):void
+    {
+        throw new Error("unloadResourceModule() is not yet implemented.");
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#addResourceBundle()
+     */
+    public function addResourceBundle(resourceBundle:IResourceBundle):void
+    {
+        var locale:String = resourceBundle.locale;
+        var bundleName:String = resourceBundle.bundleName;
+
+        if (!localeMap[locale])
+            localeMap[locale] = {};
+
+        localeMap[locale][bundleName] = resourceBundle;
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#getResourceBundle()
+     */
+    public function getResourceBundle(locale:String,
+                                      bundleName:String):IResourceBundle
+    {
+        var bundleMap:Object = localeMap[locale];
+        if (!bundleMap)
+            return null;
+
+        return bundleMap[bundleName];
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#removeResourceBundle()
+     */
+    public function removeResourceBundle(locale:String, bundleName:String):void
+    {
+        // Remove the specified bundle.
+        delete localeMap[locale][bundleName];
+
+        // If that leaves a locale node with no bundles,
+        // delete the locale node.
+        if (getBundleNamesForLocale(locale).length == 0)
+            delete localeMap[locale];
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#removeResourceBundlesForLocale()
+     */
+    public function removeResourceBundlesForLocale(locale:String):void
+    {
+        delete localeMap[locale];
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#update()
+     */
+    public function update():void
+    {
+        dispatchEvent(new Event(Event.CHANGE));
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#getLocales()
+     */
+    public function getLocales():Array /* of String */
+    {
+        var locales:Array = [];
+        for (var p:String in localeMap)
+        {
+            locales.push(p);
+        }
+        return locales;
+    }
+
+    /**
+     *  @copy mx.resources.IResourceManager#getBundleNamesForLocale()
+     */
+    public function getBundleNamesForLocale(locale:String):Array /* of String */
+    {
+        var bundleNames:Array = [];
+        for (var p:String in localeMap[locale])
+        {
+            bundleNames.push(p);
+        }
+        return bundleNames;
+    }
+
+    /**
+     *  @copy mx.resources.findResourceBundleWithResource
+     */
+    public function findResourceBundleWithResource(
+                        bundleName:String, resourceName:String):IResourceBundle
+    {
+        if (!_localeChain)
+            return null;
+
+        var n:int = _localeChain.length;
+        for (var i:int = 0; i < n; i++)
+        {
+            var locale:String = localeChain[i];
+
+            var bundleMap:Object = localeMap[locale];
+            if (!bundleMap)
+                continue;
+
+            var bundle:ResourceBundle = bundleMap[bundleName];
+            if (!bundle)
+                continue;
+
+            if (resourceName in bundle.content)
+                return bundle;
+        }
+
+        return null;
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getObject()
+     */
+    public function getObject(bundleName:String, resourceName:String,
+                              locale:String = null):*
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return undefined;
+
+        return resourceBundle.content[resourceName];
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getString()
+     */
+    public function getString(bundleName:String, resourceName:String,
+                              parameters:Array = null,
+                              locale:String = null):String
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return null;
+
+        var value:String = String(resourceBundle.content[resourceName]);
+
+        if (parameters)
+            value = StringUtil.substitute(value, parameters);
+
+        return value;
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getStringArray()
+     */
+    public function getStringArray(bundleName:String,
+                                   resourceName:String,
+                                   locale:String = null):Array /* of String */
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return null;
+
+        var value:* = resourceBundle.content[resourceName];
+
+        var array:Array = String(value).split(",");
+
+        var n:int = array.length;
+        for (var i:int = 0; i < n; i++)
+        {
+             array[i] = StringUtil.trim(array[i]);
+        }
+
+        return array;
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getNumber()
+     */
+    public function getNumber(bundleName:String, resourceName:String,
+                              locale:String = null):Number
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return NaN;
+
+        var value:* = resourceBundle.content[resourceName];
+
+        return Number(value);
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getInt()
+     */
+    public function getInt(bundleName:String, resourceName:String,
+                           locale:String = null):int
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return 0;
+
+        var value:* = resourceBundle.content[resourceName];
+
+        return int(value);
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getUint()
+     */
+    public function getUint(bundleName:String, resourceName:String,
+                            locale:String = null):uint
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return 0;
+
+        var value:* = resourceBundle.content[resourceName];
+
+        return uint(value);
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getBoolean()
+     */
+    public function getBoolean(bundleName:String, resourceName:String,
+                               locale:String = null):Boolean
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return false;
+
+        var value:* = resourceBundle.content[resourceName];
+
+        return String(value).toLowerCase() == "true";
+    }
+
+    [Bindable("change")]
+
+    /**
+     *  @copy mx.resources.IResourceManager#getClass()
+     */
+    public function getClass(bundleName:String, resourceName:String,
+                             locale:String = null):Class
+    {
+        var resourceBundle:IResourceBundle =
+            findBundle(bundleName, resourceName, locale);
+        if (!resourceBundle)
+            return null;
+
+        var value:* = resourceBundle.content[resourceName];
+
+        return value as Class;
+    }
+
+    /**
+     *  @private.
+     */
+    private function findBundle(bundleName:String, resourceName:String,
+                                locale:String):IResourceBundle
+    {
+        supportNonFrameworkApps();
+
+        return locale != null ?
+               getResourceBundle(locale, bundleName) :
+               findResourceBundleWithResource(bundleName, resourceName);
+
+    }
+
+    /**
+     *  @private.
+     */
+    private function supportNonFrameworkApps():void
+    {
+        if (initializedForNonFrameworkApp)
+            return;
+        initializedForNonFrameworkApp = true;
+
+        if (getLocales().length > 0)
+            return;
+
+        var applicationDomain:ApplicationDomain =
+            ApplicationDomain.currentDomain;
+
+        if (!applicationDomain.hasDefinition("_CompiledResourceBundleInfo"))
+            return;
+        var c:Class = Class(applicationDomain.getDefinition(
+                                "_CompiledResourceBundleInfo"));
+
+        var locales:Array /* of String */ = c.compiledLocales;
+        var bundleNames:Array /* of String */ = c.compiledResourceBundleNames;
+
+        installCompiledResourceBundles(
+            applicationDomain, locales, bundleNames);
+
+        localeChain = locales;
+    }
+
+    /**
+     *  @private.
+     */
+    private function dumpResourceModule(resourceModule:*):void
+    {
+        for each (var bundle:ResourceBundle in resourceModule.resourceBundles)
+        {
+            trace(bundle.locale, bundle.bundleName);
+            for (var p:String in bundle.content)
+            {
+                //trace(p, bundle.getObject(p));
+            }
+        }
+    }
+}
+
+}
+
+import flash.events.EventDispatcher;
+import mx.events.ModuleEvent;
+import mx.events.ResourceEvent;
+import mx.modules.IModuleInfo;
+import mx.resources.IResourceModule;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Helper class: ResourceModuleInfo
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  @private
+ */
+class ResourceModuleInfo
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function ResourceModuleInfo(moduleInfo:IModuleInfo,
+                                       readyHandler:Function,
+                                       errorHandler:Function)
+    {
+        super();
+
+        this.moduleInfo = moduleInfo;
+        this.readyHandler = readyHandler;
+        this.errorHandler = errorHandler;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  errorHandler
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public var errorHandler:Function;
+
+    //----------------------------------
+    //  moduleInfo
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public var moduleInfo:IModuleInfo
+
+    //----------------------------------
+    //  readyHandler
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public var readyHandler:Function;
+
+    //----------------------------------
+    //  resourceModule
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public var resourceModule:IResourceModule;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Helper class: ResourceEventDispatcher
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  @private
+ */
+class ResourceEventDispatcher extends EventDispatcher
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function ResourceEventDispatcher(moduleInfo:IModuleInfo)
+    {
+        super();
+
+        moduleInfo.addEventListener(
+            ModuleEvent.ERROR, moduleInfo_errorHandler, false, 0, true);
+
+        moduleInfo.addEventListener(
+            ModuleEvent.PROGRESS, moduleInfo_progressHandler, false, 0, true);
+
+        moduleInfo.addEventListener(
+            ModuleEvent.READY, moduleInfo_readyHandler, false, 0, true);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function moduleInfo_errorHandler(event:ModuleEvent):void
+    {
+        var resourceEvent:ResourceEvent = new ResourceEvent(
+            ResourceEvent.ERROR, event.bubbles, event.cancelable);
+        resourceEvent.bytesLoaded = event.bytesLoaded;
+        resourceEvent.bytesTotal = event.bytesTotal;
+        resourceEvent.errorText = event.errorText;
+        dispatchEvent(resourceEvent);
+    }
+
+    /**
+     *  @private
+     */
+    private function moduleInfo_progressHandler(event:ModuleEvent):void
+    {
+        var resourceEvent:ResourceEvent = new ResourceEvent(
+            ResourceEvent.PROGRESS, event.bubbles, event.cancelable);
+        resourceEvent.bytesLoaded = event.bytesLoaded;
+        resourceEvent.bytesTotal = event.bytesTotal;
+        dispatchEvent(resourceEvent);
+    }
+
+    /**
+     *  @private
+     */
+    private function moduleInfo_readyHandler(event:ModuleEvent):void
+    {
+        var resourceEvent:ResourceEvent =
+            new ResourceEvent(ResourceEvent.COMPLETE);
+        dispatchEvent(resourceEvent);
+    }
+}


Add TODO

Add TODO

--- frameworks/projects/mobiletheme/src/spark/skins/ios7/ButtonBarSkin.as
+++ frameworks/projects/mobiletheme/src/spark/skins/ios7/ButtonBarSkin.as
@@ -124,6 +124,7 @@
         {
             dataGroup = new DataGroup();
             var hLayout:ButtonBarHorizontalLayout = new ButtonBarHorizontalLayout();
+			//TODO: Gap should vary depending on current DPI
             hLayout.gap = -1;
             dataGroup.layout = hLayout;
             addChild(dataGroup);


Fixed endless loop in Tundra scene import.

--- Bin/Data/Scripts/Editor/EditorImport.as
+++ Bin/Data/Scripts/Editor/EditorImport.as
@@ -86,7 +86,7 @@

     Array<String> convertedMaterials;
     Array<String> convertedMeshes;
-
+
     // Clear old scene, then create a zone and a directional light first
     CreateScene();

@@ -108,9 +108,12 @@
     {
         String nodeName;
         String meshName;
+        Vector3 meshPos;
+        Vector3 meshRot;
+        Vector3 meshScale(1, 1, 1);
         Vector3 pos;
         Vector3 rot;
-        Vector3 scale;
+        Vector3 scale(1, 1, 1);
         bool castShadows = false;
         float drawDistance = 0;
         Array<String> materialNames;
@@ -119,8 +122,13 @@
         while (!compElem.isNull)
         {
             String compType = compElem.GetAttribute("type");
+
             if (compType == "EC_Mesh")
             {
+                Array<String> coords = GetComponentAttribute(compElem, "Transform").Split(',');
+                meshPos = GetVector3FromStrings(coords, 0);
+                meshRot = GetVector3FromStrings(coords, 3);
+                meshScale = GetVector3FromStrings(coords, 6);
                 meshName = GetComponentAttribute(compElem, "Mesh ref");
                 castShadows = GetComponentAttribute(compElem, "Cast shadows").ToBool();
                 drawDistance = GetComponentAttribute(compElem, "Draw distance").ToFloat();
@@ -137,64 +145,68 @@
                 pos = GetVector3FromStrings(coords, 0);
                 rot = GetVector3FromStrings(coords, 3);
                 scale = GetVector3FromStrings(coords, 6);
-
-                // Fix coordinate system
-                //pos = Vector3(pos.x, pos.z, pos.y);
-                //rot = Vector3(rot.x, -rot.z + 180, rot.y);
             }

             compElem = compElem.GetNext("component");
         }

         // For now we are only interested of meshes
-        if (meshName.empty)
-            continue;
-
-        for (uint i = 0; i < materialNames.length; ++i)
-        {
+        if (!meshName.empty)
+        {
+            for (uint i = 0; i < materialNames.length; ++i)
+            {
+                bool found = false;
+                for (uint j = 0; j < convertedMaterials.length; ++j)
+                {
+                    if (convertedMaterials[j] == materialNames[i])
+                    {
+                        found = true;
+                        break;
+                    }
+                }
+
+                if (!found)
+                {
+                    ConvertMaterial(materialNames[i], filePath);
+                    convertedMaterials.Push(materialNames[i]);
+                }
+            }
+
             bool found = false;
-            for (uint j = 0; j < convertedMaterials.length; ++j)
-            {
-                if (convertedMaterials[j] == materialNames[i])
+            for (uint i = 0; i < convertedMeshes.length; ++i)
+            {
+                if (convertedMeshes[i] == meshName)
                 {
                     found = true;
                     break;
-                }
-            }
-
+                }
+            }
             if (!found)
-            {
-                ConvertMaterial(materialNames[i], filePath);
-                convertedMaterials.Push(materialNames[i]);
-            }
-        }
-
-        bool found = false;
-        for (uint i = 0; i < convertedMeshes.length; ++i)
-        {
-            if (convertedMeshes[i] == meshName)
-            {
-                found = true;
-                break;
-            }
-        }
-        if (!found)
-            ConvertModel(meshName, filePath);
-
-        Node@ newNode = editorScene.CreateChild(nodeName, useLocalIDs ? LOCAL : REPLICATED);
-        StaticModel@ model = newNode.CreateComponent("StaticModel");
-
-        newNode.SetTransform(pos, Quaternion(rot), scale);
-        model.model = cache.GetResource("Model", "Models/" + meshName.Replaced(".mesh", ".mdl"));
-        model.drawDistance = drawDistance;
-        model.castShadows = castShadows;
-        for (uint i = 0; i < materialNames.length; ++i)
-            model.materials[i] = cache.GetResource("Material", "Materials/" + materialNames[i].Replaced(".material", ".xml"));
-
-        UpdateSceneWindow();
+                ConvertModel(meshName, filePath);
+
+            Node@ newNode = editorScene.CreateChild(nodeName, useLocalIDs ? LOCAL : REPLICATED);
+            StaticModel@ model = newNode.CreateComponent("StaticModel");
+
+            // Calculate final transform in an Ogre-like fashion
+            Quaternion quat = Quaternion(rot);
+            Quaternion meshQuat = Quaternion(meshRot);
+            Quaternion finalQuat = quat * meshQuat;
+            Vector3 finalScale = scale * meshScale;
+            Vector3 finalPos = pos + quat * (scale * meshPos);
+
+            newNode.SetTransform(finalPos, finalQuat, finalScale);
+            model.model = cache.GetResource("Model", "Models/" + meshName.Replaced(".mesh", ".mdl"));
+            model.drawDistance = drawDistance;
+            model.castShadows = castShadows;
+            for (uint i = 0; i < materialNames.length; ++i)
+                model.materials[i] = cache.GetResource("Material", "Materials/" + materialNames[i].Replaced(".material", ".xml"));
+        }

         entityElem = entityElem.GetNext("entity");
     }
+
+    UpdateSceneWindow();
+    UpdateWindowTitle();
 }

 String GetComponentAttribute(XMLElement compElem, const String&in name)


fixed * vs *.* FileFilter mac bug

fixed * vs *.* FileFilter mac bug

Change-Id: Ia62e3ed43fb624c3671922cfb4259468f83582d6

--- WeaveClient/src/weave/VisApplication.as
+++ WeaveClient/src/weave/VisApplication.as
@@ -1400,7 +1400,7 @@
 				_weaveFileRef.addEventListener(Event.SELECT,   function (e:Event):void { _weaveFileRef.load(); } );
 				_weaveFileRef.addEventListener(Event.COMPLETE, function (e:Event):void { loadSessionState(e.target.data, _weaveFileRef.name); } );
 			}
-			_weaveFileRef.browse([new FileFilter("Weave files", "*.weave"),new FileFilter("All files", "*")]);
+			_weaveFileRef.browse([new FileFilter("Weave files", "*.weave"),new FileFilter("All files", "*.*")]);
 		}

 		private function handleExportSessionState():void


Fix access to Fragment

Fix access to Fragment

--- src/org/mangui/hls/loader/FragmentLoader.as
+++ src/org/mangui/hls/loader/FragmentLoader.as
@@ -206,7 +206,7 @@
                     if (_loading_state == LOADING_STALLED) {
                         /* next consecutive fragment not found:
                         it could happen on live playlist :
-                        - if bandwidth available is lower than lowest quality needed bandwidth
+                        - if bandwidth available is lower than lowest quality needed bandwidth
                         - after long pause */
                         CONFIG::LOGGING {
                             Log.warn("loading stalled: restart playback");
@@ -686,7 +686,7 @@
                     CONFIG::LOGGING {
                         Log.error(err);
                     }
-                    var hlsError : HLSError = new HLSError(HLSError.OTHER_ERROR, _frag_current.url, err);
+                    var hlsError : HLSError = new HLSError(HLSError.OTHER_ERROR, frag.url, err);
                     _hls.dispatchEvent(new HLSEvent(HLSEvent.ERROR, hlsError));
                     return;
                 }
@@ -811,9 +811,9 @@
                 fragData.tags.push(tag);
             }

-            /* try to do progressive buffering here.
+            /* try to do progressive buffering here.
              * only do it in case :
-             * 		first fragment is already loaded
+             * 		first fragment is already loaded
              *      if first fragment is not loaded, we can do it if startlevel is already defined (if startFromLevel is set to -1
              *      we first need to download one fragment to check the dl bw, in order to assess start level ...)
              *      in case startFromLevel is to -1 and there is only one level, then we can do progressive buffering
@@ -832,7 +832,7 @@
                     var max_offset : Number = _frag_current.start_time + fragData.tag_pts_end_offset / 1000;
                     // in case of cold start/seek use case,
                     if (!_fragment_first_loaded ) {
-                        /* ensure buffer max offset is greater than requested seek position.
+                        /* ensure buffer max offset is greater than requested seek position.
                          * this will avoid issues with accurate seeking feature */
                         if (_seek_pos > max_offset) {
                             // cannot do progressive buffering until we have enough data to reach requested seek offset


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

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


Transferred from the Adobe Open Source Subversion Repository

Revision: 12378
Author:   clucier@adobe.com
Date:     2009-12-02T18:25:58.572273Z

Log Message:
-----------
Reverting an earlier fix due to injection.  Replacing with something that's (hopefully) less invasive.

QE notes: None
Doc notes: None
Bugs: SDK-24440
Reviewer: Alex
Tests run: Tilelist, HorizontalList
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/TileBase.as</path>

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

--- frameworks/projects/mx/src/mx/controls/listClasses/ListBase.as
+++ frameworks/projects/mx/src/mx/controls/listClasses/ListBase.as
@@ -4613,20 +4613,14 @@
     private function makeAdditionalRows(rowIndex:int):void
     {
         var cursorPos:CursorBookmark;
-
-        // Our most recent listItem may not have actually been realized,
-        // this may occur if we detected it would be obscured at the time.
-        // If this is the case we will continue where we left off.
-        var lastItemValid:Boolean = listItems[rowIndex].length;
-
+
         // do layout for additional rows
         if (iterator)
         {
             cursorPos = iterator.bookmark;
             try
             {
-                if (lastItemValid)
-                    iterator.seek(CursorBookmark.CURRENT, listItems.length);
+                iterator.seek(CursorBookmark.CURRENT, listItems.length);
             }
             catch(e:ItemPendingError)
             {
@@ -4639,13 +4633,9 @@
                 // don't do anything, we'll repaint when the data arrives
             }
         }
-
-        var prevIndex:int = lastItemValid ? rowIndex : rowIndex - 1;
-        var curY:Number = prevIndex >= 0 ? rowInfo[rowIndex].y + rowInfo[rowIndex].height : 0;
-        var firstRow:int = lastItemValid ? rowIndex + 1 : rowIndex;
-
+        var curY:Number = rowInfo[rowIndex].y + rowInfo[rowIndex].height;
         // fill it in
-        makeRowsAndColumns(0, curY, listContent.width, listContent.height, 0, firstRow);
+        makeRowsAndColumns(0, curY, listContent.width, listContent.height, 0, rowIndex + 1);
         // restore iterator to original position
         seekPositionIgnoreError(iterator,cursorPos);
     }


Transferred from the Adobe Open Source Subversion Repository

Revision: 5797
Author:   jimurphy@adobe.com
Date:     2009-03-31T15:35:34.544076Z

Log Message:
-----------
Merged revisions 3.x 5505,5526-5527,5535,5540,5542,5572,5616-5617,5656-5657,5671,5674,5683,5687-5688,5690,5698,5708-5709,5713-5716,5719-5723,5726,5728-5729,5736,5752,5754,5761,5774,5780,5784 -> trunk

most of these are user submitted patches! very cool.

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/VideoDisplay.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/resources/IResourceManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ToggleButtonBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Menu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Container.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/CalendarLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/skins/halo/ProgressIndeterminateSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemComboBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/NavBar.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="D">/flex/sdk/trunk/modules/compiler/FlexCompilerShell-license.txt</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DateField.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/DividedBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/formatters/DateFormatter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/FormItem.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridColumn.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/validators/PhoneNumberValidator.as</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/validators/NumberValidatorDomainType.as" copyfrom-rev="5784" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/validators/NumberValidatorDomainType.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/PopUpButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ToolTipManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/ObjectUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/validators/NumberValidator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/FocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/validators/CurrencyValidator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Form.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Label.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/CalendarLayoutChangeEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/DataGridEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/sliderClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/PopUpMenuButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Text.as</path>

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

--- frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
+++ frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
@@ -2724,9 +2724,20 @@
                 keyInteraction = false;
             }
             else
-            event.triggerEvent = new MouseEvent(MouseEvent.CLICK);
-            if (!isNaN(oldValue) && Math.abs(oldValue - value) > 0.002)
-                dispatchEvent(event);
+            {
+            	event.triggerEvent = new MouseEvent(MouseEvent.CLICK);
+            }
+
+            if (!isNaN(oldValue))
+            {
+            	if (Math.abs(oldValue - value) > 0.002)
+            		dispatchEvent(event)
+            }
+            // Handle case of changing from NaN to a valid value
+            else if (!isNaN(value))
+			{
+            	dispatchEvent(event);
+			}
         }

         invalidateDisplayList();


:memo:

:memo:

--- index.as
+++ index.as
@@ -1,7 +1,5 @@
-// [ ] Integer literals should have their own type with a name of `_`
 // [ ] Pass: Declare
 // [ ] Main!
-// [ ] Type determination on operators

 // let m: int8 = 3.12;
 // let m: float32 = 3 + 4.12;


Refresh attribute inspector only for script reload, not for other resources. Related to #1557.

--- bin/Data/Scripts/Editor.as
+++ bin/Data/Scripts/Editor.as
@@ -74,8 +74,8 @@
     ParseArguments();
     // Switch to real frame handler after initialization
     SubscribeToEvent("Update", "HandleUpdate");
-    SubscribeToEvent("ReloadFinished", "HandleReloadFinished");
-    SubscribeToEvent("ReloadFailed", "HandleReloadFailed");
+    SubscribeToEvent("ReloadFinished", "HandleReloadFinishOrFail");
+    SubscribeToEvent("ReloadFailed", "HandleReloadFinishOrFail");
     EditorSubscribeToEvents();
 }

@@ -148,14 +148,12 @@
     }
 }

-void HandleReloadFinished(StringHash eventType, VariantMap& eventData)
-{
-    attributesFullDirty = true;
-}
-
-void HandleReloadFailed(StringHash eventType, VariantMap& eventData)
-{
-    attributesFullDirty = true;
+void HandleReloadFinishOrFail(StringHash eventType, VariantMap& eventData)
+{
+    Resource@ res = cast<Resource>(GetEventSender());
+    // Only refresh inspector when reloading scripts (script attributes may change)
+    if (res !is null && (res.typeName == "ScriptFile" || res.typeName == "LuaFile"))
+        attributesFullDirty = true;
 }

 void LoadConfig()


Transferred from the Adobe Open Source Subversion Repository

Revision: 22359
Author:   hmuller@adobe.com
Date:     2011-09-01T18:34:59.680258Z

Log Message:
-----------
Removed an extraneous bit of code that was accidentally included in SVN 22358.

QE notes:
Doc notes:
Bugs:
Reviewer:
Tests run: checkin, mustella
Is noteworthy for integration: no

Modified Paths:
--------------
/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as

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

--- frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
@@ -1471,7 +1471,7 @@
         if (event.relatedObject)
         {
             var component:IUIComponent = getIUIComponent(event.relatedObject);
-            if (component && (component && editorOwns(component)))
+            if (component && editorOwns(component))
                 return;
         }


Transferred from the Adobe Open Source Subversion Repository

Revision: 9183
Author:   jszeto@adobe.com
Date:     2009-08-07T22:25:44.263850Z

Log Message:
-----------
Transform matrix bug fix

http://bugs.adobe.com/jira/browse/SDK-22390 - Color transform is incorrectly applied in MXML Graphics

For a component or graphic, specifying a transform without an explicit matrix declaration was overriding the convenience transform properties.

The new behavior is to only apply the transform’s matrix to the component or graphic if it was explicitly specified.

QE notes: Add test case
Doc notes: Explain that transform matrix will only apply if explicitly set
Bugs: SDK-22390
Reviewer: Glenn
Tests run: spark primitives
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/GraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/geom/Transform.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>

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

--- frameworks/projects/framework/src/mx/geom/Transform.as
+++ frameworks/projects/framework/src/mx/geom/Transform.as
@@ -66,6 +66,10 @@

     mx_internal var applyColorTransformAlpha:Boolean = false;

+    mx_internal var applyMatrix:Boolean = false;
+
+    mx_internal var applyMatrix3D:Boolean = false;
+
     /**
      *  @private
      */
@@ -129,6 +133,9 @@
             ILayoutElement(target).setLayoutMatrix(value, true);
         else
             super.matrix = value;
+
+        applyMatrix = value != null;
+        applyMatrix3D = false;
     }

     /**
@@ -150,6 +157,9 @@
             ILayoutElement(target).setLayoutMatrix3D(value, true);
         else
             super.matrix3D = value;
+
+        applyMatrix3D = value != null;
+        applyMatrix = false;
     }

     /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 17054
Author:   cframpto@adobe.com
Date:     2010-07-24T12:50:41.482333Z

Log Message:
-----------
PARB changes for DataGrid selection from signoff review

removed methods from DG
allSelectedCells()
allSelectedIndices()

these read-only properties have been added to DataGrid:
selectedCell
selectedCells
selectedIndex
selectedIndices
selectedItem
selectedItems
selectionLength

CellRegion counts changed from uint to int.

setSelectedIndices signature changed from Vector.<int> to startRowIndex, endRowIndex.

Peter noticed there were issues with the ASDoc for the new read-only properties in Grid - some were missing and some where in the methods section.  On Monday, after the ASdoc is built for this batch of changes I will investigate if it still looks wrong.

QE notes: API changes so expect some test breakage
Doc notes:
Bugs:
Reviewer: Hans
Tests run: none
Is noteworthy for integration: no

Modified Paths:
--------------
<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/CellRegion.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/Tree.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/GridContainerBase.as</path>

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

--- frameworks/projects/spark/src/spark/components/Grid.as
+++ frameworks/projects/spark/src/spark/components/Grid.as
@@ -2006,16 +2006,18 @@
         /**
          *  If selectionMode is GridSelectionMode.MULTIPLE_ROWS,
          *  sets the selection to the specfied rows and the caret position to
-         *  the last row in indices.
+         *  endRowIndex.
          *  For all other selection modes, this method has no effect.
          *
-         *
Each element in the Vector is an index in dataProvider
-         *  of an item to include in the selection.

-         *
-         *  @param rowIndices Vector of 0-based row indices to include in selection.
-         *
-         *  @return True if no errors, or false if any of the indices
-         *  are invalid or the selectionMode is invalid.
+         *
Each index represents an item in dataProvider
+         *  to include in the selection.

+         *
+         *  @param startRowIndex 0-based row index of the first row in the selection
+         *  @param endRowIndex 0-based row index of the last row in the selection
+         *
+         *  @return True if no errors, or false if any of the indices are invalid
+         *  or startRowIndex is not less than or equal to
+         *  endRowIndex or the selectionMode is invalid.
          *
          *  @see spark.components.Grid#dataProvider
          *
@@ -2024,12 +2026,13 @@
          *  @playerversion AIR 2.0
          *  @productversion Flex 4.5
          */
-        public function setSelectedIndices(rowIndices:Vector.<int>):Boolean
-        {
-            const selectionChanged:Boolean = gridSelection.setRows(rowIndices);
+        public function setSelectedIndices(startRowIndex:int, endRowIndex:int):Boolean
+        {
+            const selectionChanged:Boolean =
+                gridSelection.setRows(startRowIndex, endRowIndex);
             if (selectionChanged)
             {
-                caretRowIndex = rowIndices[rowIndices.length - 1];
+                caretRowIndex = endRowIndex;
                 caretColumnIndex = -1;

                 invalidateDisplayList()
@@ -2038,7 +2041,7 @@

             return selectionChanged;
         }
-
+
         //----------------------------------
         //  selection for cells
         //----------------------------------


Transferred from the Adobe Open Source Subversion Repository

Revision: 18031
Author:   klin@adobe.com
Date:     2010-10-06T18:01:29.650399Z

Log Message:
-----------
Enable column visibility to change at runtime. When column.visible is changed, it will cause the columns IList to dispatch a CollectionEventKind.UPDATE event for the Grid to handle. The Grid then fixes up GridDimensions and clears the layout cache.

Grid.as - Added columns_visibleChangedHandler which is called when the Grid gets an UPDATE event from the columns IList. It clears the columns that are changing and sets their typical and actual width to the correct values in gridDimensions.

GridColumn.as - visible property now dispatches a CollectionEvent on the columns IList.

GridDimensions.as, GridLayout.as, GridSelection.as - various small fixes to make this all work.

QE notes: No
Doc notes: No
Bugs: SDK-26843
Reviewer: Hans
Tests run: cyclone server
Is noteworthy for integration: No

Modified Paths:
--------------
<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/GridSelection.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/GridDimensions.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/GridColumn.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/GridLayout.as</path>

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

--- frameworks/projects/spark/src/spark/components/Grid.as
+++ frameworks/projects/spark/src/spark/components/Grid.as
@@ -27,6 +27,7 @@
 import mx.events.CollectionEvent;
 import mx.events.CollectionEventKind;
 import mx.events.FlexEvent;
+import mx.events.PropertyChangeEvent;
 import mx.utils.ObjectUtil;

 import spark.components.supportClasses.CellPosition;
@@ -756,7 +757,7 @@
         const newColumns:IList = _columns;
         if (newColumns)
         {
-            newColumns.addEventListener(CollectionEvent.COLLECTION_CHANGE, columns_collectionChangeHandler, false, 0, true);
+            newColumns.addEventListener(CollectionEvent.COLLECTION_CHANGE, columns_collectionChangeHandler, false, 0, true);
             for (index = 0; index < newColumns.length; index++)
             {
                 var newColumn:GridColumn = GridColumn(newColumns.getItemAt(index));
@@ -3671,6 +3672,25 @@

             case CollectionEventKind.UPDATE:
             {
+                // column may have changed visiblity
+                const itemsLength:int = event.items.length;
+                var itemsLeft:int = count;
+                var pcEvent:PropertyChangeEvent;
+
+                for (i = 0; i < itemsLength; i++)
+                {
+                    pcEvent = event.items[i] as PropertyChangeEvent;
+                    if (pcEvent && pcEvent.property == "visible")
+                    {
+                        columns_visibleChangedHandler(pcEvent);
+                        itemsLeft--;
+                    }
+                }
+
+                // return if all were visible property changes
+                if (itemsLeft == 0)
+                    return;
+
                 break;
             }

@@ -3739,6 +3759,47 @@
         invalidateDisplayList();
     }

+    /**
+     *  @private
+     */
+    private function columns_visibleChangedHandler(event:PropertyChangeEvent):void
+    {
+        const column:GridColumn = event.source as GridColumn;
+        const columnIndex:int = columns.getItemIndex(column);
+        if (!column || columnIndex == -1)
+            return;
+
+        // Fix up gridDimensions
+        if (gridDimensions)
+        {
+            gridDimensions.clearColumns(columnIndex, 1);
+
+            // column.visible==true columns need to have their typical sizes and
+            // actual column width updated, while column.visible==false column
+            // have their typical sizes updated to 0 and actual column width
+            // set to NaN.
+            if (column.visible)
+            {
+                gridDimensions.setTypicalCellWidth(columnIndex, NaN);
+                gridDimensions.setTypicalCellHeight(columnIndex, NaN);
+                if (!isNaN(column.width))
+                    gridDimensions.setColumnWidth(columnIndex, column.width);
+            }
+            else
+            {
+                gridDimensions.setTypicalCellWidth(columnIndex, 0);
+                gridDimensions.setTypicalCellHeight(columnIndex, 0);
+                gridDimensions.setColumnWidth(columnIndex, NaN);
+            }
+        }
+
+        // Clear out gridLayout
+        gridLayout.clearVirtualLayoutCache();
+
+        invalidateSize();
+        invalidateDisplayList();
+    }
+
     //--------------------------------------------------------------------------
     //
     //  Methods


Transferred from the Adobe Open Source Subversion Repository

Revision: 8020
Author:   dsubrama@adobe.com
Date:     2009-06-19T23:02:54.776054Z

Log Message:
-----------
Fallout from PARB changes - addressing 3 issues:

1.) http://bugs.adobe.com/jira/browse/SDK-21873 - Fixed
2.) missed PARB requested change, adjustSelectedIndex()/adjustSelectedIndices() are collapsed into a single method, adjustSelection()
3.) Excellent catch from Evtim - selectedIndices is now a Vector of ints instead of a Vector of Numbers (the PARB rename list had the right change!). Selection indices are always non-fractional, so we can get a slight savings by making this a Vector of ints.

QA: Yes - you'll need to update tests for point #3, and if you worked off the PARB rename list, then you shouldn't have to update for #2, otherwise you do.
Doc: Yes
Checkintests: Pass, as well as List/DDL mustella tests (except for 11 List tests that need selectedIndices to be changed from Vector.<Number> to Vector.<int>)
Reviewer: Evtim

Modified Paths:
--------------
<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/supportClasses/ListBase.as</path>

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

--- frameworks/projects/spark/src/spark/components/List.as
+++ frameworks/projects/spark/src/spark/components/List.as
@@ -223,13 +223,13 @@
      *  @private
      *  Internal storage for the selectedIndices property and invalidation variables.
      */
-    private var _selectedIndices:Vector.<Number>;
-    private var _proposedSelectedIndices:Vector.<Number> = new Vector.<Number>();
+    private var _selectedIndices:Vector.<int>;
+    private var _proposedSelectedIndices:Vector.<int> = new Vector.<int>();
     private var multipleSelectionChanged:Boolean;

     [Bindable("change")]
     /**
-     *  A Vector of Numbers representing the indices of the currently selected
+     *  A Vector of ints representing the indices of the currently selected
      *  item or items. If multiple selection is disabled by setting
      *  allowMultipleSelection to false, and this property
      *  is set, the data item corresponding to the first index in the Vector is selected.
@@ -241,7 +241,7 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function get selectedIndices():Vector.<Number>
+    public function get selectedIndices():Vector.<int>
     {
         return _selectedIndices;
     }
@@ -249,7 +249,7 @@
     /**
      *  @private
      */
-    public function set selectedIndices(value:Vector.<Number>):void
+    public function set selectedIndices(value:Vector.<int>):void
     {
         if (_proposedSelectedIndices == value)
             return;
@@ -295,11 +295,11 @@
      */
     public function set selectedItems(value:Vector.<Object>):void
     {
-        var indices:Vector.<Number>;
+        var indices:Vector.<int>;

         if (value)
         {
-            indices = new Vector.<Number>();
+            indices = new Vector.<int>();

             var count:int = value.length;

@@ -307,14 +307,14 @@
             {
                 //TODO (dsubrama) What exactly should we do if an
                 //invalid item is in the selectedItems vector?
-                var index:Number = dataProvider.getItemIndex(value[i]);
+                var index:int = dataProvider.getItemIndex(value[i]);
                 if (index != -1)
                 {
                     indices[i] = index;
                 }
                 if (index == -1)
                 {
-                    indices = new Vector.<Number>();
+                    indices = new Vector.<int>();
                     break;
                 }
             }
@@ -398,8 +398,11 @@
         // vector of 1 entry. If its not, we pare it down and select the
         // first item.
         if (!allowMultipleSelection && !isEmpty(_proposedSelectedIndices))
-            _proposedSelectedIndices = new Vector.<Number>(_proposedSelectedIndices[0]);
-
+        {
+            var temp:Vector.<int> = new Vector.<int>();
+            temp.push(_proposedSelectedIndices[0]);
+            _proposedSelectedIndices = temp;
+        }
         // Keep _proposedSelectedIndex in-sync with multiple selection properties.
         if (!isEmpty(_proposedSelectedIndices))
            _proposedSelectedIndex = getLastItemValue(_proposedSelectedIndices);
@@ -454,8 +457,8 @@
      */
     protected function commitMultipleSelection():void
     {
-        var removedItems:Vector.<Number> = new Vector.<Number>();
-        var addedItems:Vector.<Number> = new Vector.<Number>();
+        var removedItems:Vector.<int> = new Vector.<int>();
+        var addedItems:Vector.<int> = new Vector.<int>();
         var i:int;
         var count:int;

@@ -512,7 +515,7 @@
         // Commit the selected indices and put _proposedSelectedIndices
         // back to its default value.
         _selectedIndices = _proposedSelectedIndices;
-        _proposedSelectedIndices = new Vector.<Number>();
+        _proposedSelectedIndices = new Vector.<int>();
     }

     /**
@@ -593,7 +596,7 @@
      */
     override protected function itemAdded(index:int):void
     {
-        adjustSelectedIndices(index, true);
+        adjustSelection(index, true);
     }

     /**
@@ -602,7 +605,7 @@
      */
     override protected function itemRemoved(index:int):void
     {
-        adjustSelectedIndices(index, false);
+        adjustSelection(index, false);
     }

     //--------------------------------------------------------------------------
@@ -617,7 +620,7 @@
      *  selection, this is just selectedIndex. In multiple
      *  selection, this is the index of the first selected item.
      */
-    private function getFirstSelectedIndex():Number
+    private function getFirstSelectedIndex():int
     {
         if (selectedIndices && selectedIndices.length > 0)
             return selectedIndices[0];
@@ -630,7 +633,7 @@
      *  Given a Vector, returns the value of the last item,
      *  or -1 if there are no items in the Vector;
      */
-    private function getLastItemValue(v:Vector.<Number>):Number
+    private function getLastItemValue(v:Vector.<int>):int
     {
         if (v && v.length > 0)
             return v[v.length - 1];
@@ -642,7 +645,7 @@
      *  @private
      *  Returns true if v is null or an empty Vector.
      */
-    private function isEmpty(v:Vector.<Number>):Boolean
+    private function isEmpty(v:Vector.<int>):Boolean
     {
         return v == null || v.length == 0;
     }
@@ -652,10 +655,10 @@
      *  Taking into account which modifier keys were clicked, the new
      *  selectedIndices interval is calculated.
      */
-    private function calculateSelectedIndicesInterval(renderer:IVisualElement, shiftKey:Boolean, ctrlKey:Boolean):Vector.<Number>
+    private function calculateSelectedIndicesInterval(renderer:IVisualElement, shiftKey:Boolean, ctrlKey:Boolean):Vector.<int>
     {
         var i:int;
-        var interval:Vector.<Number> = new Vector.<Number>();
+        var interval:Vector.<int> = new Vector.<int>();
         var index:Number = dataGroup.getElementIndex(renderer);

         if (!shiftKey)
@@ -670,9 +673,12 @@
                     {
                         // We need to respect requireSelection
                         if (!requireSelection)
-                            return new Vector.<Number>();
+                            return interval;
                         else
-                            return new Vector.<Number>()(selectedIndices[0]);
+                        {
+                            interval.push(selectedIndices[0]);
+                            return interval;
+                        }
                     }
                     else
                     {
@@ -698,19 +704,25 @@
                     }
                 }
                 // Ctrl+click with no previously selected items
-                else
-                    return new Vector.<Number>(index);
+                else
+                {
+                    interval.push(index);
+                    return interval;
+                }
             }
             // A single item was newly selected, add that to the selection interval.
             else
-                return new Vector.<Number>(index);
+            {
+                interval.push(index);
+                return interval;
+            }
         }
         else // shiftKey
         {
             // A contiguous selection action has occurred. Figure out which new
             // indices to add to the selection interval and return that.
-            var start:Number = (!isEmpty(selectedIndices)) ? selectedIndices[0] : 0;
-            var end:Number = index;
+            var start:int = (!isEmpty(selectedIndices)) ? selectedIndices[0] : 0;
+            var end:int = index;
             if (start < end)
             {
                 for (i = start; i <= end; i++)
@@ -837,11 +849,11 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    protected function adjustSelectedIndices(index:int, add:Boolean):void
+    override protected function adjustSelection(index:int, add:Boolean=false):void
     {
         var i:int;
         var curr:Number;
-        var newInterval:Vector.<Number> = new Vector.<Number>();
+        var newInterval:Vector.<int> = new Vector.<int>();
         var e:IndexChangedEvent;

         if (selectedIndex == NO_SELECTION || doingWholesaleChanges)
@@ -850,7 +862,8 @@
             // selected and careted because requireSelection is true.
             if (dataProvider && dataProvider.length == 1 && requireSelection)
             {
-                _selectedIndices = new Vector.<Number>(0);
+                newInterval.push(0);
+                _selectedIndices = newInterval;
                 _selectedIndex = 0;
                 itemShowingCaret(0, true);
                 // If the selection properties have been adjusted to account for items that
@@ -904,7 +917,7 @@
                 //Removing the last item
                 if (dataProvider.length == 0)
                 {
-                    newInterval = new Vector.<Number>();
+                    newInterval = new Vector.<int>();
                 }
                 else if (index == 0)
                 {
@@ -917,7 +930,7 @@
                 }
                 else
                 {
-                    newInterval = new Vector.<Number>(0);
+                    newInterval.push(0);
                 }
             }
             else
@@ -962,7 +975,7 @@
             invalidateProperties();
         }

-        var oldIndices:Vector.<Number> = selectedIndices;
+        var oldIndices:Vector.<int> = selectedIndices;
         _selectedIndices = newInterval;
         _selectedIndex = getLastItemValue(newInterval);
         // If the selection has actually changed, trigger a pass to
@@ -1122,7 +1135,7 @@
         if (allowMultipleSelection && event.shiftKey && selectedIndices)
         {
             var startIndex:Number = getFirstSelectedIndex();
-            var newInterval:Vector.<Number> = new Vector.<Number>();
+            var newInterval:Vector.<int> = new Vector.<int>();
             var i:int;
             if (startIndex <= proposedNewIndex)
             {


Transferred from the Adobe Open Source Subversion Repository

Revision: 7910
Author:   egeorgie@adobe.com
Date:     2009-06-17T01:41:55.138890Z

Log Message:
-----------
P-ARB changes:

* IGraphicElement sharedIndex -> DisplayObjectSharingMode
* ScrollUnit -> NavigationUnit
* LayoutBase.getDestinationIndex -> LayoutBase.getNavigationDestinationIndex, param order reversed!!!!
* mouseOpaque -> mouseEnabledWhereTransparent
* various other small renames and changes to non-public APIs

Doc Notes: None
Bugs: N/A
Reviewer: Deepa
tests: checkintests

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Scroller.as</path>
<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/primitives/supportClasses/GraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/layouts/WheelLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/DropDownList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/fxg/FlexFXG2SWFTranscoder.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/InvalidatingSprite.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/HScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/core/IViewport.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/supportClasses/TextGraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Group.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/core/ScrollUnit.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/core/NavigationUnit.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/core/IGraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableDataContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/TileLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableContainer.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/layouts/supportClasses/LayoutBase.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/core/DisplayObjectSharingMode.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/VerticalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>

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

--- frameworks/projects/spark/src/spark/components/List.as
+++ frameworks/projects/spark/src/spark/components/List.as
@@ -705,8 +705,7 @@
             else
                 return [index];
         }
-
-        else (shiftKey)
+        else // shiftKey
         {
             // A contiguous selection action has occurred. Figure out which new
             // indices to add to the selection interval and return that.
@@ -968,46 +967,7 @@
             invalidateProperties();
         }
     }
-
-    /**
-     *  @private
-     *  Used by keyDownHandler to map the keyboard events
-     *  to NavigationUnit. The NavigationUnit values are passed to the
-     *  layout to figure out what the new item in focus is based on
-     *  the current item in focus.
-     *
-     *  Override to add custom event to NavigationUnit mapping.
-     *
-     *  @param event The user input event.
-     *  @return Returns the NavigationUnit value that corresponds to the event.
-     *
-     *  @see spark.core.NavigationUnit
-     *  @see spark.layouts.LayoutBase#getDestinationIndex
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    protected function mapEventToNavigationUnit(event:Event):uint
-    {
-        if (!(event is KeyboardEvent))
-            return NavigationUnit.NONE;
-
-        switch (KeyboardEvent(event).keyCode)
-        {
-            case Keyboard.LEFT:         return NavigationUnit.LEFT;
-            case Keyboard.RIGHT:        return NavigationUnit.RIGHT;
-            case Keyboard.UP:           return NavigationUnit.UP;
-            case Keyboard.DOWN:         return NavigationUnit.DOWN;
-            case Keyboard.PAGE_UP:      return NavigationUnit.PAGE_UP;
-            case Keyboard.PAGE_DOWN:    return NavigationUnit.PAGE_DOWN;
-            case Keyboard.HOME:         return NavigationUnit.HOME;
-            case Keyboard.END:          return NavigationUnit.END;
-            default:                    return NavigationUnit.NONE;
-        }
-    }
-
+
     /**
      *  Tries to find the next item in the data provider that
      *  starts with the character in the eventCode parameter.
@@ -1110,8 +1070,6 @@
     {
         super.keyDownHandler(event);

-        var navigationUnit:uint = mapEventToNavigationUnit(event);
-
         if (!dataProvider || !layout)
             return;

@@ -1131,13 +1089,14 @@
         }

         // Some unrecognized key stroke was entered, return.
-        if (navigationUnit == NavigationUnit.NONE)
+        var navigationUnit:uint = event.keyCode;
+        if (!NavigationUnit.isNavigationUnit(event.keyCode))
             return;

         // Delegate to the layout to tell us what the next item is we should select or focus into.
         // TODO (jszeto) At some point we should refactor this so we don't depend on layout
         // for keyboard handling. If layout doesn't exist, then use some other keyboard handler
-        var proposedNewIndex:int = layout.getDestinationIndex(navigationUnit, caretIndex);
+        var proposedNewIndex:int = layout.getNavigationDestinationIndex(caretIndex, navigationUnit);

         // TODO (jszeto) proposedNewIndex depends on CTRL key
         // move CTRL key logic into single selection


JAnim.as edited online with Bitbucket

JAnim.as edited online with Bitbucket

--- client/Anim/src/com/genome2d/components/renderables/jointanim/JAnim.as
+++ client/Anim/src/com/genome2d/components/renderables/jointanim/JAnim.as
@@ -99,17 +99,16 @@

 		public static function HelpCallInitialize():void
 		{
-			var _local1:int;
 			if (!bInit)
 			{
 				_helpCallTransform.fixed = true;
 				_helpCallColor.fixed = true;
-				_local1 = 0;
-				while (_local1 < 1000)
-				{
-					_helpCallTransform[_local1] = new JATransform();
-					_helpCallColor[_local1] = new JAColor();
-					_local1++;
+				var i:int = 0;
+				while (i < 1000)
+				{
+					_helpCallTransform[i] = new JATransform();
+					_helpCallColor[i] = new JAColor();
+					i++;
 				}

 				bInit = true;
@@ -1055,7 +1054,7 @@
 			{
 				_local14 = (theSpriteInst.spriteDef.workAreaDuration - 1);
 			}
-			;
+
 			var _local15:JATransform = _helpCallTransform[_helpCallDepth];
 			var _local4:JAColor = _helpCallColor[_helpCallDepth];
 			_helpCallDepth++;
@@ -1073,12 +1072,12 @@
 					{
 						_local19 = theSpriteInst.spriteDef.frames[((theSpriteInst.frameNum + (((_local10) == 0) ? _local14 : (((_local10) == 1) ? _local16 : _local13))) % theSpriteInst.spriteDef.frames.length)];
 					}
-					;
+
 					if (_local11.hasStop)
 					{
 						_local19 = _local11;
 					}
-					;
+
 					if (_local19.frameObjectPosVector.length > theObjectPosIdx)
 					{
 						_helpANextObjectPos[_local10] = _local19.frameObjectPosVector[theObjectPosIdx];
@@ -1086,9 +1085,8 @@
 						{
 							_helpANextObjectPos[_local10] = null;
 						}
-						;
-					}
-					;
+					}
+
 					if (_helpANextObjectPos[_local10] == null)
 					{
 						_local8 = 0;
@@ -1099,15 +1097,14 @@
 								_helpANextObjectPos[_local10] = _local19.frameObjectPosVector[_local8];
 								break;
 							}
-							;
+
 							_local8++;
 						}
-						;
-					}
-					;
+					}
+
 					_local10++;
 				}
-				;
+
 				if (_helpANextObjectPos[1] != null)
 				{
 					_local9 = (theSpriteInst.frameNum - Math.floor(theSpriteInst.frameNum));
@@ -1120,14 +1117,13 @@
 					_local15.clone(_local12.transform);
 					_local4.clone(_local12.color);
 				}
-				;
 			}
 			else
 			{
 				_local15.clone(_local12.transform);
 				_local4.clone(_local12.color);
 			}
-			;
+
 			_local15.matrix = JAMatrix3.MulJAMatrix3(_local5.transform, _local15.matrix, _local15.matrix);
 			if (((((_local5.isBlending) && (!((_blendTicksTotal == 0))))) && ((theSpriteInst == _mainSpriteInst))))
 			{
@@ -1135,7 +1131,7 @@
 				_local15 = _local5.blendSrcTransform.InterpolateTo(_local15, _local9, _local15);
 				_local4.Set((((_local5.blendSrcColor.red * (1 - _local9)) + (_local4.red * _local9)) + 0.5), (((_local5.blendSrcColor.green * (1 - _local9)) + (_local4.green * _local9)) + 0.5), (((_local5.blendSrcColor.blue * (1 - _local9)) + (_local4.blue * _local9)) + 0.5), (((_local5.blendSrcColor.alpha * (1 - _local9)) + (_local4.alpha * _local9)) + 0.5));
 			}
-			;
+
 			_helpCalcTransform = _local15;
 			_helpCalcColor = _local4;
 			_helpANextObjectPos[0] = null;


adding line that was mistakenly removed in previous commit

Change-Id: Icf6cda22e5c8d161f7cd2f2f5f22fba6ce6eab3c

--- WeaveUISpark/src/weave/visualization/plotters/AnchorPlotter.as
+++ WeaveUISpark/src/weave/visualization/plotters/AnchorPlotter.as
@@ -40,6 +40,7 @@
 	import weave.core.LinkableNumber;
 	import weave.data.AttributeColumns.BinnedColumn;
 	import weave.data.AttributeColumns.ColorColumn;
+	import weave.data.BinningDefinitions.CategoryBinningDefinition;
 	import weave.data.KeySets.KeySet;
 	import weave.primitives.Bounds2D;
 	import weave.primitives.ColorRamp;
@@ -197,6 +198,7 @@
 					var classStr:String = getClassFromAnchor(key.localName);
 					var cc:ColorColumn = Weave.defaultColorColumn;
 					var binColumn:BinnedColumn = cc.getInternalColumn() as BinnedColumn;
+					binColumn.binningDefinition.requestLocalObject(CategoryBinningDefinition, false)
 					var binIndex:int = binColumn.getBinIndexFromDataValue(classStr);
 					var color:Number = cc.ramp.getColorFromNorm(binIndex / (binColumn.numberOfBins - 1));
 					if (isFinite(color))


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

--- frameworks/projects/airframework/src/mx/events/AIREvent.as
+++ frameworks/projects/airframework/src/mx/events/AIREvent.as
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.events
+{
+
+import flash.events.Event;
+
+/**
+ *  The AIREvent class represents the event object passed to
+ *  the event listener for several AIR-specific events.
+ */
+public class AIREvent extends Event
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class constants
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Dispatched when this application gets activated.
+     *
+     *  @eventType applicationActivate
+     */
+    public static const APPLICATION_ACTIVATE:String = "applicationActivate";
+
+    /**
+     *  Dispatched when this application gets deactivated.
+     *
+     *  @eventType applicationDeactivate
+     */
+    public static const APPLICATION_DEACTIVATE:String = "applicationDeactivate";
+
+    /**
+     *  Dispatched when the Window or WindowedApplication becomes visible
+     *  after completing its initial layout
+     *
+     *  @eventType windowComplete
+     */
+    public static const WINDOW_COMPLETE:String = "windowComplete";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param type The event type; indicates the action that caused the event.
+     *
+     *  @param bubbles Specifies whether the event can bubble up
+     *  the display list hierarchy.
+     *
+     *  @param cancelable Specifies whether the behavior
+     *  associated with the event can be prevented.
+     */
+    public function AIREvent(type:String, bubbles:Boolean = false,
+                             cancelable:Boolean = false)
+    {
+        super(type, bubbles, cancelable);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods: Event
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override public function clone():Event
+    {
+        return new AIREvent(type, bubbles, cancelable);
+    }
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 2626
Author:   jimurphy@adobe.com
Date:     2008-07-25T14:36:32.076927Z

Log Message:
-----------
Merged 3.0.x revisions [2615,2620] -> trunk

Modified Paths:
--------------
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/swfutils/src/java/flash/swf/TagDecoder.java</path>

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

--- frameworks/projects/framework/src/mx/controls/SWFLoader.as
+++ frameworks/projects/framework/src/mx/controls/SWFLoader.as
@@ -320,6 +320,7 @@
         tabEnabled = false;

         addEventListener(FlexEvent.INITIALIZE, initializeHandler);
+        addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);

         showInAutomationHierarchy = false;
     }
@@ -1890,6 +1891,13 @@
             if (_autoLoad)
                 load(_source);
         }
+	}
+
+    /**
+     *  @private
+     */
+    private function addedToStageHandler(event:Event):void
+    {
         ISystemManager2(systemManager).getSandboxRoot().addEventListener(MarshalEvent.DRAG_MANAGER,
                 mouseShieldHandler, false, 0, true);
     }


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

--- frameworks/projects/framework/src/mx/core/RSLListLoader.as
+++ frameworks/projects/framework/src/mx/core/RSLListLoader.as
@@ -0,0 +1,265 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+
+import flash.events.IEventDispatcher;
+import flash.events.Event;
+
+[ExcludeClass]
+
+/**
+ *  @private
+ *  Utility class for loading a list of RSLs.
+ *
+ *
A list of cross-domain RSLs and a list of regular RSLs
+ *  can be loaded using this utility.

+ */
+public class RSLListLoader
+{
+    include "../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param rslList Array of RSLs to load.
+	 *  Each entry in the array is of type RSLItem or CdRSLItem.
+     *  The RSLs will be loaded from index 0 to the end of the array.
+     */
+    public function RSLListLoader(rslList:Array)
+    {
+    	super();
+        this.rslList = rslList;
+    }
+
+	//--------------------------------------------------------------------------
+	//
+	//  Variables
+	//
+	//--------------------------------------------------------------------------
+
+    /**
+	 *  @private
+	 *  The index of the RSL being loaded.
+	 */
+	private var currentIndex:int = 0;
+
+    /**
+	 *  @private
+	 *  The list of RSLs to load.
+	 *  Each entry is of type RSLNode or CdRSLNode.
+	 */
+	private var rslList:Array = [];
+
+    /**
+	 *  @private
+	 *  Supplied by caller.
+	 */
+	private var chainedProgressHandler:Function;
+
+    /**
+	 *  @private
+	 *  Supplied by caller.
+	 */
+	private var chainedCompleteHandler:Function;
+
+    /**
+	 *  @private
+	 *  Supplied by caller.
+	 */
+	private var chainedIOErrorHandler:Function;
+
+    /**
+	 *  @private
+	 *  Supplied by caller.
+	 */
+	private var chainedSecurityErrorHandler:Function;
+
+    /**
+	 *  @private
+	 *  Supplied by caller.
+	 */
+	private var chainedRSLErrorHandler:Function;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Methods
+	//
+	//--------------------------------------------------------------------------
+
+    /**
+     *  Loads the RSLs in this list object.
+     *
+     *
This function accepts listeners to observe events
+	 *  that result from loading an RSL.
+     *  The function must be of the form required by a listener function
+     *  passed to IEventDispatcher.addEventListener();
+     *
+     *  When an event is received, the RSL that generated
+	 *  this event can be found by calling
+	 *  rslListLoader.getItem(getIndex());

+     *
+     *  @param progressHandler Receives ProgressEvent.PROGRESS events.
+	 *  May be null.
+	 *
+     *  @param completeHandler Receives Event.COMPLETE events.
+	 *  May be null.
+	 *
+     *  @param ioErrorHandler Receives IOErrorEvent.IO_ERROR events.
+	 *  May be null.
+	 *
+     *  @param securityErrorHandler
+	 *  Receives SecurityErrorEvent.SECURITY_ERROR events.
+	 *  May be null.
+	 *
+     *  @param rslErrorHandler Receives RSLEvent.RSL_ERROR events.
+	 *  May be null.
+     */
+ 	public function load(progressHandler:Function,
+	                     completeHandler:Function,
+	                     ioErrorHandler:Function,
+	                     securityErrorHandler:Function,
+	                     rslErrorHandler:Function):void
+    {
+    	chainedProgressHandler = progressHandler;
+	    chainedCompleteHandler = completeHandler;
+	    chainedIOErrorHandler = ioErrorHandler;
+	    chainedSecurityErrorHandler = securityErrorHandler;
+	    chainedRSLErrorHandler = rslErrorHandler;
+
+	    currentIndex = -1; // so first loaded item will be index 0
+	    loadNext();
+
+    }
+
+    /**
+     *  Increments the current index and loads the next RSL.
+     */
+    private function loadNext():void
+    {
+        if (!isDone())
+        {
+            currentIndex++;
+
+	        // Load the current RSL.
+	        if (currentIndex < rslList.length)
+	        {
+	            // Load rsl and have the RSL loader chain the
+	            // events our internal events handler or the chained
+	            // events handler if we don't care about them.
+	            rslList[currentIndex].load(chainedProgressHandler,
+	                                       listCompleteHandler,
+	                                       listIOErrorHandler,
+	                                       listSecurityErrorHandler,
+	                                       chainedRSLErrorHandler);
+	        }
+        }
+    }
+
+
+    /**
+     *  Gets an RSL from the list of RSLs.
+     *
+     *  @param index A zero-based index into the list of RSLs.
+     *
+     *  @return The current item at index in the list,
+	 *  or null if there is no item at that index.
+     */
+    public function getItem(index:int):RSLItem
+    {
+        if (index < 0 || index >= rslList.length)
+            return null;
+
+        return rslList[index];
+    }
+
+
+    /**
+     *  Gets the index of the currently loading RSL.
+     *
+     *  @return The index of the currently loading RSL.
+     */
+    public function getIndex():int
+    {
+        return currentIndex;
+    }
+
+
+   /**
+    *  Gets the total number of RSLs in this object.
+	*  When the load() method is called the RSLs will be loaded.
+    *
+    *  @return The total number of RSLs in this object
+    */
+    public function getItemCount():int
+    {
+        return rslList.length;
+    }
+
+    /**
+     *  Tests if all the RSLs are done loading.
+     *
+     *  @return true if all the RSLs have been loaded,
+	 *  false otherwise.
+     */
+    public function isDone():Boolean
+    {
+        return currentIndex >= rslList.length;
+    }
+
+	//--------------------------------------------------------------------------
+	//
+	//  Event handlers
+	//
+	//--------------------------------------------------------------------------
+
+    /**
+	 *  @private
+	 */
+	private function listCompleteHandler(event:Event):void
+    {
+        // Pass event to external listener.
+        if (chainedCompleteHandler != null)
+            chainedCompleteHandler(event);
+
+        // Load the next RSL.
+        loadNext();
+    }
+
+    /**
+	 *  @private
+	 */
+    private function listIOErrorHandler(event:Event):void
+    {
+        // Pass event to external listener.
+        if (chainedIOErrorHandler != null)
+            chainedIOErrorHandler(event);
+    }
+
+    /**
+	 *  @private
+	 */
+    private function listSecurityErrorHandler(event:Event):void
+    {
+        // Pass event to external listener.
+        if (chainedSecurityErrorHandler != null)
+            chainedSecurityErrorHandler(event);
+    }
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

--- frameworks/projects/framework/src/mx/events/ResizeEvent.as
+++ frameworks/projects/framework/src/mx/events/ResizeEvent.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2005-2006 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////