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

--- frameworks/projects/rpc/src/mx/rpc/wsdl/WSDL.as
+++ frameworks/projects/rpc/src/mx/rpc/wsdl/WSDL.as
@@ -0,0 +1,1229 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2006-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.rpc.wsdl
+{
+
+import mx.logging.ILogger;
+import mx.logging.Log;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+import mx.rpc.Fault;
+import mx.rpc.soap.SOAPConstants;
+import mx.rpc.xml.QualifiedResourceManager;
+import mx.rpc.xml.Schema;
+import mx.rpc.xml.SchemaConstants;
+import mx.rpc.xml.SchemaManager;
+
+[ResourceBundle("rpc")]
+
+[ExcludeClass]
+
+/**
+ * Manages a WSDL top-level definitions element. WSDL definitions
+ * may contain imports to other WSDL definitions. Only SOAP bindings are
+ * supported.
+ *
+ * @private
+ */
+public class WSDL
+{
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     * Constructs a WSDL from XML. Services and their operations are
+     * parsed into object representations on the first call to
+     * getService(), getPort() or
+     * getOperation().
+     *
+     * @param xml An XML document starting from the top-level WSDL
+     * defintions element.
+     */
+    public function WSDL(xml:XML)
+    {
+        super();
+        _xml = xml;
+        _log = Log.getLogger("mx.rpc.wsdl.WSDL");
+        processNamespaces();
+        processSchemas();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var resourceManager:IResourceManager =
+									ResourceManager.getInstance();
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    //
+    //--------------------------------------------------------------------------
+
+    public function get schemaManager():SchemaManager
+    {
+        if (_schemaManager == null)
+        {
+            _schemaManager = new SchemaManager();
+            _schemaManager.schemaConstants = schemaConstants;
+        }
+
+        return _schemaManager;
+    }
+
+    public function get schemaConstants():SchemaConstants
+    {
+        if (_schemaConstants == null)
+            _schemaConstants = SchemaConstants.getConstants(xml);
+
+        return _schemaConstants;
+    }
+
+    public function get soapConstants():SOAPConstants
+    {
+        if (_soapConstants == null)
+            _soapConstants = SOAPConstants.getConstants(xml);
+
+        return _soapConstants;
+    }
+
+    public function get targetNamespace():Namespace
+    {
+        return _targetNamespace;
+    }
+
+    public function get wsdlConstants():WSDLConstants
+    {
+        if (_wsdlConstants == null)
+            _wsdlConstants = WSDLConstants.getConstants(xml);
+
+        return _wsdlConstants;
+    }
+
+    /**
+     * The raw XML representing the WSDL starting from the top-level
+     * definitions element.
+     */
+    public function get xml():XML
+    {
+        return _xml;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /*
+        FIXME:
+        1. Validate that the targetNamespace matches the one defined on the
+           import XML
+        2. Also, check that the import being added does not cause a cyclic
+           relationship.
+    */
+    public function addImport(targetNamespace:Namespace, wsdl:WSDL):void
+    {
+        if (importsManager == null)
+            importsManager = new QualifiedResourceManager();
+
+        importsManager.addResource(targetNamespace, wsdl);
+    }
+
+    public function addSchema(schema:Schema):void
+    {
+        schemaManager.addSchema(schema);
+    }
+
+    public function getOperation(operationName:String, serviceName:String = null, portName:String = null):WSDLOperation
+    {
+        var port:WSDLPort = getPort(serviceName, portName);
+        var binding:WSDLBinding = port.binding;
+        var portType:WSDLPortType = binding.portType;
+        var operation:WSDLOperation = portType.getOperation(operationName);
+        return operation;
+    }
+
+    /**
+     * Locate a port for a service by name. If a serviceName is provided, a
+     * service is first located, otherwise the first service is used by default.
+     * Once a service has been selected, the search then considers the port.
+     * If a portName is not provided, the first port is used by default.
+     */
+    public function getPort(serviceName:String = null, portName:String = null):WSDLPort
+    {
+        var port:WSDLPort;
+
+        var service:WSDLService = getService(serviceName, portName);
+        if (service != null)
+        {
+            if (portName == null)
+                port = service.defaultPort;
+            else
+                port = service.getPort(portName);
+        }
+
+        if (port == null)
+        {
+			var message:String = resourceManager.getString(
+				"rpc", "noServiceAndPort", [ serviceName, portName ]);
+            throw new Fault("Client.NoSuchPort", message);
+        }
+
+        return port;
+    }
+
+    /**
+     * Search for WSDL service and port by name. If a serviceName is not
+     * provided the first service found will be selected by default.
+     */
+    public function getService(serviceName:String = null, portName:String = null):WSDLService
+    {
+        var service:WSDLService;
+        var port:WSDLPort;
+
+        if (serviceMap != null && serviceName != null)
+        {
+            service = serviceMap[serviceName];
+            if (service != null)
+            {
+                if (portName != null)
+                    port = service.getPort(portName);
+
+                if (port == null)
+                {
+                    var tempService:WSDLService = parseService(serviceName, portName);
+                    for each (var p:WSDLPort in tempService.ports)
+                    {
+                        service.addPort(p);
+                    }
+                }
+            }
+        }
+
+        // We didn't find a service, so we parse to find one...
+        if (service == null)
+        {
+            service = parseService(serviceName, portName);
+
+			var message:String;
+			var detail:String;
+
+            if (service != null)
+            {
+                if (serviceMap == null)
+                    serviceMap = {};
+
+                serviceMap[service.name] = service;
+            }
+            else if (serviceName != null)
+            {
+				message = resourceManager.getString(
+					"rpc", "noSuchServiceInWSDL", [ serviceName ]);
+                throw new Fault("Client.NoSuchService", message);
+            }
+            else
+            {
+				message = resourceManager.getString(
+					"rpc", "noServiceElement");
+				detail = resourceManager.getString(
+					"rpc", "noServiceElement.details", [ "" ]);
+                throw new Fault("Server.NoServicesInWSDL", message, detail);
+            }
+        }
+
+        return service;
+    }
+
+    public function getTypes(targetNamespace:Namespace):XML
+    {
+        var types:XML;
+
+        // First, check current WSDL for types element
+        var typesXMLList:XMLList = xml.elements(wsdlConstants.typesQName);
+        if (typesXMLList.length() > 0)
+        {
+            // There should only be one types element.
+            types = typesXMLList[0];
+        }
+        else if (importsManager != null)
+        {
+            // Check WSDL imports for types element
+            var imports:Array = importsManager.getResourcesForNamespace(targetNamespace);
+            for each (var childWSDL:WSDL in imports)
+            {
+                types = childWSDL.getTypes(targetNamespace);
+                if (types != null)
+                    break;
+            }
+        }
+
+        return types;
+    }
+
+    /**
+     * Search for a requested service in the definitions XML, including all
+     * WSDL imports. This is the usual entry point to start parsing the WSDL as
+     * only one service and one of its port will be used at any time.
+     *

+     * If the service name is not specified, the first service is used by
+     * default. If a service is located it is parsed and then the search
+     * continues for the requested port, which is in turn parsed, and so forth.
+     *

+     */
+    private function parseService(serviceName:String = null, portName:String = null):WSDLService
+    {
+        var service:WSDLService;
+        var serviceXML:XML;
+
+        // First, look for the service in this WSDL
+        var serviceXMLList:XMLList = xml.elements(wsdlConstants.serviceQName);
+        for each (var x:XML in serviceXMLList)
+        {
+            if (serviceName == null)
+            {
+                // Select the first service if a service name wasn't specified
+                serviceXML = x;
+                serviceName = x.@name.toString();
+                break;
+            }
+            else if (x.@name == serviceName)
+            {
+                serviceXML = x;
+                break;
+            }
+        }
+
+        if (serviceXML != null)
+        {
+            // We have the service, now look for the port
+            service = new WSDLService(serviceName);
+
+            var port:WSDLPort = parsePort(service, serviceXML, portName);
+
+            if (port != null)
+            {
+                service.addPort(port);
+            }
+        }
+        else if (importsManager != null)
+        {
+            // Otherwise, look for the service in our WSDL imports (assuming
+            // the port must be in the same import as the service).
+            var imports:Array = importsManager.getResources();
+            for each (var childWSDL:WSDL in imports)
+            {
+                service = childWSDL.parseService(serviceName, portName);
+                if (service != null)
+                    break;
+            }
+        }
+
+        return service;
+    }
+
+    /**
+     * Search for a requested port in the given service XML. If a port
+     * name was not specified, the first port is used by default.
+     */
+    private function parsePort(service:WSDLService, serviceXML:XML, portName:String = null):WSDLPort
+    {
+        var port:WSDLPort;
+        var portXML:XML;
+
+        var portXMLList:XMLList = serviceXML.elements(wsdlConstants.portQName);
+        for each (var x:XML in portXMLList)
+        {
+            if (portName == null)
+            {
+                portXML = x;
+                portName = x.@name.toString();
+                break;
+            }
+            else if (x.@name == portName)
+            {
+                portXML = x;
+                break;
+            }
+        }
+
+        if (portXML != null)
+        {
+            // We have the port, now look for the location and binding
+            port = new WSDLPort(portName, service);
+
+            var soapAddressXMLList:XMLList;
+            soapAddressXMLList = portXML.elements(wsdlConstants.soapAddressQName);
+            if (soapAddressXMLList.length() > 0)
+            {
+                port.endpointURI = soapAddressXMLList[0].@location.toString();
+            }
+
+            var prefixedBindingName:String = portXML.@binding.toString();
+            var bindingQName:QName = schemaManager.getQNameForPrefixedName(prefixedBindingName, portXML);
+
+            var binding:WSDLBinding = parseBinding(bindingQName);
+
+            if (binding != null)
+            {
+                port.binding = binding;
+            }
+            else
+            {
+				var message:String = resourceManager.getString(
+					"rpc", "unrecognizedBindingName",
+					[ bindingQName.localName, bindingQName.uri ]);
+                throw new Fault("WSDL.UnrecognizedBindingName", message);
+            }
+        }
+
+        return port;
+    }
+
+    /**
+     * Search for a binding by QName. If a URI is not specified, the
+     * targetNamespace is assumed. FIXME: We may need to consider whether
+     * formElementDefault is set to qualified or not.
+     */
+    private function parseBinding(bindingQName:QName):WSDLBinding
+    {
+        var binding:WSDLBinding;
+        var bindingXML:XML;
+
+        // First, look for the binding in this WSDL
+        var bindingXMLList:XMLList = xml.elements(wsdlConstants.bindingQName);
+        for each (var x:XML in bindingXMLList)
+        {
+            if (x.@name == bindingQName.localName)
+            {
+                bindingXML = x;
+                break;
+            }
+        }
+
+        if (bindingXML != null)
+        {
+            // We have the binding, now look for the style, transport,
+            // operation and portType information
+            binding = new WSDLBinding(bindingQName.localName);
+
+            // Look for the SOAP specific binding that controls the basic
+            // structure of requests made to and from a WSDL operation, and
+            // specifies the default style for operations. It does not make any
+            // claims as to the encoding or format of the message.
+            //
+            //     <soap:binding transport="uri"? style="rpc|document"?>
+            //
+            var soapBindingXMLList:XMLList;
+            soapBindingXMLList = bindingXML.elements(wsdlConstants.soapBindingQName);
+            if (soapBindingXMLList.length() > 0)
+            {
+                var style:String = soapBindingXMLList[0].@style.toString();
+                binding.style = style;
+
+                var transport:String = soapBindingXMLList[0].@transport.toString();
+                binding.transport = transport;
+            }
+
+            // The port type name must match the type specified on the binding.
+            //
+            //    <wsdl:binding name="nmtoken" type="qname">*
+            //
+            var prefixedTypeName:String = bindingXML.@type.toString();
+            var portTypeQName:QName = schemaManager.getQNameForPrefixedName(prefixedTypeName, bindingXML);
+            var portType:WSDLPortType = new WSDLPortType(portTypeQName.localName);
+            binding.portType = portType;
+
+            // We parse binding information for each operation and its
+            // input, output and fault messages before processing the port type
+            // so that we can establish encoding rules and whether subsets of
+            // the parts have been declared for the Body.
+            //
+            //    <wsdl:operation name="nmtoken">*
+            //
+            var operationXMLList:XMLList = bindingXML.elements(wsdlConstants.operationQName);
+            for each (var operationXML:XML in operationXMLList)
+            {
+                var operationName:String = operationXML.@name.toString();
+                var operation:WSDLOperation = new WSDLOperation(operationName);
+                operation.schemaManager = schemaManager;
+                operation.namespaces = namespaces;
+                operation.wsdlConstants = wsdlConstants;
+
+                // Look for soapAction as we expect HTTP based SOAP binding
+                // and any operation-specific style information.
+                //
+                //    <soap:operation soapAction="uri"? style="rpc|document"?>?
+                //
+                var soapOperationXMLList:XMLList = operationXML.elements(wsdlConstants.soapOperationQName);
+                if (soapOperationXMLList.length() > 0)
+                {
+                    var soapAction:String = soapOperationXMLList[0].@soapAction.toString();
+                    operation.soapAction = soapAction;
+                    var opStyle:String = soapOperationXMLList[0].@style.toString();
+                    if (opStyle == "")
+                        operation.style = binding.style;
+                    else
+                        operation.style = opStyle;
+                }
+
+                // Record the encoding format each of the messages of this
+                // operation. The SOAP Body, Fault and Header sections are
+                // described.
+                //
+                //     <soap:body parts="nmtokens"? use="literal|encoded"?
+                //         encodingStyle="uri-list"? namespace="uri"?>
+                //
+                //     <soap:header message="qname" part="nmtoken" use="literal|encoded"
+                //         encodingStyle="uri-list"? namespace="uri"?>*
+                //
+
+                var operationExtensionXMLList:XMLList;
+                var operationExtensionXML:XML;
+                var encoding:WSDLEncoding;
+                var extensionXMLList:XMLList;
+                var extensionXML:XML;
+                var extensionName:String;
+                var extensionMessage:WSDLMessage;
+
+                // WSDL Input Message
+                operationExtensionXMLList = operationXML.elements(wsdlConstants.inputQName);
+                if (operationExtensionXMLList.length() > 0)
+                {
+                    operationExtensionXML = operationExtensionXMLList[0];
+                    operation.inputMessage = new WSDLMessage();
+
+                    // SOAP Body
+                    extensionXMLList = operationExtensionXML.elements(wsdlConstants.soapBodyQName);
+                    if (extensionXMLList.length() > 0)
+                    {
+                        extensionXML = extensionXMLList[0];
+                        encoding = parseEncodingExtension(extensionXML);
+                        operation.inputMessage.encoding = encoding;
+                    }
+
+                    // SOAP Header
+                    extensionXMLList = operationExtensionXML.elements(wsdlConstants.soapHeaderQName);
+                    for each (extensionXML in extensionXMLList)
+                    {
+                        extensionMessage = parseHeader(operationName, extensionXML);
+                        operation.inputMessage.addHeader(extensionMessage);
+                    }
+
+                    // SOAP Header Fault
+                    extensionXMLList = operationExtensionXML.elements(wsdlConstants.soapHeaderFaultQName);
+                    for each (extensionXML in extensionXMLList)
+                    {
+                        extensionMessage = parseHeader(operationName, extensionXML);
+                        operation.inputMessage.addHeaderFault(extensionMessage);
+                    }
+                }
+
+                // WSDL Output Message
+                operationExtensionXMLList = operationXML.elements(wsdlConstants.outputQName);
+                if (operationExtensionXMLList.length() > 0)
+                {
+                    operationExtensionXML = operationExtensionXMLList[0];
+                    operation.outputMessage = new WSDLMessage();
+
+                    // SOAP Body
+                    extensionXMLList = operationExtensionXML.elements(wsdlConstants.soapBodyQName);
+                    if (extensionXMLList.length() > 0)
+                    {
+                        extensionXML = extensionXMLList[0];
+                        encoding = parseEncodingExtension(extensionXML);
+                        operation.outputMessage.encoding = encoding;
+                    }
+
+                    // SOAP Header
+                    extensionXMLList = operationExtensionXML.elements(wsdlConstants.soapHeaderQName);
+                    for each (extensionXML in extensionXMLList)
+                    {
+                        extensionMessage = parseHeader(operationName, extensionXML);
+                        operation.outputMessage.addHeader(extensionMessage);
+                    }
+
+                    // SOAP Header Fault
+                    extensionXMLList = operationExtensionXML.elements(wsdlConstants.soapHeaderFaultQName);
+                    for each (extensionXML in extensionXMLList)
+                    {
+                        extensionMessage = parseHeader(operationName, extensionXML);
+                        operation.outputMessage.addHeaderFault(extensionMessage);
+                    }
+                }
+
+                // WSDL Fault Message
+                //
+                //     <soap:fault name="nmtoken" use="literal|encoded"
+                //         encodingStyle="uri-list"? namespace="uri"?>
+                //
+                operationExtensionXMLList = operationXML.elements(wsdlConstants.faultQName);
+                for each (operationExtensionXML in operationExtensionXMLList)
+                {
+                    // SOAP Fault
+                    extensionXMLList = operationExtensionXML.elements(wsdlConstants.soapFaultQName);
+                    if (extensionXMLList.length() > 0)
+                    {
+                        extensionXML = extensionXMLList[0];
+                        var faultName:String = extensionXML.@["name"].toString();
+                        extensionMessage = new WSDLMessage(faultName);
+                        encoding = parseEncodingExtension(extensionXML, false, true);
+                        extensionMessage.encoding = encoding;
+                        operation.addFault(extensionMessage);
+                    }
+                }
+
+                portType.addOperation(operation);
+            }
+
+            // Now that we've read the SOAP binding information for each
+            // operation, we can find and parse the port type which is a
+            // named set of abstract operations and the abstract messages
+            // involved.
+            parsePortType(portTypeQName, portType);
+        }
+        else if (importsManager != null)
+        {
+            // FIXME: USE QNAME URI TO LOOK UP IMPORT BY NAMESPACE!
+
+            // Otherwise, look for the binding in our WSDL imports.
+            var imports:Array = importsManager.getResources();
+            for each (var childWSDL:WSDL in imports)
+            {
+                binding = childWSDL.parseBinding(bindingQName);
+                if (binding != null)
+                    break;
+            }
+        }
+
+        return binding;
+    }
+
+    /**
+     * Search for a portType by QName. If a URI is not specified, the
+     * targetNamespace is assumed.
+     */
+    private function parsePortType(portTypeQName:QName, portType:WSDLPortType):Boolean
+    {
+        var portTypeXML:XML;
+        var foundMatchingPortType:Boolean;
+
+        // First, look for the portType in this WSDL
+        var portTypeXMLList:XMLList = xml.elements(wsdlConstants.portTypeQName);
+        for each (var x:XML in portTypeXMLList)
+        {
+            if (x.@name == portTypeQName.localName)
+            {
+                portTypeXML = x;
+                break;
+            }
+        }
+
+        if (portTypeXML != null)
+        {
+            foundMatchingPortType = true;
+
+            var operationsXMLList:XMLList = portTypeXML.elements(wsdlConstants.operationQName);
+            for each(var operationXML:XML in operationsXMLList)
+            {
+                // TODO: We may need to consider operation overloading!
+
+                // The binding operation nmtoken is unique and must match an
+                // operation defined in the associated portType. We've
+                // previously parsed the binding, so this operation must be
+                // located by name.
+                var operationName:String = operationXML.@name.toString();
+                var operation:WSDLOperation = portType.getOperation(operationName);
+
+                // If we don't have the binding information for this operation,
+                // skip it.
+                if (operationName == null)
+                {
+                    _log.warn("An operation '{0}' was found in the port type but is missing binding information.", operationName);
+                    continue;
+                }
+
+                var messageName:String;
+                var messageQName:QName;
+                var message:WSDLMessage;
+
+                // Input Message
+                //
+                //     <wsdl:input name="nmtoken"? message="qname"/>
+                //
+                var inputXMLList:XMLList = operationXML.elements(wsdlConstants.inputQName);
+                if (inputXMLList.length() > 0)
+                {
+                    // Reset the schema scope for each message
+                    schemaManager.reset();
+
+                    messageName = inputXMLList[0].@message.toString();
+                    messageQName = schemaManager.getQNameForPrefixedName(messageName, inputXMLList[0]);
+                    message = operation.inputMessage;
+                    message.name = messageQName.localName;
+                    parseMessage(message, messageQName, operationName, WSDLConstants.MODE_IN);
+                }
+
+                // Output Message
+                //
+                //    <wsdl:output name="nmtoken"? message="qname"/>
+                //
+                var outputXMLList:XMLList = operationXML.elements(wsdlConstants.outputQName);
+                if (outputXMLList.length() > 0)
+                {
+                    // Reset the schema scope for each message
+                    schemaManager.reset();
+
+                    messageName = outputXMLList[0].@message.toString();
+                    messageQName = schemaManager.getQNameForPrefixedName(messageName, outputXMLList[0]);
+                    message = operation.outputMessage;
+                    message.name = messageQName.localName;
+                    parseMessage(message, messageQName, operationName, WSDLConstants.MODE_OUT);
+                }
+
+                // Fault Messages
+                //
+                //    <wsdl:fault name="nmtoken" message="qname"/>*
+                //
+                var faultsXMLList:XMLList = operationXML.elements(wsdlConstants.faultQName);
+                for each (var faultXML:XML in faultsXMLList)
+                {
+                    // Reset the schema scope for each message
+                    schemaManager.reset();
+
+                    var faultName:String = faultXML.@name.toString();
+                    message = operation.getFault(faultName);
+                    if (message != null)
+                    {
+                        messageName = faultXML.@message.toString();
+                        messageQName = schemaManager.getQNameForPrefixedName(messageName, faultXML);
+                        parseMessage(message, messageQName, operationName, WSDLConstants.MODE_FAULT);
+                    }
+                }
+
+                if (operation.style == SOAPConstants.DOC_STYLE)
+                {
+                    parseDocumentOperation(operation);
+                }
+            }
+        }
+        else if (importsManager != null)
+        {
+            // Then look for the portType in the imports...
+            var imports:Array = importsManager.getResources();
+            for each (var childWSDL:WSDL in imports)
+            {
+                foundMatchingPortType = childWSDL.parsePortType(portTypeQName, portType);
+                if (foundMatchingPortType)
+                    break;
+            }
+        }
+
+        return foundMatchingPortType;
+    }
+
+    /**
+     * Search for a message by QName. If a URI is not specified, the
+     * targetNamespace is assumed.
+     */
+    private function parseMessage(message:WSDLMessage, messageQName:QName, operationName:String, mode:int):Boolean
+    {
+        var messageXML:XML;
+        var foundMatchingMessage:Boolean;
+        var encoding:WSDLEncoding = message.encoding;
+
+        // First, look for the message in this WSDL
+        var messageXMLList:XMLList = xml.elements(wsdlConstants.messageQName);
+        for each (var x:XML in messageXMLList)
+        {
+            if (x.@name == messageQName.localName)
+            {
+                messageXML = x;
+                break;
+            }
+        }
+
+        if (messageXML != null)
+        {
+            foundMatchingMessage = true;
+
+            // If the message is not named we default to the operation name
+            // plus a standard suffix for input or output mode:
+            if (message.name == null || message.name == "")
+            {
+                if (mode == WSDLConstants.MODE_IN)
+                {
+                    message.name = operationName + "Request";
+                }
+                else if (mode == WSDLConstants.MODE_OUT)
+                {
+                    message.name = operationName + "Response";
+                }
+
+                // FIXME: Handle soap fault message name if one wasn't provided
+            }
+
+            // Parse the message types
+            var partXMLList:XMLList = messageXML.elements(wsdlConstants.partQName);
+            for each (var partXML:XML in partXMLList)
+            {
+                var partName:String = partXML.@name;
+
+                // We skip a part if the SOAP encoding extension defines a
+                // subset of parts and this part nmtoken isn't in the list...
+                if (encoding != null && !encoding.hasPart(partName))
+                {
+                    continue;
+                }
+
+                var part:WSDLMessagePart = parseMessagePart(partXML);
+                message.addPart(part);
+            }
+        }
+        else if (importsManager != null)
+        {
+            // Then look for the message in the imports...
+            var imports:Array = importsManager.getResources();
+            for each (var childWSDL:WSDL in imports)
+            {
+                foundMatchingMessage = childWSDL.parseMessage(message, messageQName, operationName, mode);
+                if (foundMatchingMessage)
+                    break;
+            }
+        }
+
+        return foundMatchingMessage;
+    }
+
+    /**
+     * Returns a WSDL message part based on the name and looks for either an
+     * element QName or type QName to determine which definition describes
+     * this message part.
+     */
+    private function parseMessagePart(partXML:XML):WSDLMessagePart
+    {
+        var partName:String = partXML.@name;
+        var partQName:QName = new QName("", partName);
+        var part:WSDLMessagePart = new WSDLMessagePart(partQName);
+        var partXMLElement:String = partXML.@element;
+        var partXMLType:String = partXML.@type;
+
+        // Consider type or element
+        if (partXMLElement != "")
+        {
+            var elementName:String = partXML.@element;
+            var elementQName:QName = schemaManager.getQNameForPrefixedName(elementName, partXML);
+            part.element = elementQName;
+        }
+        else if (partXMLType != "")
+        {
+            var typeName:String = partXML.@type;
+            var typeQName:QName = schemaManager.getQNameForPrefixedName(typeName, partXML);
+            part.type = typeQName;
+        }
+
+        return part;
+    }
+
+    /**
+     * Looks for the SOAP encoding extensions based on the type of WSDL
+     * operation message. SOAP encoding is required for SOAP Body, Header
+     * (header and headerfault) and Fault extensions.
+     */
+    private function parseHeader(operationName:String, headerXML:XML):WSDLMessage
+    {
+        var headerName:String = headerXML.@["part"].toString();
+        var headerMessage:WSDLMessage = new WSDLMessage(headerName);
+        var encoding:WSDLEncoding = parseEncodingExtension(headerXML, true);
+        headerMessage.encoding = encoding;
+        parseMessage(headerMessage, encoding.message, operationName, WSDLConstants.MODE_HEADER);
+        return headerMessage;
+    }
+
+    /**
+     * Looks for the SOAP encoding extensions based on the type of WSDL
+     * operation message. SOAP encoding is required for SOAP Body, Header
+     * (header and headerfault) and Fault extensions.
+     */
+    private function parseEncodingExtension(extensionXML:XML, isHeader:Boolean = false, isFault:Boolean = false):WSDLEncoding
+    {
+        var encoding:WSDLEncoding = new WSDLEncoding();
+        encoding.useStyle = extensionXML.@["use"].toString();
+        encoding.namespaceURI = extensionXML.@["namespace"].toString();
+        encoding.encodingStyle = extensionXML.@["encodingStyle"].toString();
+
+        if (isHeader)
+        {
+            var messageName:String = extensionXML.@["message"].toString();
+            encoding.message = schemaManager.getQNameForPrefixedName(messageName, extensionXML);
+            encoding.setParts(extensionXML.@["part"].toString());
+        }
+        else if (!isFault)
+        {
+            encoding.setParts(extensionXML.@["parts"].toString());
+        }
+
+        return encoding;
+    }
+
+    /**
+     * A Document-Literal operation may make use of "wrapped" style. If so,
+     * then the message parts should be replaced by the the individual wrapped
+     * parts so that the SOAP encoders correctly bind ActionScript input params
+     * to message params, and SOAP decoders correctly bind output params
+     * to predictable ActionScript constructs. Essentially the wrappers should
+     * be an encoding detail that is invisible to the Flex developer.
+     */
+    private function parseDocumentOperation(operation:WSDLOperation):void
+    {
+        var part:WSDLMessagePart;
+        var element:XML;
+        var elementTypeString:String;
+        var elementType:QName;
+        var complexTypes:XMLList;
+        var complexType:XML;
+        var attributes:XMLList;
+        var sequences:XMLList;
+        var sequence:XML;
+
+        // Check whether this operation's input is literal and "wrapped".
+        if (operation.inputMessage != null
+            && operation.inputMessage.encoding != null
+            && operation.inputMessage.encoding.useStyle == SOAPConstants.USE_LITERAL)
+        {
+            // A "wrapped" input message must:
+            // 1. Have a single part.
+            // 2. The part is an element.
+            // 3. The element's name MUST be the same as the name of the operation.
+            // 4. The element's complex type must have no attributes and define
+            //    a sequence of zero or more elements (which serve as the input
+            //    params).
+            var input:WSDLMessage = operation.inputMessage;
+            if (input.parts != null && input.parts.length == 1)
+            {
+                // Reset the schema scope for each wrapped part
+                schemaManager.reset();
+
+                part = input.parts[0];
+                if (part.element != null)
+                {
+                    element = schemaManager.getNamedDefinition(part.element, schemaConstants.elementTypeQName);
+                    if (element != null && element.@["name"] == operation.name)
+                    {
+                        elementTypeString = element.@["type"];
+                        if (elementTypeString != null && elementTypeString != "")
+                        {
+                            elementType = schemaManager.getQNameForPrefixedName(elementTypeString, element);
+                            complexType = schemaManager.getNamedDefinition(elementType, schemaConstants.complexTypeQName);
+                        }
+                        else
+                        {
+                            complexTypes = element.elements(schemaConstants.complexTypeQName);
+                            if (complexTypes.length() == 1)
+                            {
+                                complexType = complexTypes[0];
+                            }
+                        }
+
+                        if (complexType != null)
+                        {
+                            attributes = complexType.elements(schemaConstants.attributeQName);
+                            if (attributes.length() == 0)
+                            {
+                                sequences = complexType.elements(schemaConstants.sequenceQName);
+
+                                // The sequence may be omitted entirely for
+                                // zero-param operation signatures
+                                if (complexType.elements().length() == 0 || sequences.length() == 1)
+                                {
+                                    input.isWrapped = true;
+                                    input.wrappedQName = part.element;
+                                    input.parts = [];
+
+                                    if (sequences.length() == 1)
+                                    {
+                                        // Use the wrapped parts to redefine the
+                                        // signature of the input message.
+                                        sequence = sequences[0];
+                                        var requestElements:XMLList = sequence.elements(schemaConstants.elementTypeQName);
+                                        for each (var requestElement:XML in requestElements)
+                                        {
+                                            // FIXME: Should we skip wrapped parts
+                                            // if the SOAP encoding extension defines
+                                            // a subset?
+                                            part = parseWrappedMessagePart(requestElement);
+                                            input.addPart(part);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // Reset wrapped element's type variables
+        complexType = null;
+        elementTypeString = null;
+
+        // Check whether this operation's output is literal and "wrapped".
+        if (operation.outputMessage != null
+            && operation.outputMessage.encoding != null
+            && operation.outputMessage.encoding.useStyle == SOAPConstants.USE_LITERAL)
+        {
+            // A "wrapped" output message must:
+            // 1. Have a single part.
+            // 2. The part is an element.
+            // 3. This element's complexType must have no attributes and define
+            //    a sequence of zero or more elements (which serve as the output
+            //    params).
+            var output:WSDLMessage = operation.outputMessage;
+            if (output.parts != null && output.parts.length == 1)
+            {
+                part = output.parts[0];
+                if (part.element != null)
+                {
+                    // Reset the schema scope for each wrapped part
+                    schemaManager.reset();
+
+                    element = schemaManager.getNamedDefinition(part.element, schemaConstants.elementTypeQName);
+                    if (element != null)
+                    {
+                        elementTypeString = element.@["type"];
+                        if (elementTypeString != null && elementTypeString != "")
+                        {
+                            elementType = schemaManager.getQNameForPrefixedName(elementTypeString, element);
+                            complexType = schemaManager.getNamedDefinition(elementType, schemaConstants.complexTypeQName);
+                        }
+                        else
+                        {
+                            complexTypes = element.elements(schemaConstants.complexTypeQName);
+                            if (complexTypes.length() == 1)
+                            {
+                                complexType = complexTypes[0];
+                            }
+                        }
+
+                        if (complexType != null)
+                        {
+                            attributes = complexType.elements(schemaConstants.attributeQName);
+                            if (attributes.length() == 0)
+                            {
+                                sequences = complexType.elements(schemaConstants.sequenceQName);
+
+                                // The sequence may be omitted entirely for
+                                // zero-param operation signatures
+                                if (complexType.elements().length() == 0 || sequences.length() == 1)
+                                {
+                                    output.isWrapped = true;
+                                    output.wrappedQName = part.element;
+                                    output.parts = [];
+
+                                    if (sequences.length() == 1)
+                                    {
+                                        // Use the wrapped parts to redefine the
+                                        // return type signature of the output
+                                        // message (multiple output parts will
+                                        // be returned as a map)
+                                        sequence = sequences[0];
+                                        var resultElements:XMLList = sequence.elements(schemaConstants.elementTypeQName);
+                                        for each (var resultElement:XML in resultElements)
+                                        {
+                                            // FIXME: Should we skip wrapped parts
+                                            // if the SOAP encoding extension defines
+                                            // a subset?
+                                            part = parseWrappedMessagePart(resultElement);
+                                            output.addPart(part);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns a WSDL message part based on the name and looks for either an
+     * element QName or type QName to determine which definition describes
+     * this message part.
+     */
+    private function parseWrappedMessagePart(elementXML:XML):WSDLMessagePart
+    {
+        // <element ref="..."> may be used to point to a top-level element definition
+        var ref:QName;
+        if (elementXML.attribute("ref").length() == 1)
+        {
+            ref = schemaManager.getQNameForPrefixedName(elementXML.@ref, elementXML, true);
+            elementXML = schemaManager.getNamedDefinition(ref, schemaConstants.elementTypeQName);
+            if (elementXML == null)
+                throw new Error("Cannot resolve element definition for ref '" + ref + "'");
+        }
+
+        var partName:String = elementXML.@name;
+        var partQName:QName = schemaManager.getQNameForElement(partName, elementXML.@form);
+        var part:WSDLMessagePart = new WSDLMessagePart(partQName);
+
+        // However, since this is a local element that acts like a
+        // top-level element, we first check whether we need to
+        // special case the element definition.
+        var minOccurs:String = elementXML.@minOccurs;
+        var maxOccurs:String = elementXML.@maxOccurs;
+
+        // Furthermore, if minOccurs is set to 0, this part is optional
+        if (minOccurs != "" && parseInt(minOccurs) == 0)
+            part.optional = true;
+
+        if (ref != null)
+        {
+            // We have a reference to a top level element definition
+            part.element = ref;
+        }
+        else
+        {
+            var partType:String = elementXML.@type;
+            if (partType != "" || !elementXML.hasComplexContent())
+            {
+                // We have a reference to a type definition
+                if (partType == null || partType == "")
+                    part.type = schemaConstants.anyTypeQName;
+                else
+                    part.type = schemaManager.getQNameForPrefixedName(partType, elementXML);
+
+                if (minOccurs != "" || maxOccurs != "")
+                {
+                    part.definition = elementXML;
+                }
+            }
+            else if (elementXML.hasComplexContent())
+            {
+                // We have an inline type definition
+                part.definition = elementXML;
+            }
+        }
+
+        // If we found our element by reference, we now release the schema scope
+        if (ref != null)
+            schemaManager.releaseScope();
+
+        return part;
+    }
+
+    /**
+     * Determines the WSDL and SOAP versions from the definitions and creates
+     * a map of top level prefixes to namespaces.
+     */
+    private function processNamespaces():void
+    {
+        if (_xml != null)
+        {
+            // Record the targetNamespace
+            var tns:String = _xml.@targetNamespace.toString();
+            _targetNamespace = new Namespace(tns);
+
+            // Initialize Namespaces
+            namespaces = {};
+
+            // Determine WSDL and SOAP Version
+            var nsArray:Array = _xml.namespaceDeclarations();
+            for each (var ns:Namespace in nsArray)
+            {
+                namespaces[ns.prefix] = ns;
+            }
+
+            // Initialize WSDL Constants
+            _wsdlConstants = WSDLConstants.getConstants(_xml);
+            _schemaConstants = SchemaConstants.getConstants(_xml);
+
+            // Also record these top level namespaces with our SchemaManager
+            schemaManager.addNamespaces(namespaces);
+        }
+    }
+
+    private function processSchemas():void
+    {
+        var types:XML = getTypes(targetNamespace);
+        if (types != null)
+        {
+            var schemas:XMLList = types.elements(schemaConstants.schemaQName);
+            for each (var schemaXML:XML in schemas)
+            {
+                var schema:Schema = new Schema(schemaXML);
+                addSchema(schema);
+            }
+        }
+    }
+
+    /**
+     * Manages WSDL imports.
+     */
+    private var importsManager:QualifiedResourceManager;
+
+    /**
+     * Logs warnings encountered while parsing WSDL.
+     */
+    private var _log:ILogger;
+
+    /**
+     * Maps a namespace prefix (as a String) to a
+     * Namespace (i.e. this helps to resolve a prefix to a URI).
+     */
+    private var namespaces:Object;
+
+    /**
+     * Provides a static cache of the constants for various versions of XSD.
+     */
+    private var _schemaConstants:SchemaConstants;
+
+    /**
+     * A map of target namespaces to XSD Schemas that describe the types
+     * used in this WSDL.
+     */
+    private var _schemaManager:SchemaManager;
+
+    /**
+     * Map to cache a WSDLService by service name. The cache is cleared
+     * when a new definitions element is set for the WSDL.
+     */
+    private var serviceMap:Object;
+
+    private var _soapConstants:SOAPConstants;
+
+    /**
+     * WSDL target namespace.
+     */
+    private var _targetNamespace:Namespace;
+
+    /**
+     * Provides a static cache of the constants for various versions of WSDL.
+     */
+    private var _wsdlConstants:WSDLConstants;
+
+    /**
+     * The raw XML representing the WSDL definitions top level element.
+     */
+    private var _xml:XML;
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

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

 package mx.olap
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 4692
Author:   gosmith@adobe.com
Date:     2009-01-27T22:13:03.562851Z

Log Message:
-----------
Fixed missing or misplaced 'break' statements in the eventHandler() methods of the mx.accessibility classes. These have probably been causing some unintented MSAA events to be dispatched.

Also, each accessible component now dispatches OBJ_NAMECHANGE when its toolTip or errorString property changes, because the MSAA name includes the tooltip or error tip.

QE Notes: None
Doc Notes: None
Bugs: None
Reviewer: Deepa

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ButtonAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ColorPickerAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/AccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/DataGridAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/DateFieldAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/SliderAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/MenuBarAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ComboBaseAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/TabBarAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/TreeAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/DateChooserAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/UIComponentAccProps.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/MenuAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ListBaseAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/AlertAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/TitleWindowAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/AccordionHeaderAccImpl.as</path>

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

--- frameworks/projects/mx/src/mx/accessibility/TabBarAccImpl.as
+++ frameworks/projects/mx/src/mx/accessibility/TabBarAccImpl.as
@@ -313,6 +313,10 @@
 	 */
 	override protected function eventHandler(event:Event):void
 	{
+		// Let AccImpl class handle the events
+		// that all accessible UIComponents understand.
+		$eventHandler(event);
+
 		var index:int;

 		switch (event.type)


Transferred from the Adobe Open Source Subversion Repository

Revision: 12306
Author:   hmuller@adobe.com
Date:     2009-12-01T00:16:47.642254Z

Log Message:
-----------
H,VScrollBar now install mouse wheel event listeners on themselves and their viewport so that mouse wheel handling works when there's no Scroller.

Removed some old dead (commented out long ago) code from Scroller.

QE notes: I reversed the direction for horizontal mouse wheel scrolling (applies when only a HSB is visible)
Doc notes:
Bugs: sdk-21930
Reviewer: Ryan, Jason
Tests run: DataGroup, List (before horizontal mouse wheel scroll direction change)
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/HScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DataGroup.as</path>

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

--- frameworks/projects/spark/src/spark/components/HScrollBar.as
+++ frameworks/projects/spark/src/spark/components/HScrollBar.as
@@ -11,15 +11,17 @@

 package spark.components
 {
+import flash.events.MouseEvent;
 import flash.geom.Point;
-
+
+import mx.core.EventPriority;
 import mx.core.mx_internal;
 import mx.events.PropertyChangeEvent;
 import mx.events.ResizeEvent;
-
+
 import spark.components.supportClasses.ScrollBar;
+import spark.core.IViewport;
 import spark.core.NavigationUnit;
-import spark.core.IViewport;

 use namespace mx_internal;

@@ -141,11 +143,31 @@
      */
     override public function set viewport(newViewport:IViewport):void
     {
+
+        const oldViewport:IViewport = super.viewport;
+        if (oldViewport == newViewport)
+            return;
+
+        if (oldViewport)
+        {
+            oldViewport.removeEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
+            removeEventListener(MouseEvent.MOUSE_WHEEL, hsb_mouseWheelHandler, true);
+        }
+
         super.viewport = newViewport;
+
         if (newViewport)
         {
-            updateMaximumAndPageSize();
+            updateMaximumAndPageSize()
             value = newViewport.horizontalScrollPosition;
+
+            // The HSB viewport mouse wheel listener is added at a low priority so that
+            // if a VSB installs a listener it will run first and cancel the event.
+            newViewport.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler, false, EventPriority.DEFAULT_HANDLER);
+
+            // The HSB mouse wheel listener stops propagation and redispatches its event,
+            // so we listen during the capture phase.
+            addEventListener(MouseEvent.MOUSE_WHEEL, hsb_mouseWheelHandler, true);
         }
     }

@@ -389,5 +411,48 @@
             maximum = viewport.contentWidth - viewportWidth;
         }
     }
+
+    /**
+     *  @private
+     *  Scroll horizontally by event.delta "steps".  This listener is added to the viewport
+     *  at a lower priority then the vertical scrollbar mouse wheel listener, so that vertical
+     *  scrolling is preferred when both scrollbars exist.
+     */
+    mx_internal function mouseWheelHandler(event:MouseEvent):void
+    {
+        const vp:IViewport = viewport;
+        if (event.isDefaultPrevented() || !vp || !vp.visible)
+            return;
+
+        var nSteps:uint = Math.abs(event.delta);
+        var navigationUnit:uint;
+
+        // Scroll event.delta "steps".
+        navigationUnit = (event.delta < 0) ? NavigationUnit.RIGHT : NavigationUnit.LEFT;
+        for (var hStep:int = 0; hStep < nSteps; hStep++)
+        {
+            var hspDelta:Number = vp.getHorizontalScrollPositionDelta(navigationUnit);
+            if (!isNaN(hspDelta))
+                vp.horizontalScrollPosition += hspDelta;
+        }
+
+        event.preventDefault();
+    }
+
+    /**
+     *  @private
+     *  Redispatch HSB mouse wheel events to the viewport to give the VSB's listener, if any,
+     *  an opportunity to handle/cancel them.  If no VSB exists, mouseWheelHandler (see above)
+     *  will process the event.
+     */
+    private function hsb_mouseWheelHandler(event:MouseEvent):void
+    {
+        const vp:IViewport = viewport;
+        if (event.isDefaultPrevented() || !vp || !vp.visible)
+            return;
+
+        event.stopImmediatePropagation();
+        vp.dispatchEvent(event);
+    }
 }
 }


ScrollBar should defer some of its calculations when styles change to a lifecycle method so things that affect measurement have a chance to be measured.

--- frameworks/projects/spark/src/spark/components/VScrollBar.as
+++ frameworks/projects/spark/src/spark/components/VScrollBar.as
@@ -158,6 +158,8 @@
     //
     //--------------------------------------------------------------------------

+	private var maxAndPageSizeInvalid:Boolean = false;
+
     private function updateMaximumAndPageSize():void
     {
         var vsp:Number = viewport.verticalScrollPosition;
@@ -523,11 +525,28 @@
         if (allStyles || styleName == "interactionMode")
         {
             if (viewport)
-                updateMaximumAndPageSize();
-        }
-    }
-
-
+			{
+				// Some of the information needed
+				// is calculated in measure() on a child
+				maxAndPageSizeInvalid = true;
+				invalidateSize();
+			}
+        }
+    }
+
+	/**
+	 *  @private
+	 */
+	override protected function measure():void
+	{
+		super.measure();
+		if (maxAndPageSizeInvalid)
+		{
+			maxAndPageSizeInvalid = false;
+			updateMaximumAndPageSize();
+		}
+	}
+
     /**
      *  @private
      *  Scroll vertically by event.delta "steps".  This listener is added to both the scrollbar


Transferred from the Adobe Open Source Subversion Repository

Revision: 5573
Author:   jimurphy@adobe.com
Date:     2009-03-26T15:11:59.159776Z

Log Message:
-----------
-more updated package and class names that were missed in the first pass
-remove the mx folder

qa: probably
doc: this updated more asdoc comments so you may want to make sure that this pass made the correct updates
checkintests: pass

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/components/DropDownList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layout/supportClasses/LayoutBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransformMove.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/components/VideoDisplay.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ButtonBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/HSBInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/SetActionInstance.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/effects/AnimateTransformScale3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/HGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/NumericStepper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/IEaser.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Animate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/asdoc/en_US/mx/components/examples/DataGroupExample.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateShaderTransition.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransformScale.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/Slider.as</path>
<path kind="dir" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/mx</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Spinner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/CheckBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/pathSegments/PathSegment.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/Animation.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/RadioButton.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/asdoc/en_US/mx/components/examples/FxToggleButtonExample.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AddActionInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/events/AnimationEvent.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/effects/AnimateTransform.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/TextBase.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/effects/AnimateTransformRotate3D.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/effects/supportClasses/WipeInstance.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/effects/AnimateTransformMove3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/SkinnableComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransformRotate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/SetAction.as</path>

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

--- frameworks/projects/spark/src/spark/components/VScrollBar.as
+++ frameworks/projects/spark/src/spark/components/VScrollBar.as
@@ -216,9 +216,9 @@
      *
      *  @see mx.components.baseClasses.TrackBase#page()
      *  @see mx.components.baseClasses.TrackBase#setValue()
-     *  @see mx.core.IViewport
-     *  @see mx.core.IViewport#verticalScrollPosition
-     *  @see mx.core.IViewport#getVerticalScrollPositionDelta()
+     *  @see spark.core.IViewport
+     *  @see spark.core.IViewport#verticalScrollPosition
+     *  @see spark.core.IViewport#getVerticalScrollPositionDelta()
     *
     *  @langversion 3.0
     *  @playerversion Flash 10
@@ -254,9 +254,9 @@
      *
      *  @see mx.components.baseClasses.TrackBase#step()
      *  @see mx.components.baseClasses.TrackBase#setValue()
-     *  @see mx.core.IViewport
-     *  @see mx.core.IViewport#verticalScrollPosition
-     *  @see mx.core.IViewport#getVerticalScrollPositionDelta()
+     *  @see spark.core.IViewport
+     *  @see spark.core.IViewport#verticalScrollPosition
+     *  @see spark.core.IViewport#getVerticalScrollPositionDelta()
      *
      *  @langversion 3.0
      *  @playerversion Flash 10


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

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


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

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


Argh. Even with the Flex compilers, this error haunts us. In some cases (but not most) importing something and then not using it triggers an error. When shall we find peace?

--- http/src/org/httpclient/io/HttpRequestBuffer.as
+++ http/src/org/httpclient/io/HttpRequestBuffer.as
@@ -4,7 +4,6 @@
  */
 package org.httpclient.io {

-  import com.adobe.utils.StringUtil;
   import flash.utils.ByteArray;

   public class HttpRequestBuffer {


Wrong namespace was used when configuring a room, pointed out in http://www.igniterealtime.org/community/thread/41206

--- src/org/igniterealtime/xiff/conference/Room.as
+++ src/org/igniterealtime/xiff/conference/Room.as
@@ -363,6 +363,7 @@
 		 * form variables and the values being arrays. For single value fields, use a single
 		 * element array.
 		 * @see	#configureForm
+		 * @see http://xmpp.org/extensions/xep-0045.html#registrar-formtype-owner
 		 */
 		public function configure( fieldmap:Object ):void
 		{
@@ -377,7 +378,7 @@
 			else
 			{
 				form = new FormExtension();
-				fieldmap[ "FORM_TYPE" ] = [ MUCOwnerExtension.NS ];
+				fieldmap[ "FORM_TYPE" ] = [ "http://jabber.org/protocol/muc#roomconfig" ];
 				form.setFields( fieldmap );
 			}
 			form.type = FormExtension.TYPE_SUBMIT;


Transferred from the Adobe Open Source Subversion Repository

Revision: 88
Author:   open-source-svn-admin@adobe.com
Date:     2008-01-03T22:47:56.499469Z

Log Message:
-----------
Perforce Change 191925 by proberts@proberts-laptop-flex on 2008/01/03 16:47:12 Severity: ignore Details: doc additions/clean up for FlexNativeMenu. Also FLEXDOCS-320 (update documentation for FlexNativeMenuEvent.MENU_SHOW to explain that the index, label, and item properties are null) Affected files ...

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/in/air/air_version.txt</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/Consumer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/errors/NoChannelAvailableError.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemHistoryButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/DirectHTTPChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemTree.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/HTML.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/config/ServerConfig.as</path>
<path kind="file" action="M">/flex/sdk/trunk/in/air/mac/AIR Integration Kit.tbz2</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/StreamingConnectionHandler.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/HTTPChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/errors/MessagingError.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/errors/InvalidChannelError.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/amfx/AMFXDecoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/AbstractProducer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/errors/MessageSerializationError.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/config/ConfigMap.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/Channel.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/rpc/src/mx/messaging/channels/SecureStreamingAMFChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/StreamingHTTPChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/in/air/win/AIR Integration Kit.zip</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/AbstractConsumer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemDataGrid.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/SecureStreamingHTTPChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/amfx/AMFXContext.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/AMFChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/FlexNativeMenuEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/PollingChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/lib/flex-messaging-common.jar</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/NetConnectionChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/amfx/AMFXHeader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/remoting/mxml/RemoteObject.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/SecureAMFChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Tree.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/rpc/src/mx/messaging/channels/StreamingAMFChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/Grammar.jj</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/ConsumerMessageDispatcher.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/SecureHTTPChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/errors/InvalidDestinationError.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/amfx/AMFXResult.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/amfx/AMFXEncoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FlexNativeMenu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/AbstractMessageStore.as</path>

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

--- frameworks/projects/rpc/src/mx/messaging/ChannelSet.as
+++ frameworks/projects/rpc/src/mx/messaging/ChannelSet.as
@@ -1,21 +1,14 @@
-/*************************************************************************
- *
- * ADOBE CONFIDENTIAL
- * __________________
- *
- *  [2002] - [2007] Adobe Systems Incorporated
- *  All Rights Reserved.
- *
- * NOTICE:  All information contained herein is, and remains
- * the property of Adobe Systems Incorporated and its suppliers,
- * if any.  The intellectual and technical concepts contained
- * herein are proprietary to Adobe Systems Incorporated
- * and its suppliers and may be covered by U.S. and Foreign Patents,
- * patents in process, and are protected by trade secret or copyright law.
- * Dissemination of this information or reproduction of this material
- * is strictly forbidden unless prior written permission is obtained
- * from Adobe Systems Incorporated.
- */
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2006-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
 package mx.messaging
 {


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

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


Transferred from the Adobe Open Source Subversion Repository

Revision: 16786
Author:   hmuller@adobe.com
Date:     2010-07-02T01:36:58.734519Z

Log Message:
-----------
The following changes apply to Spark DataGrid only.   Code reviews have been deferred until the implementation is closer to completion.

Lazily generate columns from the typicalItem or dataProvider[0], if that's possible.

Modified Paths:
--------------
/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Grid.as

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

--- frameworks/projects/spark/src/spark/components/Grid.as
+++ frameworks/projects/spark/src/spark/components/Grid.as
@@ -16,6 +16,7 @@
     import flash.geom.Point;
     import flash.geom.Rectangle;

+    import mx.collections.ArrayList;
     import mx.collections.IList;
     import mx.core.IFactory;
     import mx.core.IVisualElement;
@@ -646,6 +647,7 @@
         //----------------------------------

         private var _columns:IList = null; // list of GridColumns
+        private var generatedColumns:Boolean = false;

         [Bindable("columnsChanged")]

@@ -659,6 +661,12 @@
          */
         public function get columns():IList
         {
+            if (_columns == null)
+            {
+                setColumns(generateColumns());
+                generatedColumns = true;
+            }
+
             return _columns;
         }

@@ -670,9 +678,15 @@
             if (_columns == value)
                 return;

+            generatedColumns = false;
+            setColumns(value);
+        }
+
+        private function setColumns(value:IList):void
+        {
             // Remove the old column listener, and set each column's grid=null, columnIndex=-1.

-            const oldColumns:IList = columns;
+            const oldColumns:IList = _columns;
             if (oldColumns)
             {
                 oldColumns.removeEventListener(CollectionEvent.COLLECTION_CHANGE, columns_collectionChangeHandler);
@@ -691,7 +705,7 @@
             // addEventListener parameter) is safe, since the listener's lifetime is the
             // same as this object.

-            const newColumns:IList = columns;
+            const newColumns:IList = _columns;
             if (newColumns)
             {
                 newColumns.addEventListener(CollectionEvent.COLLECTION_CHANGE, columns_collectionChangeHandler, false, 0, true);
@@ -724,6 +738,31 @@
             const columns:IList = columns;
             return (columns) ? columns.length : 0;
         }
+
+        /**
+         *  @private
+         */
+        private function generateColumns():IList
+        {
+            var item:Object = typicalItem;
+            if (!item && dataProvider && (dataProvider.length > 0))
+                item = dataProvider[0];
+
+            var itemColumns:IList = null;
+            if (item)
+            {
+                itemColumns = new ArrayList();
+                for (var property:String in item)
+                {
+                    var column:GridColumn = new GridColumn();
+                    column.dataField = property;
+                    itemColumns.addItem(column);
+                }
+            }
+
+            return itemColumns;
+        }
+

         //----------------------------------
         //  dataProvider