Return-Path: X-Original-To: apmail-incubator-flex-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B3C57D6B2 for ; Mon, 6 Aug 2012 21:27:11 +0000 (UTC) Received: (qmail 57021 invoked by uid 500); 6 Aug 2012 21:27:11 -0000 Delivered-To: apmail-incubator-flex-commits-archive@incubator.apache.org Received: (qmail 57002 invoked by uid 500); 6 Aug 2012 21:27:11 -0000 Mailing-List: contact flex-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-commits@incubator.apache.org Received: (qmail 56995 invoked by uid 99); 6 Aug 2012 21:27:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Aug 2012 21:27:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Aug 2012 21:27:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4D5552388A40; Mon, 6 Aug 2012 21:26:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1370028 [5/43] - in /incubator/flex/whiteboard/cframpton/adobe.next: ./ frameworks/ frameworks/projects/advancedgrids/src/mx/collections/ frameworks/projects/advancedgrids/src/mx/controls/ frameworks/projects/airframework/src/mx/managers/ ... Date: Mon, 06 Aug 2012 21:26:02 -0000 To: flex-commits@incubator.apache.org From: cframpton@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120806212616.4D5552388A40@eris.apache.org> Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as Mon Aug 6 21:25:54 2012 @@ -61,6 +61,8 @@ import mx.events.Request; import mx.managers.systemClasses.ActiveWindowManager; import mx.styles.IStyleClient; +import spark.core.IToolTip; + use namespace mx_internal; [ExcludeClass] @@ -436,7 +438,7 @@ public class PopUpManagerImpl extends Ev // this handles _all_ cleanup window.addEventListener(Event.REMOVED, popupRemovedHandler); - if (window is IFocusManagerContainer && visibleFlag) + if (window is IFocusManagerContainer && visibleFlag && !(window is IToolTip)) { if (hasEventListener("addedPopUp")) { @@ -549,6 +551,7 @@ public class PopUpManagerImpl extends Ev // Offset the top, left of the window to bring it into view. clippingOffset = rect.topLeft.clone(); + clippingOffset = DisplayObject(systemManager).localToGlobal(clippingOffset); appWidth = rect.width; appHeight = rect.height; } @@ -560,9 +563,8 @@ public class PopUpManagerImpl extends Ev rect = UIComponent(popUpParent).getVisibleRect(); if (UIComponent(popUpParent).systemManager != sbRoot) rect = UIComponent(popUpParent).systemManager.getVisibleApplicationRect(rect); - var offset:Point = popUpParent.globalToLocal(rect.topLeft); - clippingOffset.x += offset.x; - clippingOffset.y += offset.y; + clippingOffset.x = rect.x; + clippingOffset.y = rect.y; parentWidth = rect.width; parentHeight = rect.height; } @@ -576,27 +578,8 @@ public class PopUpManagerImpl extends Ev // clipped by the parent application. x = Math.max(0, (Math.min(appWidth, parentWidth) - popUp.width) / 2); y = Math.max(0, (Math.min(appHeight, parentHeight) - popUp.height) / 2); - - // If the layout has been mirrored, then 0,0 is the uppper - // right corner; compensate here. - if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0) - { - // If popUp has layout direction different than the parent (or parent doesn't - // have layout direction and popUp is RTL) flip it to the other side of the x axis. - const popUpLDE:ILayoutDirectionElement = popUp as ILayoutDirectionElement; - const parentLDE:ILayoutDirectionElement = popUpParent as ILayoutDirectionElement; - - if (popUpLDE && - ((parentLDE && parentLDE.layoutDirection != popUpLDE.layoutDirection) || - (!parentLDE && popUpLDE.layoutDirection == LayoutDirection.RTL))) - { - x = -x /* to flip it on the other side of the x axis*/ - -popUp.width /* because 0 is the right edge */; - } - } - - pt = new Point(clippingOffset.x, clippingOffset.y); - pt = popUpParent.localToGlobal(pt); + + pt = new Point(clippingOffset.x, clippingOffset.y); pt = popUp.parent.globalToLocal(pt); popUp.move(Math.round(x) + pt.x, Math.round(y) + pt.y); } Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/SystemManager.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/SystemManager.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/SystemManager.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/SystemManager.as Mon Aug 6 21:25:54 2012 @@ -2783,6 +2783,9 @@ public class SystemManager extends Movie Singleton.registerClass("mx.managers::IToolTipManager2", Class(getDefinitionByName("mx.managers::ToolTipManagerImpl"))); + + Singleton.registerClass("spark.managers::IToolTipManagerImpl", + Class(getDefinitionByName("spark.managers::ToolTipManagerImpl"))); var dragManagerClass:Class = null; @@ -3166,6 +3169,18 @@ public class SystemManager extends Movie } } + if (isTopLevelRoot() && stage.scaleMode != StageScaleMode.NO_SCALE) + { + // with scaling scalemodes, we can no longer trust + // stageWidth/stageHeight as they reflect the total + // number of pixels after scaling. We will trust + // the loaderInfo width/height because the user is + // supposed to design his UI to fit within those + // dimensions and the player then scales that rectangle + // to fit. + w = m; + h = n; + } var x:Number = (m - w) / 2; var y:Number = (n - h) / 2; Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/EventProxy.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/EventProxy.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/EventProxy.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/EventProxy.as Mon Aug 6 21:25:54 2012 @@ -68,7 +68,7 @@ public class EventProxy extends EventDis IMarshalSystemManager(systemManager.getImplementation("mx.managers::IMarshalSystemManager")); marshalSystemManager.dispatchEventFromSWFBridges(mme, null, true, true); // must send to ourselves as well - systemManager.dispatchEvent(mme); + marshalSystemManager.dispatchEventFromSystemManager(mme); } } Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/MarshallingSupport.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/MarshallingSupport.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/MarshallingSupport.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/mx/managers/systemClasses/MarshallingSupport.as Mon Aug 6 21:25:54 2012 @@ -70,6 +70,8 @@ import mx.utils.EventUtil; import mx.utils.NameUtil; import mx.utils.SecurityUtil; +import spark.managers.marshalClasses.ToolTipManagerMarshalMixin; + use namespace mx_internal; [ExcludeClass] @@ -113,9 +115,12 @@ public class MarshallingSupport implemen /** * @private */ - private static function weakDependency5():void { ToolTipManagerMarshalMixin }; - + private static function weakDependency5():void { mx.managers.marshalClasses.ToolTipManagerMarshalMixin }; + /** + * @private + */ + private static function weakDependency6():void { spark.managers.marshalClasses.ToolTipManagerMarshalMixin }; //-------------------------------------------------------------------------- // @@ -1879,7 +1884,7 @@ public class MarshallingSupport implemen /** - * Perform the requested action from a trusted dispatcher. + * Perform the requested action from a trusted dispatcher. */ private function systemManagerHandler(event:Event):void { @@ -1888,11 +1893,11 @@ public class MarshallingSupport implemen event["value"] = currentSandboxEvent == event["value"]; return; } - else if (event["name"] == "hasSWFBridges") - { - event["value"] = hasSWFBridges(); - return; - } + else if (event["name"] == "hasSWFBridges") + { + event["value"] = hasSWFBridges(); + return; + } // if we are broadcasting messages, ignore the messages // we send to ourselves. @@ -2541,6 +2546,16 @@ public class MarshallingSupport implemen // trace("<Only one tool tip can be displayed at a time. + * The ToolTipManager is responsible for showing and hiding tool tips. + *

