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

--- frameworks/projects/rpc/src/mx/messaging/channels/HTTPChannel.as
+++ frameworks/projects/rpc/src/mx/messaging/channels/HTTPChannel.as
@@ -0,0 +1,1277 @@
+/*************************************************************************
+ *
+ * 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.
+ */
+package mx.messaging.channels
+{
+import flash.events.ErrorEvent;
+import flash.events.Event;
+import flash.events.IOErrorEvent;
+import flash.events.SecurityErrorEvent;
+import flash.events.TimerEvent;
+import flash.net.URLLoader;
+import flash.net.URLRequest;
+
+import mx.core.mx_internal;
+import mx.messaging.FlexClient;
+import mx.messaging.MessageAgent;
+import mx.messaging.MessageResponder;
+import mx.messaging.channels.amfx.AMFXDecoder;
+import mx.messaging.channels.amfx.AMFXEncoder;
+import mx.messaging.channels.amfx.AMFXHeader;
+import mx.messaging.channels.amfx.AMFXResult;
+import mx.messaging.config.ConfigMap;
+import mx.messaging.config.ServerConfig;
+import mx.messaging.errors.MessageSerializationError;
+import mx.messaging.events.ChannelFaultEvent;
+import mx.messaging.messages.AbstractMessage;
+import mx.messaging.messages.AcknowledgeMessage;
+import mx.messaging.messages.AsyncMessage;
+import mx.messaging.messages.CommandMessage;
+import mx.messaging.messages.ErrorMessage;
+import mx.messaging.messages.HTTPRequestMessage;
+import mx.messaging.messages.IMessage;
+import mx.messaging.messages.MessagePerformanceInfo;
+import mx.messaging.messages.MessagePerformanceUtils;
+import mx.utils.ObjectUtil;
+import mx.utils.StringUtil;
+
+use namespace mx_internal;
+
+/**
+ *  The HTTPChannel class provides the HTTP support for messaging.
+ *  You can configure this Channel to poll the server at an interval
+ *  to approximate server push.
+ *  You can also use this Channel with polling disabled to send RPC messages
+ *  to remote destinations to invoke their methods.
+ *
+ *

+ *  The HTTPChannel relies on network services native to Flash Player and AIR,
+ *  and exposed to ActionScript by the URLLoader class.
+ *  This channel uses URLLoader exclusively, and creates a new URLLoader
+ *  per request.
+ *

+ *
+ *

+ *  Channels are created within the framework using the
+ *  ServerConfig.getChannel() method. Channels can be constructed
+ *  directly and assigned to a ChannelSet if desired.
+ *

+ *
+ *

+ *  Channels represent a physical connection to a remote endpoint.
+ *  Channels are shared across destinations by default.
+ *  This means that a client targetting different destinations may use
+ *  the same Channel to communicate with these destinations.
+ *

+ *
+ *

+ *  When used in polling mode, this Channel polls the server for new messages
+ *  based on the polling-interval-seconds property in the configuration file,
+ *  and this can be changed by setting the pollingInterval property.
+ *  The default value is 3 seconds.
+ *  To enable polling, the channel must be connected and the polling-enabled
+ *  property in the configuration file must be set to true, or the
+ *  pollingEnabled property of the Channel must be set to true.
+ *

+ */
+public class HTTPChannel extends PollingChannel
+{
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Creates an new HTTPChannel instance.
+     *
+     *  @param id The id of this Channel.
+     *  @param uri The uri for this Channel.
+     */
+    public function HTTPChannel(id:String = null, uri:String = null)
+    {
+        super(id, uri);
+
+        _encoder = new AMFXEncoder();
+        _appendToURL = "";
+        _messageQueue = [];
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var _appendToURL:String;
+
+    /**
+     *  @private
+     *  The loader used to ping the server in internalConnect. We need to hang onto a reference
+     *  in order to time out a connect attempt.
+     */
+    private var _connectLoader:ChannelRequestLoader;
+
+    /**
+     *  @private
+     */
+    private var _encoder:AMFXEncoder;
+
+    /**
+     *  @private
+     *  Records the request that needs to be completed before other
+     *  requests can be sent.
+     */
+    private var _pendingRequest:ChannelRequestLoader = null;
+
+    /**
+     *  @private
+     *  This queue contains the messages from send requests that
+     *  occurred while an authentication attempt is underway.
+     */
+    private var _messageQueue:Array;
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  polling
+    //----------------------------------
+
+    /**
+     *  Reports whether the channel is actively polling.
+     */
+    public function get polling():Boolean
+    {
+        return pollOutstanding;
+    }
+
+    //----------------------------------
+    //  piggybackingEnabled
+    //----------------------------------
+
+    /**
+     *  Indicates whether this channel will piggyback poll requests along
+     *  with regular outbound messages when an outstanding poll is not in
+     *  progress. This allows the server to piggyback data for the client
+     *  along with its response to client's message.
+     */
+    public function get piggybackingEnabled():Boolean
+    {
+        return internalPiggybackingEnabled;
+    }
+
+    /**
+     *  @private
+     */
+    public function set piggybackingEnabled(value:Boolean):void
+    {
+        internalPiggybackingEnabled = value;
+    }
+
+    //----------------------------------
+    //  pollingEnabled
+    //----------------------------------
+
+    /**
+     *  Indicates whether this channel is enabled to poll.
+     */
+    public function get pollingEnabled():Boolean
+    {
+        return internalPollingEnabled;
+    }
+
+    /**
+     *  @private
+     */
+    public function set pollingEnabled(value:Boolean):void
+    {
+        internalPollingEnabled = value;
+    }
+
+    //----------------------------------
+    //  pollingInterval
+    //----------------------------------
+
+    /**
+     *  Provides access to the polling interval for this Channel.
+     *  The value is in milliseconds.
+     *  This value determines how often this Channel requests messages from
+     *  the server, to approximate server push.
+     *
+     *  @throws ArgumentError If the pollingInterval is assigned a value of 0 or
+     *                        less.
+     */
+    public function get pollingInterval():Number
+    {
+        return internalPollingInterval;
+    }
+
+    /**
+     *  @private
+     */
+    public function set pollingInterval(value:Number):void
+    {
+        internalPollingInterval = value;
+    }
+
+    //----------------------------------
+    //  protocol
+    //----------------------------------
+
+    /**
+     *  Returns the protocol for this channel (http).
+     */
+    override public function get protocol():String
+    {
+        return "http";
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Internal Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  appendToURL
+    //----------------------------------
+
+    /**
+     * @private
+     */
+    mx_internal function get appendToURL():String
+    {
+        return _appendToURL;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function set appendToURL(value:String):void
+    {
+        if (value && endpoint)
+        {
+            _appendToURL = value;
+       }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Overridden Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Processes polling related configuration settings.
+     */
+    override public function applySettings(settings:XML):void
+    {
+        super.applySettings(settings);
+        applyPollingSettings(settings);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Overridden Protected Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function connectTimeoutHandler(event:TimerEvent):void
+    {
+        _connectLoader.close();
+        super.connectTimeoutHandler(event);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function getPollSyncMessageResponder(agent:MessageAgent, msg:CommandMessage):MessageResponder
+    {
+        return new PollSyncHTTPMessageResponder(agent, msg, this);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function getDefaultMessageResponder(agent:MessageAgent, msg:IMessage):MessageResponder
+    {
+        return new HTTPMessageResponder(agent, msg, this);
+    }
+
+    /**
+     *  @private
+     *  Attempts to connect to the remote destination with the current endpoint
+     *  specified for this channel.
+     *  This will determine if a connection can be established.
+     */
+    override protected function internalConnect():void
+    {
+        // Ping the server to make sure that it is reachable.
+        var msg:CommandMessage = new CommandMessage();
+        if (credentials != null)
+        {
+            msg.operation = CommandMessage.LOGIN_OPERATION;
+            msg.body = credentials;
+        }
+        else
+        {
+            msg.operation = CommandMessage.CLIENT_PING_OPERATION;
+        }
+
+        // Report the messaging version for this Channel.
+        msg.headers[CommandMessage.MESSAGING_VERSION] = messagingVersion;
+
+        // Indicate if requesting the dynamic configuration from the server.
+        if (ServerConfig.needsConfig(this))
+            msg.headers[CommandMessage.NEEDS_CONFIG_HEADER] = true;
+
+        // Add the FlexClient id header.
+        setFlexClientIdOnMessage(msg);
+
+        var urlRequest:URLRequest = createURLRequest(msg);
+        _connectLoader = new ChannelRequestLoader();
+        _connectLoader.setErrorCallbacks(pingErrorHandler);
+        _connectLoader.completeCallback = pingCompleteHandler;
+        _connectLoader.load(urlRequest);
+    }
+
+    /**
+     *  @private
+     *  Disconnects from the remote destination.
+     */
+    override protected function internalDisconnect(rejected:Boolean = false):void
+    {
+        // Attempt to notify the server of the disconnect.
+        if (!rejected)
+        {
+            var msg:CommandMessage = new CommandMessage();
+            msg.operation = CommandMessage.DISCONNECT_OPERATION;
+            internalSend(new HTTPFireAndForgetResponder(msg));
+        }
+        // Shutdown locally.
+        setConnected(false);
+        super.internalDisconnect(rejected);
+        disconnectSuccess(rejected); // make sure to notify everyone that we have disconnected.
+    }
+
+    /**
+     *  @private
+     */
+    override protected function internalSend(msgResp:MessageResponder):void
+    {
+        if (_pendingRequest != null)
+        {
+            _messageQueue.push(msgResp);
+        }
+        else
+        {
+            // Set the global FlexClient Id.
+            setFlexClientIdOnMessage(msgResp.message);
+
+            try
+            {
+                // If MPI is enabled initialize MPI object and stamp it with client send time
+                if (mpiEnabled)
+                {
+                    var mpii:MessagePerformanceInfo = new MessagePerformanceInfo();
+                    if (recordMessageTimes)
+                        mpii.sendTime = new Date().getTime();
+                    msgResp.message.headers[MessagePerformanceUtils.MPI_HEADER_IN] = mpii;
+                }
+
+                // Finally, if "Small Messages" are enabled, send this form instead of
+                // the normal message where possible.
+                /*
+                if (useSmallMessages && msgResp.message is ISmallMessage)
+                {
+                    var smallMessage:IMessage = ISmallMessage(msgResp.message).getSmallMessage();
+                    if (smallMessage != null)
+                        msgResp.message = smallMessage;
+                }
+                */
+
+                var urlLoader:ChannelRequestLoader;
+                var urlRequest:URLRequest = createURLRequest(msgResp.message);
+                if (msgResp is HTTPMessageResponder)
+                {
+                    var httpMsgResp:HTTPMessageResponder =
+                        HTTPMessageResponder(msgResp);
+                    urlLoader = httpMsgResp.urlLoader;
+                    urlLoader.completeCallback = httpMsgResp.completeHandler;
+                    urlLoader.errorCallback = httpMsgResp.errorHandler;
+                    urlLoader.ioErrorCallback = httpMsgResp.ioErrorHandler;
+                    urlLoader.securityErrorCallback =
+                        httpMsgResp.securityErrorHandler;
+                }
+                else
+                {
+                    var responderWrapper:HTTPWrapperResponder =
+                        new HTTPWrapperResponder(msgResp);
+                    urlLoader = new ChannelRequestLoader();
+                    urlLoader.completeCallback =
+                        responderWrapper.completeHandler;
+                    urlLoader.setErrorCallbacks(responderWrapper.errorHandler);
+                }
+                urlLoader.requestProcessedCallback = requestProcessedHandler;
+
+                // Do not consider poll requests as pending requests to allow
+                // clients to send messages while waiting for poll response.
+                if (!(msgResp.message is CommandMessage && CommandMessage(msgResp.message).operation == CommandMessage.POLL_OPERATION))
+                    _pendingRequest = urlLoader;
+
+                urlLoader.load(urlRequest);
+            }
+            catch(e:MessageSerializationError)
+            {
+                msgResp.agent.fault(e.fault, msgResp.message);
+            }
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Internal Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Utility function to handle a connection related ErrorMessage.
+     *
+     *  @param msg The ErrorMessage returned during a connect attempt.
+     */
+    mx_internal function connectionError(msg:ErrorMessage):void
+    {
+        var faultEvent:ChannelFaultEvent = ChannelFaultEvent.createEvent(this, false,
+                "Channel.Connect.Failed", "error", msg.faultDetail + " url: '" + endpoint +
+                    (_appendToURL != null ? _appendToURL : "") + "'");
+        faultEvent.rootCause = msg;
+        connectFailed(faultEvent);
+    }
+
+    /**
+     *  @private
+     *  This method will serialize the specified message into a new instance of
+     *  a URLRequest and return it.
+     *
+     *  @param   message Message to serialize
+     *  @return  URLRequest
+     */
+    mx_internal function createURLRequest(message:IMessage):URLRequest
+    {
+        var result:URLRequest = new URLRequest();
+        if (_appendToURL)
+            result.url = endpoint + _appendToURL;
+        else
+            result.url = endpoint;
+
+        result.contentType = HTTPRequestMessage.CONTENT_TYPE_XML;
+
+        var packet:XML = _encoder.encode(message, null);
+        result.data = packet.toString();
+        result.method = "POST";
+
+        return result;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Protected Methods
+    //
+    //--------------------------------------------------------------------------
+
+    protected function internalPingComplete(msg:AsyncMessage):void
+    {
+        if (msg != null)
+        {
+            ServerConfig.updateServerConfigData(msg.body as ConfigMap, endpoint);
+
+            // Set the server assigned FlexClient Id.
+            if (FlexClient.getInstance().id == null && msg.headers[AbstractMessage.FLEX_CLIENT_ID_HEADER] != null)
+                FlexClient.getInstance().id = msg.headers[AbstractMessage.FLEX_CLIENT_ID_HEADER];
+        }
+
+        // Process the features advertised by the server endpoint.
+        /*
+        if (msg.headers[CommandMessage.MESSAGING_VERSION] != null)
+        {
+            var serverVersion:Number = msg.headers[CommandMessage.MESSAGING_VERSION] as Number;
+            handleServerMessagingVersion(serverVersion);
+        }
+        */
+
+        connectSuccess();
+        if (credentials != null && !(msg is ErrorMessage))
+            setAuthenticated(true);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Private Methods
+    //
+    //--------------------------------------------------------------------------
+
+    private function decodePacket(event:Event):AsyncMessage
+    {
+        var raw:String = String(URLLoader(event.target).data);
+        var xmlData:XML = new XML(raw);
+        var _decoder:AMFXDecoder = new AMFXDecoder();
+        var packet:AMFXResult = _decoder.decode(xmlData);
+        return packet.result as AsyncMessage;
+    }
+
+    /**
+     *  @private
+     *  This method indicates that we successfully connected to the endpoint.
+     *  Called as a result of the ping operation performed in the
+     *  internalConnect() method.
+     */
+    private function pingCompleteHandler(event:Event):void
+    {
+        var msg:AsyncMessage = decodePacket(event);
+        if (msg != null && (msg is ErrorMessage) &&
+            ErrorMessage(msg).faultCode == "Client.Authentication")
+        {
+            internalPingComplete(msg);
+            var faultEvent:ChannelFaultEvent = ChannelFaultEvent.createEvent(this, false, "Channel.Authentication.Error", "warn");
+            faultEvent.rootCause = ErrorMessage(msg);
+            dispatchEvent(faultEvent);
+        }
+        else
+        {
+            internalPingComplete(msg);
+        }
+    }
+
+    /**
+     *  @private
+     *  This method dispatches the appropriate error to any message agents, and
+     *  is called as a result of the ping operation performed in the
+     *  internalConnect() method.
+     */
+    private function pingErrorHandler(event:Event):void
+    {
+        _log.debug("'{0}' fault handler called. {1}", id, event.toString());
+        var faultEvent:ChannelFaultEvent = ChannelFaultEvent.createEvent(this, false,
+                                                    "Channel.Ping.Failed",
+                                                    "error",
+                                                    " url: '" + endpoint +
+                                                    (_appendToURL == null ? "" : _appendToURL + "'") + "'");
+        faultEvent.rootCause = event;
+        connectFailed(faultEvent);
+    }
+
+    /**
+     *  @private
+     *  Chains sends for pending messages.
+     */
+    private function requestProcessedHandler
+        (loader:ChannelRequestLoader, event:Event):void
+    {
+        if (_pendingRequest == loader)
+        {
+            _pendingRequest = null;
+        }
+        // TODO: we should do these in a batch for more efficiency and
+        // better session maintenance
+        while ((_messageQueue.length > 0) && (_pendingRequest == null))
+        {
+            internalSend(MessageResponder(_messageQueue.shift()));
+        }
+    }
+}
+
+}
+
+//------------------------------------------------------------------------------
+//
+// Private Classes
+//
+//------------------------------------------------------------------------------
+
+import flash.events.ErrorEvent;
+import flash.events.Event;
+import flash.events.IOErrorEvent;
+import flash.events.SecurityErrorEvent;
+import flash.net.URLLoader;
+import flash.net.URLRequest;
+import mx.core.mx_internal;
+import mx.messaging.MessageAgent;
+import mx.messaging.MessageResponder;
+import mx.messaging.channels.HTTPChannel;
+import mx.messaging.channels.amfx.AMFXDecoder;
+import mx.messaging.channels.amfx.AMFXHeader;
+import mx.messaging.channels.amfx.AMFXResult;
+import mx.messaging.messages.AcknowledgeMessage;
+import mx.messaging.messages.AsyncMessage;
+import mx.messaging.messages.CommandMessage;
+import mx.messaging.messages.ErrorMessage;
+import mx.messaging.messages.HTTPRequestMessage;
+import mx.messaging.messages.IMessage;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+import mx.utils.StringUtil;
+
+use namespace mx_internal;
+
+[ResourceBundle("messaging")]
+
+/**
+ *  @private
+ *  This responder wraps another MessageResponder with HTTP functionality.
+ */
+class HTTPWrapperResponder
+{
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Constructs a HTTPWrappedResponder.
+     *
+     *  @param wrappedResponder The responder to wrap.
+     */
+    public function HTTPWrapperResponder(wrappedResponder:MessageResponder)
+    {
+        super();
+        _wrappedResponder = wrappedResponder;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var _wrappedResponder:MessageResponder;
+
+
+    /**
+     * @private
+     */
+    private var resourceManager:IResourceManager =
+                                    ResourceManager.getInstance();
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Handles a result returned from the remote destination.
+     *
+     *  @param event The completion event from the associated URLLoader.
+     */
+    public function completeHandler(event:Event):void
+    {
+        var raw:String = String(URLLoader(event.target).data);
+        var xmlData:XML = new XML(raw);
+        var _decoder:AMFXDecoder = new AMFXDecoder();
+        var packet:AMFXResult = _decoder.decode(xmlData);
+        if (packet.result is ErrorMessage)
+        {
+            _wrappedResponder.status(ErrorMessage(packet.result));
+        }
+        else if (packet.result is AsyncMessage)
+        {
+            _wrappedResponder.result(AsyncMessage(packet.result));
+        }
+    }
+
+    /**
+     *  @private
+     *  Handles an error for an outbound request.
+     *
+     *  @param event The error event from the associated URLLoader.
+     */
+    public function errorHandler(event:Event):void
+    {
+        var msg:ErrorMessage = new ErrorMessage();
+        msg.correlationId = _wrappedResponder.message.messageId;
+        msg.faultCode = "Server.Error.Request";
+        msg.faultString = resourceManager.getString(
+            "messaging", "httpRequestError");
+        var details:String = event.toString();
+        if (_wrappedResponder.message is HTTPRequestMessage)
+        {
+            details += ". URL: ";
+            details += HTTPRequestMessage(_wrappedResponder.message).url;
+        }
+        msg.faultDetail = resourceManager.getString(
+            "messaging", "httpRequestError.details", [ details ]);
+        msg.rootCause = event;
+        _wrappedResponder.status(msg);
+    }
+}
+
+
+[ResourceBundle("messaging")]
+
+/**
+ *  @private
+ *  This is an adapter for url loader that is used by the HTTPChannel.
+ */
+class HTTPMessageResponder extends MessageResponder
+{
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Constructs an HTTPMessageResponder.
+     *
+     *  @param agent The associated MessageAgent.
+     *
+     *  @param msg The message to send.
+     *
+     *  @param channel The Channel to send the message over.
+     */
+    public function HTTPMessageResponder
+        (agent:MessageAgent, msg:IMessage, channel:HTTPChannel)
+    {
+        super(agent, msg, channel);
+        decoder = new AMFXDecoder();
+        urlLoader = new ChannelRequestLoader();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var decoder:AMFXDecoder;
+
+    /**
+     * @private
+     */
+    private var resourceManager:IResourceManager =
+                                    ResourceManager.getInstance();
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  The loader associated with this responder.
+     */
+    public var urlLoader:ChannelRequestLoader;
+
+    //--------------------------------------------------------------------------
+    //
+    // Overridden Protected Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function resultHandler(response:IMessage):void
+    {
+        var errorMsg:ErrorMessage;
+
+        if (response is AsyncMessage)
+        {
+            if (response is ErrorMessage)
+            {
+                agent.fault(ErrorMessage(response), message);
+            }
+            else if (AsyncMessage(response).correlationId == message.messageId)
+            {
+                agent.acknowledge(AcknowledgeMessage(response), message);
+            }
+            else
+            {
+                errorMsg = new ErrorMessage();
+                errorMsg.faultCode = "Server.Acknowledge.Failed";
+                errorMsg.faultString = resourceManager.getString(
+                    "messaging", "ackFailed");
+                errorMsg.faultDetail = resourceManager.getString(
+                    "messaging", "ackFailed.details",
+                    [ message.messageId, AsyncMessage(response).correlationId ]);
+                agent.fault(errorMsg, message);
+            }
+        }
+        else if (response != null)
+        {
+            errorMsg = new ErrorMessage();
+            errorMsg.faultCode = "Server.Acknowledge.Failed";
+            errorMsg.faultString = resourceManager.getString(
+                "messaging", "noAckMessage");
+            errorMsg.faultDetail = resourceManager.getString(
+                "messaging", "noAckMessage.details",
+                [ mx.utils.ObjectUtil.toString(response) ]);
+            agent.fault(errorMsg, message);
+        }
+    }
+
+    /**
+     *  @private
+     *  Handle a request timeout by closing our associated URLLoader and
+     *  faulting the message to the agent.
+     */
+    override protected function requestTimedOut():void
+    {
+        urlLoader.close();
+
+        status(null);
+        // send the ack
+        var ack:AcknowledgeMessage = new AcknowledgeMessage();
+        ack.correlationId = message.messageId;
+        ack.headers[AcknowledgeMessage.ERROR_HINT_HEADER] = true; // hint there was an error
+        agent.acknowledge(ack, message);
+        // send the fault
+        agent.fault(createRequestTimeoutErrorMessage(), message);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    final public function completeHandler(event:Event):void
+    {
+        result(null);
+
+        var raw:String = String(URLLoader(event.target).data);
+        var xmlData:XML = new XML(raw);
+        var packet:AMFXResult = decoder.decode(xmlData);
+        processHeaders(packet);
+
+        if (packet.result is IMessage)
+        {
+            resultHandler(IMessage(packet.result));
+        }
+    }
+
+    /**
+     *  @private
+     */
+    public function errorHandler(event:Event):void
+    {
+        status(null);
+        // send the ack
+        var ack:AcknowledgeMessage = new AcknowledgeMessage();
+        ack.correlationId = message.messageId;
+        ack.headers[AcknowledgeMessage.ERROR_HINT_HEADER] = true; // hint there was an error
+        agent.acknowledge(ack, message);
+        // send fault
+        var msg:ErrorMessage = new ErrorMessage();
+        msg.correlationId = message.messageId;
+        msg.faultCode = "Server.Error.Request";
+        msg.faultString = resourceManager.getString(
+            "messaging", "httpRequestError");
+        var details:String = event.toString();
+        if (message is HTTPRequestMessage)
+        {
+            details += ". URL: ";
+            details += HTTPRequestMessage(message).url;
+        }
+        msg.faultDetail = resourceManager.getString(
+            "messaging", "httpRequestError.details", [ details ]);
+        msg.rootCause = event;
+        agent.fault(msg, message);
+    }
+
+    /**
+     *  @private
+     */
+    public function ioErrorHandler(event:Event):void
+    {
+        status(null);
+        // send the ack
+        var ack:AcknowledgeMessage = new AcknowledgeMessage();
+        ack.correlationId = message.messageId;
+        ack.headers[AcknowledgeMessage.ERROR_HINT_HEADER] = true; // hint there was an error
+        agent.acknowledge(ack, message);
+        // send fault
+        var msg:ErrorMessage = new ErrorMessage();
+        msg.correlationId = message.messageId;
+        msg.faultCode = "Server.Error.Request";
+        msg.faultString = resourceManager.getString(
+            "messaging", "httpRequestError");
+        var details:String = event.toString();
+        if (message is HTTPRequestMessage)
+        {
+            details += ". URL: ";
+            details += HTTPRequestMessage(message).url;
+        }
+        msg.faultDetail = resourceManager.getString(
+            "messaging", "httpRequestError.details", [ details ]);
+        msg.rootCause = event;
+
+        (channel as HTTPChannel).connectionError(msg);
+    }
+
+    /**
+     *  @private
+     */
+    public function securityErrorHandler(event:Event):void
+    {
+        status(null);
+        // send the ack
+        var ack:AcknowledgeMessage = new AcknowledgeMessage();
+        ack.correlationId = message.messageId;
+        ack.headers[AcknowledgeMessage.ERROR_HINT_HEADER] = true; // hint there was an error
+        agent.acknowledge(ack, message);
+        // send fault
+        var msg:ErrorMessage = new ErrorMessage();
+        msg.correlationId = message.messageId;
+        msg.faultCode = "Channel.Security.Error";
+        msg.faultString = resourceManager.getString(
+            "messaging", "securityError");
+        msg.faultDetail = resourceManager.getString(
+            "messaging", "securityError.details", [ message.destination ]);
+        msg.rootCause = event;
+        agent.fault(msg, message);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Private Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Special handler for AMFX packet level header "AppendToGatewayUrl".
+     *  When we receive this header we assume the server detected that a session
+     *  was created but it believed the client could not accept its session
+     *  cookie, so we need to decorate the channel endpoint with the session id.
+     *
+     *  We do not modify the underlying endpoint property, however, as this
+     *  session is transient and should not apply if the channel is disconnected
+     *  and re-connected at some point in the future.
+     */
+    private function AppendToGatewayUrl(value:String):void
+    {
+        if (value != null)
+            (channel as HTTPChannel).appendToURL = value;
+    }
+
+    /**
+     *  @private
+     *  Attempts to replicate the packet-level header functionality that AMFChannel
+     *  uses for response headers such as AppendToGatewayUrl for session id tracking.
+     */
+    private function processHeaders(packet:AMFXResult):void
+    {
+        if (packet.headers != null)
+        {
+            try
+            {
+                for (var i:uint = 0; i < packet.headers.length; i++)
+                {
+                    var header:AMFXHeader = packet.headers[i];
+                    if (header != null && header.name == APPEND_TO_URL_HEADER)
+                    {
+                        AppendToGatewayUrl(String(header.content));
+                    }
+                }
+            }
+            catch(e:Error)
+            {
+            }
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Static Constants
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private static const APPEND_TO_URL_HEADER:String = "AppendToGatewayUrl";
+}
+
+/**
+ *  @private
+ *  Wraps an URLLoader and manages dispatching its events to the proper handlers.
+ */
+class ChannelRequestLoader
+{
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Constructs a ChannelRequestLoader.
+     */
+    public function ChannelRequestLoader()
+    {
+        super();
+        _urlLoader = new URLLoader();
+        _urlLoader.addEventListener(ErrorEvent.ERROR, errorHandler);
+        _urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+        _urlLoader.addEventListener
+            (SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+        _urlLoader.addEventListener(Event.COMPLETE, completeHandler);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  The wrapped URLLoader.
+     */
+    private var _urlLoader:URLLoader;
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    public var errorCallback:Function;
+
+    /**
+     *  @private
+     */
+    public var ioErrorCallback:Function;
+
+    /**
+     *  @private
+     */
+    public var securityErrorCallback:Function;
+
+    /**
+     *  @private
+     */
+    public var completeCallback:Function;
+
+    /**
+     *  @private
+     */
+    public var requestProcessedCallback:Function;
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    public function load(request:URLRequest):void
+    {
+        _urlLoader.load(request);
+    }
+
+    /**
+     *  @private
+     */
+    public function close():void
+    {
+        _urlLoader.removeEventListener(ErrorEvent.ERROR, errorHandler);
+        _urlLoader.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+        _urlLoader.removeEventListener
+            (SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+        _urlLoader.removeEventListener(Event.COMPLETE, completeHandler);
+        _urlLoader.close();
+    }
+
+    /**
+     *  @private
+     */
+    public function setErrorCallbacks(callback:Function):void
+    {
+        errorCallback = callback;
+        ioErrorCallback = callback;
+        securityErrorCallback = callback;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Private Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function callRequestProcessedCallback(event:Event):void
+    {
+        if (requestProcessedCallback != null)
+            requestProcessedCallback(this, event);
+    }
+
+    /**
+     *  @private
+     */
+    private function callEventCallback(callback:Function, event:Event):void
+    {
+        if (callback != null)
+            callback(event);
+    }
+
+    /**
+     *  @private
+     */
+    private function errorHandler(event:Event):void
+    {
+        callRequestProcessedCallback(event);
+        callEventCallback(requestProcessedCallback, event);
+    }
+
+    /**
+     *  @private
+     */
+    private function ioErrorHandler(event:Event):void
+    {
+        callRequestProcessedCallback(event);
+        callEventCallback(ioErrorCallback, event);
+    }
+
+    /**
+     *  @private
+     */
+    private function securityErrorHandler(event:Event):void
+    {
+        callRequestProcessedCallback(event);
+        callEventCallback(securityErrorCallback, event);
+    }
+
+    /**
+     *  @private
+     */
+    private function completeHandler(event:Event):void
+    {
+        callRequestProcessedCallback(event);
+        callEventCallback(completeCallback, event);
+    }
+}
+
+/**
+ *  @private
+ *  This class provides a way to synchronize polling with a subscribe or
+ *  unsubscribe request.  It is constructed in response to a consumer sending
+ *  either a subscribe or unsubscribe command message.  If a successfull
+ *  subscribe/unsubscribe is made this responder will inform the channel
+ *  appropriately.
+ *
+ *  See the PollSyncMessageResponder in NetConnectionChannel - the prototype.
+ */
+class PollSyncHTTPMessageResponder extends HTTPMessageResponder
+{
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Constructs a PollSyncHTTPMessageResponder.
+     *
+     *  @param agent The associated MessageAgent.
+     *
+     *  @param msg The subscribe or unsubscribe message.
+     *
+     *  @param channel The Channel used to send the message.
+     */
+    public function PollSyncHTTPMessageResponder
+        (agent:MessageAgent, msg:IMessage, channel:HTTPChannel)
+    {
+        super(agent, msg, channel);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Overridden Protected Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function resultHandler(response:IMessage):void
+    {
+        super.resultHandler(response);
+        if ((response is AsyncMessage) && (AsyncMessage(response).correlationId == message.messageId))
+        {
+            // notify the channel
+            var cmd:CommandMessage = CommandMessage(message);
+            switch (cmd.operation)
+            {
+                case CommandMessage.SUBSCRIBE_OPERATION:
+                    HTTPChannel(channel).enablePolling();
+                break;
+
+                case CommandMessage.UNSUBSCRIBE_OPERATION:
+                    HTTPChannel(channel).disablePolling();
+                break;
+            }
+        }
+    }
+}
+
+/**
+ *  Helper class for sending a fire-and-forget disconnect message.
+ */
+class HTTPFireAndForgetResponder extends MessageResponder
+{
+    public function HTTPFireAndForgetResponder(message:IMessage)
+    {
+        super(null, message, null);
+    }
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 18576
Author:   aglosban@adobe.com
Date:     2010-11-15T13:31:55.881340Z

Log Message:
-----------
QE notes: Fix typo in RpcClassAliasInitializer.as
Doc notes: No.
Bugs: BLZ-592
Reviewer:
Tests run: Ran tests for RpcClassAliasInitializer locally.
Is noteworthy for integration:

Modified Paths:
--------------
/private/flex/sdk/branches/hero_private/frameworks/projects/rpc/src/mx/utils/RpcClassAliasInitializer.as

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

--- frameworks/projects/rpc/src/mx/utils/RpcClassAliasInitializer.as
+++ frameworks/projects/rpc/src/mx/utils/RpcClassAliasInitializer.as
@@ -44,6 +44,7 @@
 import mx.messaging.messages.MessagePerformanceInfo;
 import mx.messaging.messages.RemotingMessage;
 import mx.messaging.messages.SOAPMessage;
+import mx.utils.ObjectProxy;

 public class RpcClassAliasInitializer
 {
@@ -75,8 +76,7 @@
         registerClassAlias("flex.messaging.messages.ErrorMessage", ErrorMessage);
         registerClassAlias("flex.messaging.messages.HTTPMessage", HTTPRequestMessage);
         registerClassAlias("flex.messaging.messages.MessagePerformanceInfo", MessagePerformanceInfo);
-        registerClassAlias("flex.messaging.io.ObjectProxy", ObjectProxy);
-        registerClassAlias("flex.messaging.messages.ObjectProxy", RemotingMessage);
+        registerClassAlias("flex.messaging.messages.RemotingMessage", RemotingMessage);
         registerClassAlias("flex.messaging.messages.SOAPMessage", SOAPMessage);

         // management classes - these are used in the flexadmin GUI program,


FLEX-27855 Changed value to display "," when decimal separator is ","

--- frameworks/projects/spark/src/spark/components/NumericStepper.as
+++ frameworks/projects/spark/src/spark/components/NumericStepper.as
@@ -689,7 +689,10 @@
             textDisplay.maxChars = _maxChars;
             // Restrict to digits, minus sign, decimal point, and comma
             textDisplay.restrict = "0-9\\-\\.\\,";
-            textDisplay.text = value.toString();
+			if (dataFormatter != null)
+          		textDisplay.text = dataFormatter.format(value);
+			else
+				textDisplay.text = value.toString();
             // Set the the textDisplay to be wide enough to display
             // widest possible value.
             textDisplay.widthInChars = calculateWidestValue();
@@ -857,8 +860,10 @@
     {
         if (valueFormatFunction != null)
             textDisplay.text = valueFormatFunction(value);
-        else
-            textDisplay.text = value.toString();
+        else if (dataFormatter != null)
+            textDisplay.text = dataFormatter.format(value);
+		else
+			textDisplay.text = value.toString();
     }

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


Clean code

Clean code


no longer restricting stringValues array value type

--- WeaveData/src/weave/data/KeySets/StringDataFilter.as
+++ WeaveData/src/weave/data/KeySets/StringDataFilter.as
@@ -33,7 +33,9 @@
 		public const enabled:LinkableBoolean = registerLinkableChild(this, new LinkableBoolean(true), _cacheVars);
 		public const includeMissingKeyTypes:LinkableBoolean = registerLinkableChild(this, new LinkableBoolean(true), _cacheVars);
 		public const column:DynamicColumn = newLinkableChild(this, DynamicColumn, _resetKeyLookup);
-		public const stringValues:LinkableVariable = registerLinkableChild(this, new LinkableVariable(Array, verifyStringArray), _resetKeyLookup);
+		public const stringValues:LinkableVariable = registerLinkableChild(this, new LinkableVariable(Array), _resetKeyLookup);
+
+		//[Deprecated(replacement="values")] public function get stringValues():LinkableVariable { return values; }

 		private var _enabled:Boolean;
 		private var _includeMissingKeyTypes:Boolean;
@@ -41,11 +43,6 @@
 		private var _numberLookup:Object;
 		private var _keyType:String;
 		private var _keyLookup:Dictionary = new Dictionary(true);
-
-		private function verifyStringArray(array:Array):Boolean
-		{
-			return !array || !array.length || StandardLib.getArrayType(array) == String;
-		}

 		private function _cacheVars():void
 		{


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

--- frameworks/projects/automation_air/src/mx/automation/events/AutomationFlexNativeMenuEvent.as
+++ frameworks/projects/automation_air/src/mx/automation/events/AutomationFlexNativeMenuEvent.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2009 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.
 //
 ////////////////////////////////////////////////////////////////////////////////


def: 3876 intelli seek didn't work

def: 3876 intelli seek didn't work

git-svn-id: 3f608e5a9a704dd448217c0a64c508e7f145cfa1@84289 6b8eccd3-e8c5-4e7d-8186-e12b5326b719

--- kdp3Lib/src/com/kaltura/kdpfl/view/media/KMediaPlayerMediator.as
+++ kdp3Lib/src/com/kaltura/kdpfl/view/media/KMediaPlayerMediator.as
@@ -1285,7 +1285,7 @@
 			//we don't need to clean the media if it's empty
 			if(!player.media) return;

-			if (player.media.hasOwnProperty("cleanMedia") || player.state == MediaPlayerState.PLAYING)
+			if (player.media.hasOwnProperty("cleanMedia") || (player.state == MediaPlayerState.PLAYING && !_isIntelliSeeking))
 				sendNotification( NotificationType.DO_STOP );

 			if(player.displayObject)


Test Map generation fixed

Test Map generation fixed

Test Map generation fixed

--- src/ageofai/map/view/MapView.as
+++ src/ageofai/map/view/MapView.as
@@ -17,6 +17,9 @@

 	public class MapView extends ABaseView
 	{
+		private var _terrainLayer:Sprite;
+		private var _unitLayer:Sprite;
+
 		private var _baseBackground:Bitmap;

 		private var _terrainHelper:TerrainHelper;
@@ -31,7 +34,7 @@

 				for( var j:int = 0; j < CMap.COLUMN_COUNT; j++ )
 				{
-					testMap[ i ].push( new MapNode() );
+					testMap[ i ].push( new MapNode( 1 ) );
 				}
 			}


Revert useless change on AbstractSceneNode

--- src/aerys/minko/scene/node/AbstractSceneNode.as
+++ src/aerys/minko/scene/node/AbstractSceneNode.as
@@ -32,8 +32,7 @@
 		private var _transformData		: TransformDataProvider			= new TransformDataProvider();
 		private var _transform			: Matrix4x4						= new Matrix4x4();

-		private var _privateControllers	: Vector.<AbstractController>	= new <AbstractController>[];
-		private var _publicControllers	: Vector.<AbstractController>	= new <AbstractController>[];
+		private var _controllers		: Vector.<AbstractController>	= new <AbstractController>[];

 		private var _added				: Signal						= new Signal('AbstractSceneNode.added');
 		private var _removed			: Signal						= new Signal('AbstractSceneNode.removed');
@@ -133,7 +132,7 @@

 		public function get numControllers() : uint
 		{
-			return _publicControllers.length;
+			return _controllers.length;
 		}

 		public function get controllerAdded() : Signal
@@ -225,7 +224,7 @@

 		public function addController(controller : AbstractController) : ISceneNode
 		{
-			_publicControllers.push(controller);
+			_controllers.push(controller);

 			controller.addTarget(this);
 			_controllerAdded.execute(this, controller);
@@ -235,10 +234,10 @@

 		public function removeController(controller : AbstractController) : ISceneNode
 		{
-			var numControllers	: uint = _publicControllers.length - 1;
-
-			_publicControllers[_publicControllers.indexOf(controller)] = _publicControllers[numControllers];
-			_publicControllers.length = numControllers;
+			var numControllers	: uint = _controllers.length - 1;
+
+			_controllers[_controllers.indexOf(controller)] = _controllers[numControllers];
+			_controllers.length = numControllers;

 			controller.removeTarget(this);
 			_controllerRemoved.execute(this, controller);
@@ -256,7 +255,7 @@

 		public function getController(index : uint) : AbstractController
 		{
-			return _publicControllers[index];
+			return _controllers[index];
 		}

 		public function getControllersByType(type			: Class,


helper removed

helper removed

--- helpers/Croppa.as
+++ helpers/Croppa.as
@@ -1,34 +0,0 @@
-package com.bkwld {
-
-	/**
-	 * An ActionScript port of https://raw.github.com/BKWLD/croppa/master/public/js/croppa.js
-	 */
-	public class Croppa {
-
-		/**
-		 * Build a croppa formatted URL
-		 * @param  src     Absolute path to the source image
-		 * @param  width   Width to crop to.  Set to -1, 0, or NaN to make it wildcarded
-		 * @param  height  Height to crop to.  Set to -1, 0, or NaN to make it wildcarded
-		 * @param  options Addtional Croppa options, passed as key/value pairs.  Like ['resize']
-		 * @return A Croppa-friendly URL
-		 */
-		static public function url(src:String, width:Number = NaN, height:Object = NaN, options:Object = null):String {
-
-			// Produce the croppa syntax
-			var suffix:String = '-';
-			if (width > 0 && (!height || height <= 0)) suffix += String(width)+'x_';
-			else if ((!width || width <= 0) && height > 0) suffix += '_x'+String(height);
-			else if (width > 0 && height > 0) suffix += String(width)+'x'+String(height);
-			else suffix += '_x_';
-
-			// Disable options for now
-			if (options) throw new Error('Croppa.url options not supported yet');
-
-			// Break the path apart and put back together again
-			return src.replace(/^(.+)(\.[a-z]+)$/i, "$1"+suffix+"$2");
-
-		}
-
-	}
-}


TextField size fixed \n \r \t chars fixed

--- src/com/benoitfreslon/layoutmanager/LayoutLoader.as
+++ src/com/benoitfreslon/layoutmanager/LayoutLoader.as
@@ -195,7 +195,6 @@
 			text = text.replace("\\n", "\n");
 			text = text.replace("\\t", "\t");
 			t.text = text;
-			trace(child.width);
 			t.width = child.width;
 			t.height = child.height;
 			return t;


Transferred from the Adobe Open Source Subversion Repository

Revision: 18635
Author:   aharui@adobe.com
Date:     2010-11-17T00:18:36.469040Z

Log Message:
-----------
Add estimatedSizes to the layout infrastructure to better deal with text reflow.
Add new events to layout infrastructure to deal with caching of size information

QE notes: New APIs and Interfaces
Doc notes: New APIs and interfaces
Bugs: SDK-27226, SDK-26155, SDK-25483, SDK-23621, SDK-27225, SDK-26993, SDK-25535, SDK-25521
Reviewer: Evtim
Tests run: checkintests mustella full run
Is noteworthy for integration: yes

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/TileLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/TextBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/layoutClasses/PriorityQueue.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/core/Application.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/RichEditableText.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/primitives/supportClasses/GraphicElement.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/BasicLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Group.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/PopUpAnchor.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/flash-integration/src/mx/flash/UIMovieClip.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/FlexEvent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/styles/StyleProtoChain.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/core/SpriteVisualElement.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/IContainerInvalidating.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/basicTests/spark/scripts/FormTestScript.mxml</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/ILayoutManagerContainerClient.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/DefaultItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/VerticalLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/styles/IStyleManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/ILayoutElement.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/GridLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/TextFieldGridItemRendererInclude.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/styles/StyleManagerImpl.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/core/Container.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/LayoutManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Application.as</path>

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

--- frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as
+++ frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as
@@ -18,11 +18,15 @@
 import flash.geom.Rectangle;
 import flash.utils.Timer;

+import mx.core.FlexVersion;
+import mx.core.IContainerInvalidating;
 import mx.core.ILayoutElement;
 import mx.core.UIComponentGlobals;
 import mx.core.mx_internal;
 import mx.events.DragEvent;
+import mx.events.FlexEvent;
 import mx.managers.ILayoutManagerClient;
+import mx.managers.ILayoutManagerContainerClient;
 import mx.utils.OnDemandEventDispatcher;

 import spark.components.supportClasses.GroupBase;
@@ -77,6 +81,17 @@
 {
     //--------------------------------------------------------------------------
     //
+    //  Class Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private static var estimatedSize:Point = new Point;
+
+    //--------------------------------------------------------------------------
+    //
     //  Constructor
     //
     //--------------------------------------------------------------------------
@@ -498,6 +513,156 @@
     //  Methods
     //
     //--------------------------------------------------------------------------
+
+    /**
+     *  Called if constraints are changed on the GroupBase
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+	public function setEstimatedSize(estimatedWidth:Number = NaN,
+									 estimatedHeight:Number = NaN,
+									 invalidateSize:Boolean = true):void
+    {
+
+    }
+
+
+    /**
+     *  default logic for computing constraints.  Similar logic in
+     *  UIComponent.
+     *
+     *  @param layoutElement the element whose size should be estimated
+     *  @param percentWidth normally the layoutElement's percentWidth, but this number
+     *  can be adjusted by the layout to compensate for when the sum of percentages
+     *  of all elements is greater than 100
+     *  @param percentHeight normally the layoutElement's percentHeight, but this number
+     *  can be adjusted by the layout to compensate for when the sum of percentages
+     *  of all elements is greater than 100
+     *  @param parentEstimatedWidth normally the layout target's estimatedWidth, but this number
+     *  can be adjusted by the layout to compensate for when some elements have fixed width
+     *  so the percentage should be applied against the remaining "flexible" area
+     *  @param parentEstimatedHeight normally the layout target's estimatedHeight, but this number
+     *  can be adjusted by the layout to compensate for when some elements have fixed height
+     *  so the percentage should be applied against the remaining "flexible" area
+     *  @param estimatedSize the structure to be filled out by this method.  It is a
+     *  Point and the x property maps to the estimatedWidth and y maps to estimatedHeight. The
+     *  calling function takes the returned Point and calls setEstimatedSize on the element
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    protected function estimateSizeOfElement(layoutElement:ILayoutElement,
+        percentWidth:Number, percentHeight:Number,
+        parentEstimatedWidth:Number, parentEstimatedHeight:Number, estimatedSize:Point):void
+    {
+        var hCenter:Number   = LayoutElementHelper.parseConstraintValue(layoutElement.horizontalCenter);
+        var vCenter:Number   = LayoutElementHelper.parseConstraintValue(layoutElement.verticalCenter);
+        var baseline:Number  = LayoutElementHelper.parseConstraintValue(layoutElement.baseline);
+        var left:Number      = LayoutElementHelper.parseConstraintValue(layoutElement.left);
+        var right:Number     = LayoutElementHelper.parseConstraintValue(layoutElement.right);
+        var top:Number       = LayoutElementHelper.parseConstraintValue(layoutElement.top);
+        var bottom:Number    = LayoutElementHelper.parseConstraintValue(layoutElement.bottom);
+        var pc:Number;
+        var cw:Number;
+        var ch:Number;
+        var c:Number;
+        c = parentEstimatedWidth;
+        if (!isNaN(c))
+        {
+            if (!isNaN(percentWidth))
+                cw = percentWidth * c / 100;
+            else if (!isNaN(left) && !isNaN(right))
+            {
+                cw = c - left - right;
+            }
+        }
+        c = parentEstimatedHeight;
+        if (!isNaN(c))
+        {
+            if (!isNaN(percentHeight))
+                ch = percentHeight * c / 100;
+            else if (!isNaN(top) && !isNaN(bottom))
+                ch = c - top - bottom;
+        }
+        estimatedSize.x = cw;
+        estimatedSize.y = ch;
+    }
+
+    /**
+     *  Compute the estimatedWidth and estimatedHeight on the
+     *  elements.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    public function estimateSizesOfElements():void
+    {
+        var layoutTarget:GroupBase = target;
+        if (!layoutTarget)
+            return;
+
+        var count:int = layoutTarget.numElements;
+        if (_typicalLayoutElement &&
+            ((count == 0) ||
+             (count &&
+              _typicalLayoutElement != layoutTarget.getElementAt(0))))
+        {
+            computeEstimatedSizeOfElement(_typicalLayoutElement);
+        }
+
+        for (var i:int = 0; i < count; i++)
+        {
+            var layoutElement:ILayoutElement = layoutTarget.getElementAt(i);
+            computeEstimatedSizeOfElement(layoutElement);
+        }
+    }
+
+    mx_internal function computeEstimatedSizeOfElement(layoutElement:ILayoutElement):void
+    {
+        var cw:Number;
+        var ch:Number;
+        var oldcw:Number;
+        var oldch:Number;
+        var sameWidth:Boolean;
+        var sameHeight:Boolean;
+
+        if (!layoutElement)
+            return;
+        if (!layoutElement.includeInLayout)
+            return;
+        oldcw = layoutElement.estimatedWidth;
+        oldch = layoutElement.estimatedHeight;
+        cw = target.estimatedWidth;
+        if (isNaN(cw) && !isNaN(target.explicitWidth))
+            cw = target.explicitWidth;
+        ch = target.estimatedHeight;
+        if (isNaN(ch) && !isNaN(target.explicitHeight))
+            ch = target.explicitHeight;
+        estimatedSize.x = estimatedSize.y = NaN;
+        estimateSizeOfElement(layoutElement,
+            layoutElement.percentWidth,
+            layoutElement.percentHeight,
+            cw, ch, estimatedSize);
+        layoutElement.setEstimatedSize(estimatedSize.x, estimatedSize.y);
+        if (layoutElement is ILayoutManagerContainerClient)
+        {
+            sameWidth = isNaN(estimatedSize.x) && isNaN(oldcw) || estimatedSize.x == oldcw;
+            sameHeight = isNaN(estimatedSize.y) && isNaN(oldch) || estimatedSize.y == oldch;
+            if (!(sameHeight && sameWidth))
+            {
+                if (layoutElement is IContainerInvalidating)
+                    IContainerInvalidating(layoutElement).invalidateEstimatedSizesOfChildren();
+                ILayoutManagerContainerClient(layoutElement).validateEstimatedSizesOfChildren();
+            }
+        }
+    }

     /**
      *  Measures the target's default size based on its content, and optionally
@@ -617,6 +782,11 @@
      */
      public function elementAdded(index:int):void
      {
+         if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_5)
+         {
+             var layoutElement:ILayoutElement = target.getElementAt(index);
+             computeEstimatedSizeOfElement(layoutElement);
+         }
      }

     /**
@@ -1837,5 +2007,6 @@
         }
         return local;
     }
+
 }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 9715
Author:   aharui@adobe.com
Date:     2009-08-27T21:20:28.280781Z

Log Message:
-----------
Introduce tabFocusEnabled to IFocusManagerComponent.  This replaces tabEnabled as the way to remove a component from the tabbing loop.  tabEnabled should be set to true for any component that can receive focus, and tabFocusEnabled determines whether the FocusManager will actually give it focus.  If tabEnabled=false on a non-TextField, the player will sometimes momentarily remove focus and dispatch a focusOut when the component has focus and is later clicked on.  This is now quite common with TLF-based text components so we are forced to make this change.

QE Notes: tests using tabEnabled must now use tabFocusEnabled
Doc Notes: needs documentation
Bugs: SDK-22731
Reviewer: Gordon
API Change: Yes
Is noteworthy for integration: Yes
tests: checkintests cyclone

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/Window.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ComboBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/FlexHTMLLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/accordionClasses/AccordionHeader.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/IFocusManagerComponent.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/flash-integration/src/mx/flash/UIMovieClip.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ButtonBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DateChooser.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/FlexEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Accordion.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/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/sliderClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Image.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/TabNavigator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>

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

--- frameworks/projects/mx/src/mx/core/Container.as
+++ frameworks/projects/mx/src/mx/core/Container.as
@@ -484,6 +484,7 @@
         super();

         tabEnabled = false;
+        tabFocusEnabled = false;

         showInAutomationHierarchy = false;

@@ -1899,7 +1900,7 @@
      *
      *
Note:If you call the addChild or
      *  addChildAt method of the rawChildren object,
-     *  set tabEnabled = false on the component that you have added.
+     *  set tabFocusEnabled = false on the component that you have added.
      *  Doing so prevents users from tabbing to the visual-only component
      *  that you have added.

      *


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

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

 package mx.collections
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 3297
Author:   jimurphy@adobe.com
Date:     2008-09-22T17:59:53.303960Z

Log Message:
-----------
Merge 3.0.x revisions 3260,3262,3266,3271,3276,3282,3285,3292,3294 -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/events/FaultEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ProgressBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/events/ResultEvent.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/framework/src/mx/managers/FocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/dragClasses/DragProxy.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/AbstractInvoker.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/soap/Operation.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManagerProxy.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/IFocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/messages/AbstractMessage.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/Fault.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ISWFBridgeProvider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridHeader.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/framework/src/mx/core/ISWFBridgeGroup.as</path>

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

--- frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as
+++ frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as
@@ -194,6 +194,14 @@
 	 */
 	private var mouseCatcher:Sprite;

+    /**
+     *  @private
+     *  Map a bridge to a FocusManager. This is only for Focus Managers that is
+     *  not the focus manager for document. Since the bridges are not in document
+     *  they are bridges inside of pop ups.
+     */
+     private var bridgeToFocusManager:Dictionary;
+
 	//----------------------------------
 	//  applicationIndex
 	//----------------------------------
@@ -909,7 +917,7 @@
 				return forms[i];
 		}

-		throw new Error();  // shouldn't get here
+		return null;  // shouldn't get here
 	}

@@ -1699,12 +1707,37 @@
 	 */
 	public function addChildBridge(bridge:IEventDispatcher, owner:DisplayObject):void
 	{
-		if (!swfBridgeGroup)
-			swfBridgeGroup = new SWFBridgeGroup(this);
+        // Is the owner in a pop up? If so let the focus manager manage the
+        // bridge instead of the system manager.
+        var fm:IFocusManager = null;
+        var o:DisplayObject = owner;
+
+        while (o)
+        {
+            if (o is IFocusManagerContainer)
+            {
+                fm = IFocusManagerContainer(o).focusManager;
+                break;
+            }
+
+            o = o.parent;
+        }
+
+        if (!fm)
+            return;
+
+        if (!swfBridgeGroup)
+            swfBridgeGroup = new SWFBridgeGroup(this);

         swfBridgeGroup.addChildBridge(bridge, ISWFBridgeProvider(owner));
+        fm.addSWFBridge(bridge, owner);
+
+        if (!bridgeToFocusManager)
+            bridgeToFocusManager = new Dictionary();
+
+        bridgeToFocusManager[bridge] = fm;
+
         addChildBridgeListeners(bridge);
-		IFocusManagerContainer(document).focusManager.addSWFBridge(bridge);
 	}

 	/**
@@ -1712,8 +1745,11 @@
 	 */
 	public function removeChildBridge(bridge:IEventDispatcher):void
 	{
-		IFocusManagerContainer(document).focusManager.removeSWFBridge(bridge);
-   		swfBridgeGroup.removeChildBridge(bridge);
+        var fm:IFocusManager = IFocusManager(bridgeToFocusManager[bridge]);
+        fm.removeSWFBridge(bridge);
+        swfBridgeGroup.removeChildBridge(bridge);
+
+        delete bridgeToFocusManager[bridge];
         removeChildBridgeListeners(bridge);
 	}

@@ -2212,7 +2248,6 @@
      *   no other action is required.
      */
     private function preProcessModalWindowRequest(request:SWFBridgeRequest,
-                                                  sm:ISystemManager,
                                                   sbRoot:DisplayObject):Boolean
     {
         // should we process this message?
@@ -2222,9 +2257,9 @@
             // but don't skip the next one.
             request.data.skip = false;

-            if (sm.useSWFBridge())
+            if (useSWFBridge())
             {
-                var bridge:IEventDispatcher = sm.swfBridgeGroup.parentBridge;
+                var bridge:IEventDispatcher = swfBridgeGroup.parentBridge;
                 request.requestor = bridge;
                 bridge.dispatchEvent(request);
             }
@@ -2232,36 +2267,40 @@
         }

         // if we are not the sandbox root, dispatch the message to the sandbox root.
-        if (sm != sbRoot)
+        if (this != sbRoot)
         {
-            var forwardRequest:Boolean = false;
-
             // convert exclude component into a rectangle and forward to parent bridge.
             if (request.type == SWFBridgeRequest.CREATE_MODAL_WINDOW_REQUEST ||
                 request.type == SWFBridgeRequest.SHOW_MODAL_WINDOW_REQUEST)
             {
-                var exclude:ISWFLoader = sm.swfBridgeGroup.getChildBridgeProvider(request.requestor)
+                var exclude:ISWFLoader = swfBridgeGroup.getChildBridgeProvider(request.requestor)
                                                  as ISWFLoader;
-                var excludeRect:Rectangle = ISWFLoader(exclude).getVisibleApplicationRect();
-                request.data.excludeRect = excludeRect;
-                forwardRequest = true;
+
+                // find the rectangle of the area to exclude
+                if (exclude)
+                {
+                    var excludeRect:Rectangle = ISWFLoader(exclude).getVisibleApplicationRect();
+                    request.data.excludeRect = excludeRect;
+
+                    // If the area to exclude is not contain by our document then it is in a
+                    // pop up. From this point for set the useExclude flag to false to
+                    // tell our parent not to exclude use from their modal window, only
+                    // the excludeRect we have just calculated.
+                    if (!DisplayObjectContainer(document).contains(DisplayObject(exclude)))
+                        request.data.useExclude = false;  // keep the existing excludeRect
+                }
             }
-            else if (request.type == SWFBridgeRequest.HIDE_MODAL_WINDOW_REQUEST)
-                forwardRequest = true;

-            if (forwardRequest)
-            {
-                bridge = sm.swfBridgeGroup.parentBridge;
-                request.requestor = bridge;
-
-                // The HIDE request does not need to be processed by each
-                // application, so dispatch it directly to the sandbox root.
-                if (request.type == SWFBridgeRequest.HIDE_MODAL_WINDOW_REQUEST)
-                    sbRoot.dispatchEvent(request);
-                else
-                    bridge.dispatchEvent(request);
-                return false;
-            }
+            bridge = swfBridgeGroup.parentBridge;
+            request.requestor = bridge;
+
+            // The HIDE request does not need to be processed by each
+            // application, so dispatch it directly to the sandbox root.
+            if (request.type == SWFBridgeRequest.HIDE_MODAL_WINDOW_REQUEST)
+                sbRoot.dispatchEvent(request);
+            else
+                bridge.dispatchEvent(request);
+            return false;
         }

         // skip aftering sending the message over a bridge.
@@ -2270,7 +2309,6 @@
         return true;
     }

-
 	private function otherSystemManagerMouseListener(event:SandboxMouseEvent):void
 	{
 		if (dispatchingToSystemManagers)
@@ -2820,7 +2858,7 @@
 			var actualType:String = EventUtil.sandboxMouseEventMap[type];
 			if (actualType)
 			{
-				if (getSandboxRoot() == this)
+                if (getSandboxRoot() == this && eventProxy)
                     super.removeEventListener(actualType, eventProxy.marshalListener,
                             useCapture);
 				if (!SystemManagerGlobals.changingListenersInOtherSystemManagers)
@@ -3521,7 +3559,7 @@

         var request:SWFBridgeRequest = SWFBridgeRequest.marshal(event);

-        if (!preProcessModalWindowRequest(request, this, getSandboxRoot()))
+        if (!preProcessModalWindowRequest(request, getSandboxRoot()))
             return;

         // Ensure a PopUpManager exists and dispatch the request it is
@@ -3547,7 +3585,15 @@
         var rect:Rectangle = Rectangle(request.data);
         var owner:DisplayObject = DisplayObject(swfBridgeGroup.getChildBridgeProvider(request.requestor));
         var localRect:Rectangle;
+        var forwardRequest:Boolean = true;

+        // Check if the request in a pop up. If it is then don't
+        // forward the request to our parent because we don't want
+        // to reduce the visible rect of the dialog base on the
+        // visible rect of applications in the main app.
+        if (!DisplayObjectContainer(document).contains(owner))
+            forwardRequest = false;
+
         if (owner is ISWFLoader)
             localRect = ISWFLoader(owner).getVisibleApplicationRect();
         else
@@ -3562,9 +3608,9 @@
         request.data = rect;

         // forward request
-        if (useSWFBridge())
+        if (forwardRequest && useSWFBridge())
         {
-        var bridge:IEventDispatcher = swfBridgeGroup.parentBridge;
+            var bridge:IEventDispatcher = swfBridgeGroup.parentBridge;
             request.requestor = bridge;
             bridge.dispatchEvent(request);
         }
@@ -4019,6 +4065,11 @@
 			event["value"] = currentSandboxEvent == event["value"];
 			return;
 		}
+		else if (event["name"] == "hasSWFBridges")
+		{
+			event["value"] = hasSWFBridges();
+			return;
+		}

 		// if we are broadcasting messages, ignore the messages
 		// we send to ourselves.
@@ -4060,6 +4111,13 @@
 	    case "getVisibleApplicationRect":
 	        event["value"] = getVisibleApplicationRect();
 			break;
+        case "bringToFront":
+            if (event["value"].topMost)
+                popUpChildren.setChildIndex(DisplayObject(event["value"].popUp), popUpChildren.numChildren - 1);
+            else
+                setChildIndex(DisplayObject(event["value"].popUp), numChildren - 1);
+
+            break;
 		}
 	}


Transferred from the Adobe Open Source Subversion Repository

Revision: 3222
Author:   jimurphy@adobe.com
Date:     2008-09-16T14:09:08.134976Z

Log Message:
-----------
Merged 3.0.x revisions 3157,3162,3165-3166,3168,3177,3180-3183,3185,3187,3189,3199 -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/TileList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RadioButton.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/config/ServerConfig.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/LayoutManager.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/build_framework.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/NumericStepper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Button.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterDragManagerEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UITextFormat.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridHeader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterManagerRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as</path>

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

--- frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as
+++ frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as
@@ -1226,6 +1226,10 @@
 		if (getSandboxRoot() == this)
 		{
 			addEventListener(InterManagerRequest.SYSTEM_MANAGER_REQUEST, systemManagerHandler);
+			addEventListener(InterManagerRequest.DRAG_MANAGER_REQUEST, multiWindowRedispatcher);
+			// listened for w/o use of constants because of dependency issues
+			//addEventListener(InterDragManagerEvent.DISPATCH_DRAG_EVENT, multiWindowRedispatcher);
+			addEventListener("dispatchDragEvent", multiWindowRedispatcher);

             addEventListener(SWFBridgeRequest.ADD_POP_UP_REQUEST, addPopupRequestHandler);
             addEventListener(SWFBridgeRequest.REMOVE_POP_UP_REQUEST, removePopupRequestHandler);
@@ -2072,6 +2076,21 @@

 	private var dispatchingToSystemManagers:Boolean = false;

+	private function dispatchEventToOtherSystemManagers(event:Event):void
+	{
+		dispatchingToSystemManagers = true;
+		var arr:Array = SystemManagerGlobals.topLevelSystemManagers;
+		var n:int = arr.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			if (arr[i] != this)
+			{
+				arr[i].dispatchEvent(event);
+			}
+		}
+		dispatchingToSystemManagers = false;
+	}
+
 	/**
 	 *  dispatch the event to all sandboxes except the specified one
 	 */
@@ -2080,17 +2099,7 @@
 	{
 		if (toOtherSystemManagers)
 		{
-			dispatchingToSystemManagers = true;
-			var arr:Array = SystemManagerGlobals.topLevelSystemManagers;
-			var n:int = arr.length;
-			for (var i:int = 0; i < n; i++)
-			{
-				if (arr[i] != this)
-				{
-					arr[i].dispatchEvent(event);
-				}
-			}
-			dispatchingToSystemManagers = false;
+			dispatchEventToOtherSystemManagers(event);
 		}

 		if (!swfBridgeGroup)
@@ -2104,11 +2113,15 @@
 		var parentBridge:IEventDispatcher = swfBridgeGroup.parentBridge;
 		if (parentBridge && parentBridge != skip)
 		{
+            // Ensure the requestor property has the correct bridge.
+            if (clone is SWFBridgeRequest)
+                SWFBridgeRequest(clone).requestor = parentBridge;
+
 			parentBridge.dispatchEvent(clone);
 		}

 		var children:Array = swfBridgeGroup.getChildBridges();
-		for (i = 0; i < children.length; i++)
+		for (var i:int = 0; i < children.length; i++)
 		{
 			if (children[i] != skip)
 			{
@@ -2116,6 +2129,11 @@
 				clone = event.clone();
 				if (trackClones)
 					currentSandboxEvent = clone;
+
+                // Ensure the requestor property has the correct bridge.
+                if (clone is SWFBridgeRequest)
+                    SWFBridgeRequest(clone).requestor = IEventDispatcher(children[i]);
+
 				IEventDispatcher(children[i]).dispatchEvent(clone);
 			}
 		}
@@ -2293,53 +2311,70 @@
 			dispatchEvent(marshaledEvent);
 	}

-	private function eventListenerRequestHandler(event:Event):void
-	{
-		if (event is EventListenerRequest)
-			return;
+    private function eventListenerRequestHandler(event:Event):void
+    {
+        if (event is EventListenerRequest)
+            return;

         var actualType:String;
-		var request:EventListenerRequest = EventListenerRequest.marshal(event);
-		if (event.type == EventListenerRequest.ADD_EVENT_LISTENER_REQUEST)
-		{
-			if (!eventProxy)
-			{
-				eventProxy = new EventProxy(this);
-			}
-
-			actualType = EventUtil.sandboxMouseEventMap[request.eventType];
-			if (actualType)
-			{
-				if (isTopLevelRoot())
-				{
-					stage.addEventListener(MouseEvent.MOUSE_MOVE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
-				}
-				else
-				{
-					super.addEventListener(MouseEvent.MOUSE_MOVE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
-				}
-
-				addEventListenerToSandboxes(request.eventType, sandboxMouseListener,
-							request.useCapture, request.priority, request.useWeakReference, event.target as IEventDispatcher);
-				if (getSandboxRoot() == this)
+        var request:EventListenerRequest = EventListenerRequest.marshal(event);
+        if (event.type == EventListenerRequest.ADD_EVENT_LISTENER_REQUEST)
+        {
+            if (!eventProxy)
+            {
+                eventProxy = new EventProxy(this);
+            }
+
+            actualType = EventUtil.sandboxMouseEventMap[request.eventType];
+            if (actualType)
+            {
+                if (isTopLevelRoot())
+                {
+                    stage.addEventListener(MouseEvent.MOUSE_MOVE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
+                }
+                else
+                {
+                    super.addEventListener(MouseEvent.MOUSE_MOVE, resetMouseCursorTracking, true, EventPriority.CURSOR_MANAGEMENT + 1, true);
+                }
+
+                // add listeners in other sandboxes in capture mode so we don't miss anything
+                addEventListenerToSandboxes(request.eventType, sandboxMouseListener,
+                            true, request.priority, request.useWeakReference, event.target as IEventDispatcher);
+                addEventListenerToOtherSystemManagers(request.eventType, otherSystemManagerMouseListener,
+                            true, request.priority, request.useWeakReference);
+                if (getSandboxRoot() == this)
+                {
+                    if (isTopLevelRoot() && actualType == MouseEvent.MOUSE_UP)
+                    {
+                        stage.addEventListener(actualType, eventProxy.marshalListener,
+                            false, request.priority, request.useWeakReference);
+                    }
+
                     super.addEventListener(actualType, eventProxy.marshalListener,
-                            request.useCapture, request.priority, request.useWeakReference);
-			}
-		}
-		else if (event.type == EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST)
+                        true, request.priority, request.useWeakReference);
+                }
+            }
+        }
+        else if (event.type == EventListenerRequest.REMOVE_EVENT_LISTENER_REQUEST)
         {
             actualType = EventUtil.sandboxMouseEventMap[request.eventType];
             if (actualType)
             {
+                removeEventListenerFromOtherSystemManagers(request.eventType, otherSystemManagerMouseListener, true);
                 removeEventListenerFromSandboxes(request.eventType, sandboxMouseListener,
-                            request.useCapture, event.target as IEventDispatcher);
+                            true, event.target as IEventDispatcher);
                 if (getSandboxRoot() == this)
-                    super.removeEventListener(actualType, eventProxy.marshalListener,
-                            request.useCapture);
+                {
+                    if (isTopLevelRoot() && actualType == MouseEvent.MOUSE_UP)
+                    {
+                        stage.removeEventListener(actualType, eventProxy.marshalListener);
+                    }
+
+                    super.removeEventListener(actualType, eventProxy.marshalListener, true);
+                }
             }
-        }
-	}
-
+        }
+    }

 	/**
 	 *  Returns true if the given DisplayObject is the
@@ -2590,21 +2625,11 @@
 		}
 	}

-		// VERSION_SKEW
 	/**
 	 * @private
 	 *
-	 * true if dispatching a mouse bridge event. We don't want to
-	 * handle our own event.
-	 */
-	private var isDispatchingBridgeMouseEvent:Boolean;
-
-	/**
-	 * @private
-	 *
 	 * true if redipatching a resize event.
 	 */
-	 // TODODJL: may be a better of way than dispathing resize event.
 	private var isDispatchingResizeEvent:Boolean;

 	/**
@@ -2645,13 +2670,10 @@

 			try
 			{
-				// TODODJL: problem loading untrusted children, stage is null and we don't
-				// add the listener we wanted.
 				if (stage)
 					stage.addEventListener(type, listener, useCapture, priority, useWeakReference);
 				else
 					super.addEventListener(type, listener, useCapture, priority, useWeakReference);
-
 			}
 			catch (error:SecurityError)
 			{
@@ -2754,10 +2776,12 @@

 			try
 			{
-				if (stage)
-					stage.removeEventListener(type, listener, useCapture);
-				else
-					super.removeEventListener(type, listener, useCapture);
+                // Remove both listeners in case the system manager was added
+                // or removed from the stage after the listener was added.
+                if (stage)
+                    stage.removeEventListener(type, listener, useCapture);
+
+                super.removeEventListener(type, listener, useCapture);
 			}
 			catch (error:SecurityError)
 			{
@@ -3187,7 +3211,8 @@
         // popup, then don't host the pop up.
         if (event.target != this)
         {
-            var bridgeProvider:ISWFBridgeProvider = swfBridgeGroup.getChildBridgeProvider(popUpRequest.requestor);
+            var bridgeProvider:ISWFBridgeProvider = swfBridgeGroup.getChildBridgeProvider(
+                                                    IEventDispatcher(event.target));
             if (!SecurityUtil.hasMutualTrustBetweenParentAndChild(bridgeProvider))
             {
                 return;
@@ -3907,10 +3932,26 @@
     }

 	/**
+	 * redispatch certian events to other top-level windows
+	 */
+	private function multiWindowRedispatcher(event:Event):void
+	{
+		if (!dispatchingToSystemManagers)
+		{
+			dispatchEventToOtherSystemManagers(event);
+		}
+	}
+
+	/**
 	 * Create the requested manager
 	 */
 	private function initManagerHandler(event:Event):void
 	{
+		if (!dispatchingToSystemManagers)
+		{
+			dispatchEventToOtherSystemManagers(event);
+		}
+
 		// if we are broadcasting messages, ignore the messages
 		// we send to ourselves.
 		if (event is InterManagerRequest)


Transferred from the Adobe Open Source Subversion Repository

Revision: 6006
Author:   dsubrama@adobe.com
Date:     2009-04-07T23:13:52.682149Z

Log Message:
-----------
-new property, labelText, added to IItemRenderer interface
-owning components always push the right text down to the renderer (ie: setting the labelText property)
-DataGroup, SkinnableDataContainer now implement IItemRendererOwner
-labelField/labelFunction work for ButtonBar

QA: Yes
Checkintests: Pass
Reviewer: Ryan

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/DefaultItemRenderer.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/ButtonBarButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/IItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/ButtonBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableDataContainer.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
@@ -18,8 +18,8 @@

 import mx.collections.IList;
 import spark.components.SkinnableDataContainer;
-import spark.components.supportClasses.ItemRenderer;
-import spark.components.IItemRendererOwner;
+import spark.components.IItemRendererOwner;
+import spark.components.IItemRenderer;
 import mx.core.IVisualElement;
 import mx.events.IndexChangedEvent;
 import mx.events.CollectionEvent;
@@ -61,7 +61,7 @@
  *  @playerversion AIR 1.5
  *  @productversion Flex 4
  */
-public class ListBase extends SkinnableDataContainer implements IItemRendererOwner
+public class ListBase extends SkinnableDataContainer
 {
     include "../../core/Version.as";

@@ -148,9 +148,8 @@
     //----------------------------------
     //  labelField
     //----------------------------------
-
+    private var labelFieldOrFunctionChanged:Boolean;
     private var _labelField:String;
-    private var labelFieldOrFunctionChanged:Boolean;

     /**
      *  labelField
@@ -518,13 +517,14 @@
         	//Cycle through all instantiated renderers
         	for (var i:int = 0; i < dataGroup.numChildren; i++)
         	{
-        		var renderer:ItemRenderer = dataGroup.getElementAt(i) as ItemRenderer;
-        		//Push the correct text into the renderer if it has
-        		//a labelElement part.
-        		if (renderer && renderer.labelElement)
+        		//TODO: Ryan, figure out numChildren/numElement vs. getElement/getChild
+        		//and which is more performant.
+        		var renderer:IItemRenderer = dataGroup.getElementAt(i) as IItemRenderer;
+        		//Push the correct text into the renderer by settings its labelText
+        		//property
+        		if (renderer)
         		{
-        			renderer.labelElement.text =
-        				LabelUtil.itemToLabel(renderer.data, labelField, labelFunction);
+        			renderer.labelText = itemToLabel(renderer.data);
         		}
         	}
         	labelFieldOrFunctionChanged = false;
@@ -552,7 +552,7 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function itemToLabel(item:Object):String
+    override public function itemToLabel(item:Object):String
     {
     	return LabelUtil.itemToLabel(item, labelField, labelFunction);
     }