+ * + *

The tool tip is responsible for positioning itself and defining + * its transition effects.

+ * + * @see spark.components.ToolTip + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3 + * @productversion Flex 5.0 + */ +public class ToolTipManager extends EventDispatcher +{ + include "../../mx/core/Version.as"; + + //-------------------------------------------------------------------------- + // + // Class variables + // + //-------------------------------------------------------------------------- + + /** + * @private + * Linker dependency on implementation class. + */ + private static var _implClassDependency:ToolTipManagerImpl; + + /** + * @private + * Storage for the impl getter. + * This gets initialized on first access, + * not at static initialization time, in order to ensure + * that the Singleton registry has already been initialized. + */ + private static var _impl:IToolTipManagerImpl; + + /** + * @private + * The singleton instance of ToolTipManagerImpl which was + * registered as implementing the IToolTipManagerImpl interface. + */ + private static function get impl():IToolTipManagerImpl + { + if (!_impl) + _impl = IToolTipManagerImpl(Singleton.getInstance("spark.managers::IToolTipManagerImpl")); + + return _impl; + } + + //-------------------------------------------------------------------------- + // + // Class Properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // enabled + //---------------------------------- + + /** + * If true, the ToolTipManager will automatically + * show tool tips when the user moves the mouse pointer over + * components. + * If false, the ToolTipManager will not show + * tool tips. + * + * @default true + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3 + * @productversion Flex 5.0 + */ + public static function get enabled():Boolean + { + return impl.enabled; + } + + /** + * @private + */ + public static function set enabled(value:Boolean):void + { + impl.enabled = value; + } + + //---------------------------------- + // currentTarget + //---------------------------------- + + /** + * The UIComponent that is currently displaying a tool tip or is + * scheduled to display a tool tip when the show delay elapses. + * This property is null if no tool tip is shown or scheduled. + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3 + * @productversion Flex 5.0 + */ + public static function get currentTarget():IToolTipManagerClient + { + return impl.currentTarget; + } + + /** + * @private + */ + public static function set currentTarget(value:IToolTipManagerClient):void + { + impl.currentTarget = value; + } + + //---------------------------------- + // currentToolTip + //---------------------------------- + + /** + * The tool tip that is currently visible, + * or null if none is shown. + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3 + * @productversion Flex 5.0 + */ + public static function get currentToolTip():IToolTip + { + return impl.currentToolTip; + } + + /** + * @private + */ + public static function set currentToolTip(value:IToolTip):void + { + impl.currentToolTip = value; + } + + //---------------------------------------------------------------------- + // + // Class Methods + // + //---------------------------------------------------------------------- + + //---------------------------------------------- + // Component registration / deregistration + //---------------------------------------------- + + /** + * Registers a target UIComponent with the ToolTipManager. + * This causes the ToolTipManager to display a tool tip when the + * mouse hovers over the target. + * + *

When popping up a new ToolTip, the + * ToolTipManager passes the target's toolTipData + * property to the ToolTip it creates. + * The ToolTip's skin then renders the data for display.

+ * + *

This method may be called by UIComponent's setter for the toolTipData + * property.

+ * + * @param target The UIComponent that owns the tool tip. + * + * @see mx.core.UIComponent + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3 + * @productversion Flex 5.0 + */ + public static function registerTarget(target:IToolTipManagerClient):void + { + impl.registerTarget(target); + } + + /** + * Unregisters a target UIComponent with the ToolTipManager. + * The ToolTipManager will no longer pop up tool tips for the + * target component. + * + *

This method may be called by UIComponent's setter for the toolTipData + * property.

+ * + * @param target The UIComponent that owns the tool tip. + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3 + * @productversion Flex 5.0 + */ + public static function unregisterTarget(target:IToolTipManagerClient):void + { + impl.unregisterTarget(target); + } +} +} Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManager.as ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManager.as ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManagerImpl.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManagerImpl.as?rev=1370028&view=auto ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManagerImpl.as (added) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManagerImpl.as Mon Aug 6 21:25:54 2012 @@ -0,0 +1,677 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +package spark.managers +{ + +import flash.display.DisplayObject; +import flash.events.Event; +import flash.events.EventDispatcher; +import flash.events.MouseEvent; +import flash.events.TimerEvent; +import flash.utils.Timer; +import flash.utils.getTimer; + +import mx.core.mx_internal; +import mx.managers.IToolTipManagerClient; + +import spark.core.IToolTip; + +use namespace mx_internal; + +[ExcludeClass] + +/** + * @private + */ +public class ToolTipManagerImpl extends EventDispatcher implements IToolTipManagerImpl +{ + include "../../mx/core/Version.as"; + + //-------------------------------------------------------------------------- + // + // Class variables + // + //-------------------------------------------------------------------------- + + /** + * @private + * + * Place to hook in additional classes. + */ + public static var mixins:Array; + + /** + * @private + */ + private static var _instance:IToolTipManagerImpl; + + //-------------------------------------------------------------------------- + // + // Class methods + // + //-------------------------------------------------------------------------- + + /** + * @private + * This is called by Singleton.getInstance(interfaceName). + */ + public static function getInstance():IToolTipManagerImpl + { + if (!_instance) + _instance = new ToolTipManagerImpl(); + + return _instance; + } + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + public function ToolTipManagerImpl() + { + super(); + + if (_instance) + throw new Error("Instance already exists."); + + if (mixins) + { + var n:int = mixins.length; + for (var i:int = 0; i < n; i++) + { + new mixins[i](this); + } + } + + if (hasEventListener("initialize")) + dispatchEvent(new Event("initialize")); + } + + //-------------------------------------------------------------------------- + // + // Properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // enabled + //---------------------------------- + + /** + * @private + */ + private var _enabled:Boolean = true; + + /** + * @private + */ + public function get enabled():Boolean + { + return _enabled; + } + + /** + * @private + */ + public function set enabled(value:Boolean):void + { + _enabled = value; + } + + //---------------------------------- + // currentTarget + //---------------------------------- + + /** + * @private + */ + private var _currentTarget:IToolTipManagerClient; + + /** + * @private + */ + public function get currentTarget():IToolTipManagerClient + { + return _currentTarget; + } + + /** + * @private + */ + public function set currentTarget(value:IToolTipManagerClient):void + { + _currentTarget = value; + } + + //---------------------------------- + // currentToolTip + //---------------------------------- + + /** + * @private + */ + private var _currentToolTip:IToolTip; + + /** + * @private + */ + public function get currentToolTip():IToolTip + { + return _currentToolTip; + } + + /** + * @private + */ + public function set currentToolTip(value:IToolTip):void + { + _currentToolTip = value; + } + + //---------------------------------------------------------------------- + // + // Variables + // + //---------------------------------------------------------------------- + + /** + * @private + * A flag that keeps track of whether this class's initializeIfNeeded() + * method has been executed. + */ + private var _isInitialized:Boolean = false; + + /** + * @private + * This timer is used to delay the appearance of a tool tip + * after the mouse moves over a target. + * + *

This timer is started when the mouse moves over a registered + * component, with a duration specified by showDelay. + * If the mouse moves out of this object before the timer fires, + * the tool tip is never created. + * If the mouse stays over the object until the timer fires, + * the tool tip is created and popped up. + */ + private var _showTimer:Timer; + + /** + * @private + * This timer is used to make the tooltip "time out" and hide itself + * if the mouse stays over a target. + */ + private var _hideTimer:Timer; + + /** + * @private + * This timestamp is used for the scrub delay, to determine whether + * the current target's tool tip should be shown immediately. + */ + private var _previousToolTipHideTime:int; /* milliseconds */ + + //---------------------------------------------------------------------- + // + // Methods + // + //---------------------------------------------------------------------- + + //---------------------------------------------- + // Component registration / deregistration + //---------------------------------------------- + + /** + * @private + */ + public function registerTarget(target:IToolTipManagerClient):void + { + initializeIfNeeded(); + target.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); + target.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); + } + + /** + * @private + */ + public function unregisterTarget(target:IToolTipManagerClient):void + { + target.removeEventListener(MouseEvent.ROLL_OVER, rollOverHandler); + target.removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler); + } + + //---------------------------------- + // Initialization + //---------------------------------- + + /** + * @private + * Lazy initialization. + * Occurs when the first target component is registered. + */ + private function initializeIfNeeded():void + { + if (_isInitialized) + return; + + initializeTimers(); + + _isInitialized = true; + + // Notify any mixins. + if (hasEventListener("initialize")) + dispatchEvent(new Event("initialize")); + } + + //---------------------------------- + // Opening tool tips + //---------------------------------- + + /** + * @private + * Opens a tool tip immediately or schedules a tooltip to be opened + * for the current target, depending on the show delay and scrub delay. + */ + private function showOrScheduleToolTip():void + { + if (!currentTarget) + return; + + // If for example, the showDelay == 0 and the hideDelay == 0, + // don't show the tool tip at all. + var shouldShowToolTip:Boolean = !isInfiniteDelay(showDelay) && !isZeroDelay(hideDelay); + if (!shouldShowToolTip) + return; + + var shouldShowToolTipImmediately:Boolean = isZeroDelay(showDelay) || isScrubbing; + if (shouldShowToolTipImmediately) + showToolTipImmediately(); + else + scheduleToolTip(); + } + + /** + * @private + * Opens a tool tip immediately for the current target. + * If the target component's toolTipData getter returns null, don't show + * the tool tip. + */ + private function showToolTipImmediately():void + { + if (!currentTarget) + return; + + var toolTipData:Object = currentTarget.toolTipData; + if (!toolTipData) + return; + + currentToolTip = new toolTipClass(); + currentToolTip.data = toolTipData; + + currentToolTip.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); + currentToolTip.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); + + currentToolTip.showToolTip(currentTarget); + + if (!isInfiniteDelay(hideDelay)) + startHideDelay(hideDelay); + } + + /** + * @private + */ + private function scheduleToolTip():void + { + if (!currentTarget) + return; + + startShowDelay(showDelay); + } + + //---------------------------------- + // Closing tool tips + //---------------------------------- + + /** + * @private + */ + private function hideOrUnscheduleToolTip():void + { + hideToolTipImmediately(); + unscheduleToolTip(); + } + + /** + * @private + */ + private function hideToolTipImmediately():void + { + if (!currentToolTip) + return; + + currentToolTip.removeEventListener(MouseEvent.ROLL_OVER, rollOverHandler); + currentToolTip.removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler); + + currentToolTip.hideToolTip(); + currentToolTip = null; + + currentTarget = null; + + // Stop any leftover hide delay. + stopHideDelay(); + + _previousToolTipHideTime = getTimer(); + + // Dispatch an event that we've closed the tool tip. + // This is picked up by the marshal mixin, which notifies the other + // ToolTipManagers in sibling ApplicationDomains. + if (hasEventListener("toolTipClosed")) + dispatchEvent(new Event("toolTipClosed")); + } + + /** + * @private + */ + private function unscheduleToolTip():void + { + if (!isToolTipScheduled) + return; + + stopShowDelay(); + + currentTarget = null; + } + + /** + * @private + * Returns true if the potential child is equal to the parent + * or is in the parent's display list. + */ + private function isChildOfParent(potentialChild:DisplayObject, parent:DisplayObject):Boolean + { + // If there is no parent, there can't be a child of it. + if (!parent) + return false; + + // Start at the child. + var currentParent:DisplayObject = potentialChild; + while (currentParent) + { + if (currentParent == parent) + return true; + + // Move up the display tree. + currentParent = currentParent.parent; + } + + return false; + } + + //---------------------------------- + // Timer management + //---------------------------------- + + /** + * @private + */ + private function initializeTimers():void + { + _showTimer = new Timer(0, 1); + _showTimer.addEventListener(TimerEvent.TIMER, showTimerHandler); + + _hideTimer = new Timer(0, 1); + _hideTimer.addEventListener(TimerEvent.TIMER, hideTimerHandler); + + setPreviousToolTipHideTime(); + } + + /** + * @private + */ + private function get isToolTipScheduled():Boolean + { + return _showTimer.running; + } + + /** + * @private + */ + private function get isScrubbing():Boolean + { + return timeSincePreviousToolTip < scrubDelay; + } + + /** + * @private + */ + private function get timeSincePreviousToolTip():int + { + // In case getTimer rolled over and is counting in the negative range, + // take the absolute value. + var delta:int = getTimer() - _previousToolTipHideTime; + return delta > 0 ? delta : -delta; + } + + /** + * @private + */ + mx_internal function setPreviousToolTipHideTime():void + { + _previousToolTipHideTime = getTimer(); + } + + /** + * @private + */ + private function startShowDelay(showDelay:Number):void + { + startTimerWithDelay(_showTimer, showDelay); + } + + /** + * @private + */ + private function stopShowDelay():void + { + stopTimer(_showTimer); + } + + /** + * @private + */ + private function startHideDelay(hideDelay:Number):void + { + startTimerWithDelay(_hideTimer, hideDelay); + } + + /** + * @private + */ + private function stopHideDelay():void + { + stopTimer(_hideTimer); + } + + /** + * @private + */ + private function startTimerWithDelay(timer:Timer, delay:Number):void + { + timer.reset(); + timer.delay = delay; + timer.start(); + } + + /** + * @private + */ + private function stopTimer(timer:Timer):void + { + timer.stop(); + } + + //---------------------------------- + // Fetching styles + //---------------------------------- + + /** + * @private + */ + private function get toolTipClass():Class + { + return getCurrentTargetStyle("toolTipClass"); + } + + /** + * @private + */ + private function get showDelay():Number + { + return getCurrentTargetStyle("toolTipShowDelay"); + } + + /** + * @private + */ + private function get hideDelay():Number + { + return getCurrentTargetStyle("toolTipHideDelay"); + } + + /** + * @private + */ + private function get scrubDelay():Number + { + return getCurrentTargetStyle("toolTipScrubDelay"); + } + + /** + * @private + */ + private function getCurrentTargetStyle(styleName:String):* + { + return currentTarget.getStyle(styleName); + } + + //---------------------------------- + // Interpreting delay + //---------------------------------- + + /** + * @private + * Any value from negative infinity up to 0 means do something immediately. + */ + private function isZeroDelay(delay:Number):Boolean + { + return delay <= 0; + } + + /** + * @private + * Positive infinity or NaN means never do something. + */ + private function isInfiniteDelay(delay:Number):Boolean + { + return delay == Number.POSITIVE_INFINITY + || isNaN(delay); + } + + //-------------------------------------------------------------------------- + // + // Event handlers + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // Timer event handlers + //---------------------------------- + + /** + * @private + */ + private function showTimerHandler(event:TimerEvent):void + { + showToolTipImmediately(); + } + + /** + * @private + */ + private function hideTimerHandler(event:TimerEvent):void + { + hideToolTipImmediately(); + } + + //---------------------------------- + // Mouse event handlers + //---------------------------------- + + /** + * @private + * Handler for roll overs on registered UIComponents and the tool tip, + * if shown. + * Tool tips will only be shown if the ToolTipManager is enabled. + */ + private function rollOverHandler(event:MouseEvent):void + { + if (!enabled) + return; + + // event.currentTarget will always be a registered target component + // or the tool tip. + var isOverCurrentToolTipNow:Boolean = event.currentTarget == currentToolTip; + var isOverCurrentTargetNow:Boolean = event.currentTarget == currentTarget; + + // If the mouse is still over the current target or tool tip, + // change nothing. + if (isOverCurrentToolTipNow || isOverCurrentTargetNow) + return; + + // Show a tool tip for the new target. + currentTarget = event.currentTarget as IToolTipManagerClient; + showOrScheduleToolTip(); + } + + /** + * @private + * Handler for roll outs on registered UIComponents and the tool tip, + * if shown. + */ + private function rollOutHandler(event:MouseEvent):void + { + // event.relatedObject can be a child display object + // of a registered target component or the tool tip. + var isOverCurrentToolTipNow:Boolean = isChildOfParent(event.relatedObject, currentToolTip as DisplayObject); + var isOverCurrentTargetNow:Boolean = isChildOfParent(event.relatedObject, currentTarget as DisplayObject); + + // If the mouse is still over the current target or tool tip, + // change nothing. + if (isOverCurrentToolTipNow || isOverCurrentTargetNow) + return; + + // Hide or unschedule the current tool tip. + hideOrUnscheduleToolTip(); + } +} +} Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManagerImpl.as ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/ToolTipManagerImpl.as ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/marshalClasses/ToolTipManagerMarshalMixin.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/marshalClasses/ToolTipManagerMarshalMixin.as?rev=1370028&view=auto ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/marshalClasses/ToolTipManagerMarshalMixin.as (added) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/marshalClasses/ToolTipManagerMarshalMixin.as Mon Aug 6 21:25:54 2012 @@ -0,0 +1,174 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +package spark.managers.marshalClasses +{ +import flash.display.DisplayObject; +import flash.events.Event; +import flash.utils.getTimer; + +import mx.core.IFlexModuleFactory; +import mx.core.UIComponent; +import mx.core.mx_internal; +import mx.events.FlexEvent; +import mx.events.InterManagerRequest; +import mx.managers.IActiveWindowManager; +import mx.managers.IFocusManagerContainer; +import mx.managers.IMarshalSystemManager; +import mx.managers.ISystemManager; +import mx.managers.SystemManagerGlobals; +import mx.managers.SystemManagerProxy; + +import spark.core.IToolTip; +import spark.managers.IToolTipManagerImpl; +import spark.managers.ToolTipManager; +import spark.managers.ToolTipManagerImpl; + +use namespace mx_internal; + +[ExcludeClass] + +[Mixin] + +/** + * @private + * This class extends the functionality of ToolTipManager in + * Marshall Plan configurations. + * This class listens to the local ToolTipManager for events that + * will trigger its handler methods. + * Its handler methods create InterManagerRequests to be sent across + * ApplicationDomains between subapps and main apps. + * These InterManagerRequests are dispatched through the security sandbox's + * sandboxRoot system manager. + * This class also listens to InterManagerRequests on the sandboxRoot from + * other ToolTipManagers. + */ +public class ToolTipManagerMarshalMixin +{ + include "../../../mx/core/Version.as"; + + //-------------------------------------------------------------------------- + // + // Class Method + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + public static function init(fbs:IFlexModuleFactory):void + { + if (!ToolTipManagerImpl.mixins) + ToolTipManagerImpl.mixins = []; + if (ToolTipManagerImpl.mixins.indexOf(ToolTipManagerMarshalMixin) == -1) + ToolTipManagerImpl.mixins.push(ToolTipManagerMarshalMixin); + } + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + public function ToolTipManagerMarshalMixin(owner:ToolTipManagerImpl = null) + { + super(); + + if (!owner) + return; + + _toolTipManagerImpl = owner; + _toolTipManagerImpl.addEventListener("initialize", initializeHandler); + _toolTipManagerImpl.addEventListener("toolTipClosed", toolTipClosedHandler); + } + + //-------------------------------------------------------------------------- + // + // Variables + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + private var _toolTipManagerImpl:ToolTipManagerImpl; + + /** + * @private + */ + private var _sandboxRoot:DisplayObject; + + //-------------------------------------------------------------------------- + // + // Class Methods + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + private function initializeHandler(event:Event):void + { + var systemManager:ISystemManager = SystemManagerGlobals.topLevelSystemManagers[0] as ISystemManager; + _sandboxRoot = systemManager.getSandboxRoot(); + _sandboxRoot.addEventListener(InterManagerRequest.TOOLTIP_MANAGER_REQUEST, interManagerRequestHandler, false, 0, true); + } + + /** + * @private + * Notify the other managers that this manager closed a tool tip. + */ + private function toolTipClosedHandler(event:Event):void + { + var interManagerRequest:InterManagerRequest = + new InterManagerRequest(InterManagerRequest.TOOLTIP_MANAGER_REQUEST); + + interManagerRequest.name = "toolTipClosed"; + + _sandboxRoot.dispatchEvent(interManagerRequest); + } + + /** + * @private + * Receive requests and notifications from other ToolTipManagers. + */ + private function interManagerRequestHandler(event:Event):void + { + // If the event is strongly-typed as an InterManagerRequest, + // then it must have come from this ApplicationDomain, and the + // local ToolTipManager. If this is the case, do nothing because + // here we handle requests from other managers not the local manager. + if (event is InterManagerRequest) + return; + + var interManagerRequest:Object = event; + var requestName:String = interManagerRequest.name; + + if (requestName == "toolTipClosed") + { + // Update the scrub delay. + _toolTipManagerImpl.setPreviousToolTipHideTime(); + } + } + +} +} Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/marshalClasses/ToolTipManagerMarshalMixin.as ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/framework/src/spark/managers/marshalClasses/ToolTipManagerMarshalMixin.as ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/components/examples/SplashScreenImage1.mxml URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/components/examples/SplashScreenImage1.mxml?rev=1370028&view=auto ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/components/examples/SplashScreenImage1.mxml (added) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/components/examples/SplashScreenImage1.mxml Mon Aug 6 21:25:54 2012 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/components/examples/SplashScreenImage1.mxml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/components/examples/SplashScreenImage1.mxml ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1.mxml URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1.mxml?rev=1370028&view=auto ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1.mxml (added) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1.mxml Mon Aug 6 21:25:54 2012 @@ -0,0 +1,22 @@ + + + + Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1.mxml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1.mxml ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1HomeView.mxml URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1HomeView.mxml?rev=1370028&view=auto ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1HomeView.mxml (added) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1HomeView.mxml Mon Aug 6 21:25:54 2012 @@ -0,0 +1,23 @@ + + + + + + + Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1HomeView.mxml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/asdoc/en_US/spark/preloaders/exmaples/DynamicSplashScreenExample1HomeView.mxml ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableStageText.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableStageText.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableStageText.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableStageText.as Mon Aug 6 21:25:54 2012 @@ -365,13 +365,6 @@ public class StyleableStageText extends private static var focusedStageText:StageText = null; /** - * A StageText corresponding to a control that was programmatically focused - * while the StageText was unable to take focus. Focus should be set to - * this StageText once it is able to take focus. - */ - private static var pendingFocusedStageText:StageText = null; - - /** * Text measuring behavior needs to be slightly different on Android * devices to account for its native text being slightly taller. Without * this adjustment, single-line text on Android will be clipped or will @@ -1419,13 +1412,8 @@ public class StyleableStageText extends // by a proxy image). This component may be in a form that is lower in // z-order than the topmost form and we cannot allow the StageText, // which cannot clip, to appear above the topmost form. - if (effectiveEnabled && stageText != null) - { - if (stageText.visible) - stageText.assignFocus(); - else - pendingFocusedStageText = stageText; - } + if (effectiveEnabled && stageText != null && stageText.visible) + stageText.assignFocus(); } /** @@ -1599,13 +1587,10 @@ public class StyleableStageText extends // well if the soft keyboard is open. (If the soft keyboard is not // open, do not restore focus because doing so will force the soft // keyboard to open.) - if (stageText.visible) + if (stageText.visible && stageText == focusedStageText && + stage.softKeyboardRect.height > 0) { - if (stageText == focusedStageText && stage.softKeyboardRect.height > 0 || - stageText == pendingFocusedStageText) - { - stageText.assignFocus(); - } + stageText.assignFocus(); } // Do not remove the proxy bitmap until after stageText has been @@ -2289,7 +2274,6 @@ public class StyleableStageText extends if (newWatchedAncestors.indexOf(ancestor) == -1) { - ancestor.removeEventListener(FlexEvent.CREATION_COMPLETE, ancestor_creationCompleteHandler); ancestor.removeEventListener(MoveEvent.MOVE, ancestor_moveHandler); ancestor.removeEventListener(ResizeEvent.RESIZE, ancestor_resizeHandler); ancestor.removeEventListener(FlexEvent.SHOW, ancestor_showHandler); @@ -2299,8 +2283,7 @@ public class StyleableStageText extends } } - var foundUninitialized:Boolean = false; - for (i = newWatchedAncestors.length - 1; i >= 0; i--) + for (i = 0; i < newWatchedAncestors.length; i++) { var newAncestor:UIComponent = newWatchedAncestors[i]; @@ -2316,12 +2299,6 @@ public class StyleableStageText extends newAncestor.addEventListener(PopUpEvent.CLOSE, ancestor_closeHandler, false, 0, true); newAncestor.addEventListener(PopUpEvent.OPEN, ancestor_openHandler, false, 0, true); } - - if (!newAncestor.initialized && !foundUninitialized) - { - foundUninitialized = true; - newAncestor.addEventListener(FlexEvent.CREATION_COMPLETE, ancestor_creationCompleteHandler, false, 0, true); - } } } @@ -2370,7 +2347,6 @@ public class StyleableStageText extends { var ancestor:UIComponent = watchedAncestors.pop(); - ancestor.removeEventListener(FlexEvent.CREATION_COMPLETE, ancestor_creationCompleteHandler); ancestor.removeEventListener(MoveEvent.MOVE, ancestor_moveHandler); ancestor.removeEventListener(ResizeEvent.RESIZE, ancestor_resizeHandler); ancestor.removeEventListener(FlexEvent.SHOW, ancestor_showHandler); @@ -2470,15 +2446,6 @@ public class StyleableStageText extends invalidateProperties(); } - private function ancestor_creationCompleteHandler(event:FlexEvent):void - { - if (!invalidateAncestorsVisibleFlag) - { - invalidateAncestorsVisibleFlag = true; - invalidateProperties(); - } - } - private function ancestor_hideHandler(event:FlexEvent):void { // Shortcut: If any ancestor hid, the StageText must hide. No need to @@ -2625,7 +2592,6 @@ public class StyleableStageText extends private function stageText_focusInHandler(event:FocusEvent):void { focusedStageText = stageText; - pendingFocusedStageText = null; // Focus events are documented as bubbling. However, all events coming // from StageText are set to not bubble. So we need to create an @@ -2926,13 +2892,10 @@ public class StyleableStageText extends // well if the soft keyboard is open. (If the soft keyboard is not // open, do not restore focus because doing so will force the soft // keyboard to open.) - if (stageTextVisible) + if (stageTextVisible && stageText == focusedStageText && + stage.softKeyboardRect.height > 0) { - if (stageText == focusedStageText && stage.softKeyboardRect.height > 0 || - stageText == pendingFocusedStageText) - { - stageText.assignFocus(); - } + stageText.assignFocus(); } // Do not remove the proxy bitmap until after stageText has been @@ -3088,11 +3051,6 @@ class StageTextPool // overwrite during its initialization. This is necessary because this // object pool "recycles" StageTexts and we need to ensure that those // StageTexts are clean when they are reused. - // While the "editable" property is set in commitProperties, there is a - // bug on Android devices where setting editable to false fails to make - // the StageText read-only if it's already false. So, make sure - // "editable" is one of the properties that gets restored to its - // default value. if (!cleanProperties) { cleanProperties = new Object(); @@ -3101,7 +3059,7 @@ class StageTextPool cleanProperties["autoCorrect"] = result.autoCorrect; //cleanProperties["color"] = result.color; // Set in commitStyles cleanProperties["displayAsPassword"] = result.displayAsPassword; - cleanProperties["editable"] = result.editable; + //cleanProperties["editable"] = result.editable; // Set in commitProperties //cleanProperties["fontFamily"] = result.fontFamily; // Set in commitStyles //cleanProperties["fontPosture"] = result.fontPosture; // Set in commitStyles //cleanProperties["fontSize"] = result.fontSize; // Set in commitStyles Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as Mon Aug 6 21:25:54 2012 @@ -161,7 +161,7 @@ public class VerticalSpinnerLayout exten var rowsToMeasure:int = getRowsToMeasure(target.numElements); // Calculate the height by multiplying the number of elements time the row height - target.measuredHeight = Math.ceil(rowsToMeasure * Math.max(5, rowHeight)); + target.measuredHeight = Math.ceil(rowsToMeasure * rowHeight); target.measuredWidth = preferredWidth; } Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/controls/RadioButtonGroup.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/controls/RadioButtonGroup.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/controls/RadioButtonGroup.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/controls/RadioButtonGroup.as Mon Aug 6 21:25:54 2012 @@ -22,14 +22,16 @@ package mx.controls import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; +import flash.display.InteractiveObject; import flash.events.Event; import flash.events.EventDispatcher; + import mx.core.FlexGlobals; import mx.core.IFlexDisplayObject; import mx.core.IMXMLObject; import mx.core.IRawChildrenContainer; -import mx.core.mx_internal; import mx.core.UIComponent; +import mx.core.mx_internal; import mx.events.FlexEvent; import mx.events.ItemClickEvent; @@ -477,8 +479,8 @@ public class RadioButtonGroup extends Ev instance.addEventListener(Event.REMOVED, radioButton_removedHandler); radioButtons.push(instance); - // Apply group indices in "breadth-first" order. - radioButtons.sort(breadthOrderCompare); + // Apply group indices in "tab order" or "breadth-first" order. + radioButtons.sort(readOrderCompare); for (var i:int = 0; i < radioButtons.length; i++) radioButtons[i].indexNumber = i; @@ -604,16 +606,37 @@ public class RadioButtonGroup extends Ev /** * @private + * Comparison function used to sort items as they are added to the radioButtons array. + * Compares by tabIndex or if neither item defines a tabIndex, by "breadthOrder." + * + * Returns -1 if a is before b in sort order, 0 if a and b have same + * sort order and 1 if a after b in sort order. */ - private function breadthOrderCompare(a:DisplayObject, b:DisplayObject):Number + private function readOrderCompare(a:DisplayObject, b:DisplayObject):Number { var aParent:DisplayObject = (a is UIComponent) ? UIComponent(a).$parent : a.parent; var bParent:DisplayObject = (b is UIComponent) ? UIComponent(b).$parent : b.parent; if (!aParent || !bParent) return 0; - - var aNestLevel:int = (a is UIComponent) ? UIComponent(a).nestLevel : -1; + + // first check to see if we can compare by tabIndex + var aTabIndex:int = (a is InteractiveObject) ? InteractiveObject(a).tabIndex : -1; + var bTabIndex:int = (b is InteractiveObject) ? InteractiveObject(b).tabIndex : -1; + + // if one of the items being compared has a defined tabIndex, compare by tabIndex + if(aTabIndex > -1 || bTabIndex > -1) + { + if (aTabIndex > bTabIndex) + return (bTabIndex == -1) ? -1 : 1; // items with assigned tabIndex come before those without + if (aTabIndex < bTabIndex) + return (aTabIndex == -1) ? 1 : -1; // items without assigned tabIndex come after those without + if (a == b) + return 0; + } + + // if neither item has a defined tabIndex we compare by "breadthOrder" + var aNestLevel:int = (a is UIComponent) ? UIComponent(a).nestLevel : -1; var bNestLevel:int = (b is UIComponent) ? UIComponent(b).nestLevel : -1; var aIndex:int = DisplayObjectContainer(aParent).getChildIndex(a); @@ -627,7 +650,7 @@ public class RadioButtonGroup extends Ev else if (a == b) return 0; else // Nest levels are identical, compare ancestors. - return breadthOrderCompare(aParent, bParent); + return readOrderCompare(aParent, bParent); } //-------------------------------------------------------------------------- Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/core/Container.as URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/core/Container.as?rev=1370028&r1=1370027&r2=1370028&view=diff ============================================================================== --- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/core/Container.as (original) +++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/mx/src/mx/core/Container.as Mon Aug 6 21:25:54 2012 @@ -331,8 +331,14 @@ include "../styles/metadata/TextStyles.a */ [Style(name="symbolColor", type="uint", format="Color", inherit="yes", theme="spark")] +//-------------------------------------- +// Other metadata +//-------------------------------------- + [ResourceBundle("core")] +[Exclude(name="removeDeferredContent", kind="method")] + /** * The Container class is an abstract base class for components that * controls the layout characteristics of child components. @@ -1326,6 +1332,63 @@ public class Container extends UICompone setActualCreationPolicies(value); } + /** + * @private + */ + private var _elementCreationPolicy:*; + + [Inspectable(enumeration="auto,all,none", defaultValue="auto")] + + /** + * @inheritDoc + */ + public function get elementCreationPolicy():String + { + // If elementCreationPolicy has been set then use it. Otherwise + // fallback to using the deprecated creationPolicy. + if (_elementCreationPolicy !== undefined) + return _elementCreationPolicy; + else + return creationPolicy; + } + + /** + * @private + */ + public function set elementCreationPolicy(value:String):void + { + _elementCreationPolicy = value; + } + + //---------------------------------- + // elementDestructionPolicy + //---------------------------------- + + /** + * @private + */ + // NOTE: Don't reference ContainerDestructionPolicy here. We don't want + // the mx library to be dependent on the spark library. + private var _elementDestructionPolicy:String = "never"; + + [Inspectable(enumeration="always,auto,never", defaultValue="auto")] + + /** + * @inheritDoc + */ + public function get elementDestructionPolicy():String + { + return _elementDestructionPolicy; + } + + /** + * @private + */ + public function set elementDestructionPolicy(value:String):void + { + _elementDestructionPolicy = value; + } + //---------------------------------- // defaultButton //---------------------------------- @@ -4222,7 +4285,22 @@ public class Container extends UICompone createComponentsFromDescriptors(true); } - /** + /** + * Container does not support removing deferred content. + * + * @param cache If true, the removed content is cached to improve the + * performance of restoring the children. + * The content is weak referenced so that the memory may be garbage + * collected if needed. + * + */ + public function removeDeferredContent(cache:Boolean = false):void + { + // This is just a stub to satisfy changes to the + // IDeferredContentOwner interface made in 5.0 + } + + /** * Given a single UIComponentDescriptor, create the corresponding * component and add the component as a child of this Container. *