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

--- frameworks/projects/mx/src/mx/controls/PopUpButton.as
+++ frameworks/projects/mx/src/mx/controls/PopUpButton.as
@@ -0,0 +1,1176 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2005-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.controls
+{
+
+import flash.display.DisplayObjectContainer;
+import flash.events.Event;
+import flash.events.FocusEvent;
+import flash.events.KeyboardEvent;
+import flash.events.MouseEvent;
+import flash.geom.Point;
+import flash.geom.Rectangle;
+import flash.ui.Keyboard;
+import flash.utils.getTimer;
+import mx.controls.listClasses.IListItemRenderer;
+import mx.core.EdgeMetrics;
+import mx.core.IBorder;
+import mx.core.IFlexDisplayObject;
+import mx.core.IUIComponent;
+import mx.core.FlexVersion;
+import mx.core.UIComponent;
+import mx.core.UIComponentGlobals;
+import mx.core.mx_internal;
+import mx.effects.Tween;
+import mx.events.DropdownEvent;
+import mx.events.ListEvent;
+import mx.events.MenuEvent;
+import mx.events.FlexMouseEvent;
+import mx.managers.IFocusManagerComponent;
+import mx.managers.PopUpManager;
+import mx.styles.ISimpleStyleClient;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the specified UIComponent closes.
+ *
+ *  @eventType mx.events.DropdownEvent.CLOSE
+ */
+[Event(name="close", type="mx.events.DropdownEvent")]
+
+/**
+ *  Dispatched when the specified UIComponent opens.
+ *
+ *  @eventType mx.events.DropdownEvent.OPEN
+ */
+[Event(name="open", type="mx.events.DropdownEvent")]
+
+//--------------------------------------
+//  Styles
+//--------------------------------------
+
+include "../styles/metadata/IconColorStyles.as"
+
+/**
+ *  Number of pixels between the divider line and the right
+ *  edge of the component.
+ *  The default value is 16.
+ */
+[Style(name="arrowButtonWidth", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Length of a close transition, in milliseconds.
+ *  The default value is 250.
+ */
+[Style(name="closeDuration", type="Number", format="Time", inherit="no")]
+
+/**
+ *  Easing function to control component closing tween.
+ */
+[Style(name="closeEasingFunction", type="Function", inherit="no")]
+
+/**
+ *  The default icon class for the main button.
+ *
+ *  @default null
+ */
+[Style(name="icon", type="Class", inherit="no", states="up, over, down, disabled")]
+
+/**
+ *  Length of an open transition, in milliseconds.
+ *  The default value is 250.
+ */
+[Style(name="openDuration", type="Number", format="Time", inherit="no")]
+
+/**
+ *  Easing function to control component opening tween.
+ */
+[Style(name="openEasingFunction", type="Function", inherit="no")]
+
+/**
+ *  The name of a CSS style declaration used by the control.
+ *  This style allows you to control the appearance of the
+ *  UIComponent object popped up by this control.
+ *
+ *  @default undefined
+ */
+[Style(name="popUpStyleName", type="String", inherit="no")]
+
+/**
+ *  Skin class for the popUpDown state (when arrowButton is in down
+ *  state) of the background and border.
+ *  @default mx.skins.halo.PopUpButtonSkin
+ */
+[Style(name="popUpDownSkin", type="Class", inherit="no")]
+
+/**
+ *  Number of vertical pixels between the PopUpButton and the
+ *  specified popup UIComponent.
+ *  The default value is 0.
+ */
+[Style(name="popUpGap", type="Number", format="Length", inherit="no")]
+
+/**
+ *  The icon used for the right button of PopUpButton.
+ *  Supported classes are mx.skins.halo.PopUpIcon
+ *  and mx.skins.halo.PopUpMenuIcon.
+ *  @default mx.skins.halo.PopUpIcon
+ */
+[Style(name="popUpIcon", type="Class", inherit="no")]
+
+/**
+ *  Skin class for the popUpOver state (over arrowButton) of
+ *  the background and border.
+ *  @default mx.skins.halo.PopUpButtonSkin
+ */
+[Style(name="popUpOverSkin", type="Class", inherit="no")]
+
+/**
+ *  Default stateful skin class for the control.
+ *  @default mx.skins.halo.PopUpButtonSkin
+ */
+[Style(name="skin", type="Class", inherit="no", states="up, over, down, disabled, popUpOver, popUpDown")]
+
+//--------------------------------------
+//  Excluded APIs
+//--------------------------------------
+
+[Exclude(name="toggle", kind="property")]
+[Exclude(name="selectedDisabledIcon", kind="style")]
+[Exclude(name="selectedDisabledSkin", kind="style")]
+[Exclude(name="selectedDownIcon", kind="style")]
+[Exclude(name="selectedDownSkin", kind="style")]
+[Exclude(name="selectedOverIcon", kind="style")]
+[Exclude(name="selectedOverSkin", kind="style")]
+[Exclude(name="selectedUpIcon", kind="style")]
+[Exclude(name="selectedUpSkin", kind="style")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+//[IconFile("PopUpButton.png")]
+
+[RequiresDataBinding(true)]
+
+/**
+ *  The PopUpButton control adds a flexible pop-up control
+ *  interface  to a Button control.
+ *  It contains a main button and a secondary button,
+ *  called the pop-up button, which pops up any UIComponent
+ *  object when a user clicks the pop-up button.
+ *
+ *
A PopUpButton control can have a text label, an icon,
+ *  or both on its face.
+ *  When a user clicks the main part of the PopUpButton
+ *  control, it dispatches a click event.

+ *
+ *
One common use for the PopUpButton control is to have
+ *  the pop-up button open a List control or a Menu control
+ *  that changes  the function and label of the main button.

+ *
+ *
The PopUpButton control has the following default characteristics:

+ *

+ *

+ *           Characteristic
+ *           Description
+ *

+ *

+ *           Default size
+ *           Sufficient width to accommodate the label and icon on the main button and the icon on the pop-up button
+ *

+ *

+ *           Minimum size
+ *           0 pixels
+ *

+ *

+ *           Maximum size
+ *           Undefined
+ *

+ *

+ *
+ *  @mxml
+ *
+ *
The <mx:PopUpButton> tag inherits all of the tag
+ *  attributes of its superclass and adds the following tag attributes:

+ *
+ *

+ *  <mx:PopUpButton
+ *    Properties
+ *    openAlways="false|true
+ *    popUp="No default"
+ *
+ *    Styles
+ *    arrowButtonWidth="16"
+ *    closeDuration="250"
+ *    closeEasingFunction="No default"
+ *    disabledIconColor="0x999999"
+ *    iconColor="0x111111"
+ *    openDuration="250"
+ *    openEasingFunction="No default"
+ *    popUpDownSkin="popUpDownSkin"
+ *    popUpGap="0"
+ *    popUpIcon="PopUpIcon"
+ *    popUpOverSkin="popUpOverSkin"
+ *
+ *    Events
+ *    close="No default"
+ *    open="No default"
+ *  />
+ *

+ *
+ *  @includeExample examples/PopUpButtonExample.mxml
+ *
+ */
+public class PopUpButton extends Button
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function PopUpButton()
+    {
+        super();
+
+        addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+        addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var inTween:Boolean = false;
+
+    /**
+     *  @private
+     *  Is the popUp list currently shown?
+     */
+    private var showingPopUp:Boolean = false;
+
+    /**
+     *  @private
+     *  The tween used for showing/hiding the popUp.
+     */
+    private var tween:Tween = null;
+
+    /**
+     *  @private
+     *  Greater of the arrowButtonWidth style and the icon's width.
+     */
+    private var arrowButtonsWidth:Number = 0;
+
+    /**
+     *  @private
+     *  Greater of the arrowButtonsHeight style and the icon's height.
+     */
+    private var arrowButtonsHeight:Number = 0;
+
+    /**
+     *  @private
+     */
+    private var popUpIconChanged:Boolean = false;
+
+    /**
+     *  @private
+     */
+    private var popUpChanged:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  showInAutomationHierarchy
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    override public function set showInAutomationHierarchy(value:Boolean):void
+    {
+        //do not allow value changes
+    }
+
+    //----------------------------------
+    //  toggle
+    //----------------------------------
+
+    [Inspectable(environment="none")]
+
+    /**
+     *  @private
+     *  A PopUpButton is not toggleable by definition, so _toggle is set
+     *  to false in the constructor and can't be changed via this setter.
+     */
+    override public function set toggle(value:Boolean):void
+    {
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+
+    //----------------------------------
+    //  closeOnActivity
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the closeOnActivity property.
+     */
+    private var _closeOnActivity:Boolean = true;
+
+    /**
+     *  @private
+     *  Specifies popUp would close on click/enter activity.
+     *  In popUps like Menu/List/TileList etc, one need not change
+     *  this as they should close on activity. However for multiple
+     *  selection, and other popUp, this can be set to false, to
+     *  prevent the popUp from closing on activity.
+     *
+     *  @default true
+     */
+    private function get closeOnActivity():Boolean
+    {
+        // We are not exposing this property for now, until the need arises.
+        return _closeOnActivity;
+    }
+
+    /**
+     *  @private
+     */
+    private function set closeOnActivity(value:Boolean):void
+    {
+        _closeOnActivity = value;
+    }
+
+
+    //----------------------------------
+    //  openAlways
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the openAlways property.
+     */
+    private var _openAlways:Boolean = false;
+
+    [Inspectable(category="General", defaultValue="false")]
+
+    /**
+     *  If true, specifies to pop up the
+     *  popUp when you click the main button.
+     *  The popUp always appears when you press the Spacebar,
+     *  or when you click the pop-up button, regardless of the setting of
+     *  the openAlways property.
+     *
+     *  @default false
+     */
+    public function get openAlways():Boolean
+    {
+        // We are not exposing this property for now, until the need arises.
+        return _openAlways;
+    }
+
+    /**
+     *  @private
+     */
+    public function set openAlways(value:Boolean):void
+    {
+        _openAlways = value;
+    }
+
+    //----------------------------------
+    //  popUp
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for popUp property.
+     */
+    private var _popUp:IUIComponent = null;
+
+    [Bindable(event='popUpChanged')]
+    [Inspectable(category="General", defaultValue="null")]
+
+    /**
+     *  Specifies the UIComponent object, or object defined by a subclass
+     *  of UIComponent, to pop up.
+     *  For example, you can specify a Menu, TileList, or Tree control.
+     *
+     *  @default null
+     */
+    public function get popUp():IUIComponent
+    {
+        return _popUp;
+    }
+
+    /**
+     *  @private
+     */
+    public function set popUp(value:IUIComponent):void
+    {
+        _popUp = value;
+        popUpChanged = true;
+
+        invalidateProperties();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods: UIComponent
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function commitProperties():void
+    {
+        super.commitProperties();
+
+        if (popUpChanged)
+        {
+            if (_popUp is IFocusManagerComponent)
+                IFocusManagerComponent(_popUp).focusEnabled = false;
+
+            _popUp.cacheAsBitmap = true;
+            _popUp.scrollRect = new Rectangle(0, 0, 0, 0);
+
+            if (_popUp is Menu)
+                _popUp.addEventListener(MenuEvent.MENU_HIDE, menuHideHandler);
+
+            if (_popUp is IListItemRenderer)
+            {
+                _popUp.addEventListener(
+                    ListEvent.ITEM_CLICK, popUpItemClickHandler);
+            }
+
+            _popUp.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE,
+                                    popMouseDownOutsideHandler);
+
+            _popUp.addEventListener(FlexMouseEvent.MOUSE_WHEEL_OUTSIDE,
+                                    popMouseDownOutsideHandler);
+
+            _popUp.owner = this;
+
+            if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0 && _popUp is ISimpleStyleClient)
+                ISimpleStyleClient(_popUp).styleName = getStyle("popUpStyleName");
+
+            popUpChanged = false;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override protected function measure():void
+    {
+        super.measure();
+
+        calcArrowButtonSize();
+
+        // Add in pop-up button width
+        measuredWidth += arrowButtonsWidth;
+        measuredHeight = arrowButtonsHeight;
+    }
+
+    /**
+     *  @private
+     */
+    override public function styleChanged(styleProp:String):void
+    {
+        // PopUpIcon style prop has changed, dump skins
+        if (styleProp == null ||
+            styleProp == "styleName" ||
+            styleProp.toLowerCase().indexOf("popupicon") != -1)
+        {
+            popUpIconChanged = true;
+            changeSkins();
+        }
+        if (styleProp == "arrowButtonWidth")
+            invalidateSize();
+        else if (styleProp == "popUpStyleName" && _popUp
+                && FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0
+                && _popUp is ISimpleStyleClient)
+            ISimpleStyleClient(_popUp).styleName = getStyle("popUpStyleName");
+
+        super.styleChanged(styleProp);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods: Button
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override mx_internal function layoutContents(unscaledWidth:Number,
+                                                 unscaledHeight:Number,
+                                                 offset:Boolean):void
+    {
+        if ((!isNaN(explicitWidth) && !isNaN(explicitHeight)) ||
+            popUpIconChanged)
+        {
+            calcArrowButtonSize();
+            popUpIconChanged = false;
+        }
+
+        unscaledWidth -= arrowButtonsWidth;
+
+        super.layoutContents(unscaledWidth, unscaledHeight, offset);
+
+        unscaledWidth += arrowButtonsWidth;
+    }
+
+    /**
+     *  @private
+     *  Displays one of the six possible skins,
+     *  creating it if it doesn't already exist.
+     */
+    override mx_internal function viewSkin():void
+    {
+        // Determine which skin to display, based on whether this
+        // PopUpButton is enabled or disabled, whether it is
+        // selected or unselected, and how it is currently interacting
+        // with the mouse (i.e., the up/over/down state).
+
+        var tempSkinName:String;
+        var stateName:String;
+
+        if (!enabled)
+        {
+            tempSkinName = "disabledSkin";
+            stateName = "disabled";
+        }
+        else if (phase == "arrowOver")
+        {
+            tempSkinName = "popUpOverSkin";
+            stateName = "popUpOver";
+        }
+        else if (phase == "arrowDown")
+        {
+            tempSkinName = "popUpDownSkin";
+            stateName = "popUpDown";
+        }
+        else
+        {
+            tempSkinName = phase + "Skin";
+            stateName = phase;
+        }
+
+        viewSkinForPhase(tempSkinName, stateName);
+    }
+
+    /**
+     *  @private
+     */
+    override mx_internal function getCurrentIconName():String
+    {
+        var iconName:String = super.getCurrentIconName();
+
+        if (iconName)
+            return iconName;
+
+        if (phase == "arrowOver")
+            iconName = selected ? selectedOverIconName : overIconName;
+        else if (phase == "arrowDown")
+            iconName = selected ? selectedDownIconName : downIconName;
+        else
+            iconName = phase + "Icon";
+
+        return iconName;
+    }
+
+    /**
+     *  @private
+     *  Displays one of the four possible icons,
+     *  creating it if it doesn't already exist.
+     */
+    override mx_internal function viewIcon():void
+    {
+        // Determine which skin to display, based on whether this
+        // PopUpButton is enabled or disabled, whether it is
+        // selected or unselected, and how it is currently interacting
+        // with the mouse (i.e., the up/over/down state).
+
+        var iconName:String;
+
+        if (!enabled)
+            iconName = "disabledIcon";
+        else if (phase == "arrowOver")
+            iconName = selected ? selectedOverIconName : overIconName;
+        else if (phase == "arrowDown")
+            iconName = selected ? selectedDownIconName : downIconName;
+        else
+            iconName = phase + "Icon";
+
+        viewIconForPhase(iconName);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Used by PopUpMenuButton
+     */
+    mx_internal function getPopUp():IUIComponent
+    {
+        return _popUp ? _popUp : null;
+    }
+
+    /**
+     *  Opens the UIComponent object specified by the popUp property.
+     */
+    public function open():void
+    {
+        openWithEvent(null);
+    }
+
+    /**
+     *  @private
+     */
+    private function openWithEvent(trigger:Event = null):void
+    {
+        if (!showingPopUp && enabled)
+        {
+            displayPopUp(true);
+
+            var cbde:DropdownEvent = new DropdownEvent(DropdownEvent.OPEN);
+            cbde.triggerEvent = trigger;
+            dispatchEvent(cbde);
+        }
+    }
+
+    /**
+     *  Closes the UIComponent object opened by the PopUpButton control.
+     */
+    public function close():void
+    {
+        closeWithEvent(null);
+    }
+
+    /**
+     *  @private
+     */
+    private function closeWithEvent(trigger:Event = null):void
+    {
+        if (showingPopUp && enabled)
+        {
+            displayPopUp(false);
+
+            var cbde:DropdownEvent = new DropdownEvent(DropdownEvent.CLOSE);
+            cbde.triggerEvent = trigger;
+            dispatchEvent(cbde);
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function displayPopUp(show:Boolean):void
+    {
+        if (!initialized || (show == showingPopUp))
+            return;
+        // Subclasses may extend to do pre-processing
+        // before the popUp is displayed
+        // or override to implement special display behavior
+
+        var popUpGap:Number = getStyle("popUpGap");
+        var point:Point = new Point(0, unscaledHeight + popUpGap);
+        point = localToGlobal(point);
+
+        //Show or hide the popup
+        var initY:Number;
+        var endY:Number;
+        var easingFunction:Function;
+        var duration:Number;
+
+        if (show)
+        {
+            if (getPopUp() == null)
+                return;
+
+            if (_popUp.parent == null)
+            {
+                PopUpManager.addPopUp(_popUp, this, false);
+                _popUp.owner = this;
+            }
+            else
+                PopUpManager.bringToFront(_popUp);
+
+            point = _popUp.parent.globalToLocal(point);
+
+            if (point.y + _popUp.height > screen.height && point.y > (height + _popUp.height))
+            {
+                // PopUp will go below the bottom of the stage
+                // and be clipped. Instead, have it grow up.
+                point.y -= (unscaledHeight + _popUp.height + 2*popUpGap);
+                initY = -_popUp.height;
+            }
+            else
+            {
+                initY = _popUp.height;
+            }
+
+            point.x = Math.min( point.x, screen.width - _popUp.getExplicitOrMeasuredWidth());
+            point.x = Math.max( point.x, 0);
+            if (_popUp.x != point.x || _popUp.y != point.y)
+                _popUp.move(point.x, point.y);
+
+            _popUp.scrollRect = new Rectangle(0, initY,
+                    _popUp.width, _popUp.height);
+
+            if (!_popUp.visible)
+                _popUp.visible = true;
+
+            endY = 0;
+            showingPopUp = show;
+            duration = getStyle("openDuration");
+            easingFunction = getStyle("openEasingFunction") as Function;
+        }
+        else
+        {
+            point = _popUp.parent.globalToLocal(point);
+
+            endY = (point.y + _popUp.height > screen.height &&
+                               point.y > (height + _popUp.height)
+                               ? -_popUp.height - 2
+                               : _popUp.height + 2);
+            initY = 0;
+            showingPopUp = show;
+            duration = getStyle("closeDuration")
+            easingFunction = getStyle("closeEasingFunction") as Function;
+        }
+
+        inTween = true;
+        UIComponentGlobals.layoutManager.validateNow();
+
+        // Block all layout, responses from web service, and other background
+        // processing until the tween finishes executing.
+        UIComponent.suspendBackgroundProcessing();
+
+        tween = new Tween(this, initY, endY, duration);
+        if (easingFunction != null)
+            tween.easingFunction = easingFunction;
+    }
+
+    /**
+     *  @private
+     *  Calculates the ArrowButton's sizes.
+     */
+    private function calcArrowButtonSize():void
+    {
+        // If the current skin defines a borderMetrics property,
+        // then use it. Otherwise, use a default value.
+        var bm:EdgeMetrics;
+
+        if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
+        {
+        	try
+	        {
+	            bm = currentSkin["borderMetrics"];
+	        }
+	        catch(e:Error)
+	        {
+	            bm = new EdgeMetrics(3, 3, 3, 3);
+	        }
+        }
+        else
+        {
+	        if (currentSkin is IBorder)
+	        	bm = IBorder(currentSkin).borderMetrics;
+	        else
+				bm = new EdgeMetrics(3, 3, 3, 3);
+        }
+
+        var popUpIcon:IFlexDisplayObject =
+            IFlexDisplayObject(getChildByName("popUpIcon"));
+
+        // If not, create it.
+        if (!popUpIcon)
+        {
+            var popUpIconClass:Class = Class(getStyle("popUpIcon"));
+            popUpIcon = new popUpIconClass();
+        }
+
+        arrowButtonsWidth = Math.max(getStyle("arrowButtonWidth"),
+                                    popUpIcon.width + bm.right + 1);
+        arrowButtonsHeight = Math.max(measuredHeight,
+                                     popUpIcon.height + bm.top + bm.bottom);
+    }
+
+    /**
+     *  @private
+     *  Returns true if the mouse is over the pop-up button
+     */
+    mx_internal function overArrowButton(event:MouseEvent):Boolean
+    {
+        return event.localX >= unscaledWidth - arrowButtonsWidth;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function onTweenUpdate(value:Number):void
+    {
+        _popUp.scrollRect =
+            new Rectangle(0, value, _popUp.width, _popUp.height);
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function onTweenEnd(value:Number):void
+    {
+        _popUp.scrollRect =
+            new Rectangle(0, value, _popUp.width, _popUp.height);
+
+        inTween = false;
+        UIComponent.resumeBackgroundProcessing();
+
+        if (!showingPopUp)
+        {
+            _popUp.visible = false;
+            _popUp.scrollRect = null;
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden event handlers: UIComponent
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function keyDownHandler(event:KeyboardEvent):void
+    {
+        super.keyDownHandler(event);
+
+        if (event.ctrlKey && event.keyCode == Keyboard.DOWN)
+        {
+            openWithEvent(event);
+            event.stopPropagation();
+        }
+        else if ((event.ctrlKey && event.keyCode == Keyboard.UP) ||
+                 (event.keyCode == Keyboard.ESCAPE))
+        {
+            closeWithEvent(event);
+            event.stopPropagation();
+        }
+        else if (event.keyCode == Keyboard.ENTER && showingPopUp)
+        {
+            // Redispatch the event to the popup
+            // and let its keyDownHandler() handle it.
+            _popUp.dispatchEvent(event);
+            closeWithEvent(event);
+            event.stopPropagation();
+        }
+        else if (showingPopUp &&
+                 (event.keyCode == Keyboard.UP ||
+                  event.keyCode == Keyboard.DOWN ||
+                  event.keyCode == Keyboard.LEFT ||
+                  event.keyCode == Keyboard.RIGHT ||
+                  event.keyCode == Keyboard.PAGE_UP ||
+                  event.keyCode == Keyboard.PAGE_DOWN))
+        {
+            // Redispatch the event to the popup
+            // and let its keyDownHandler() handle it.
+            _popUp.dispatchEvent(event);
+            event.stopPropagation();
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override protected function focusOutHandler(event:FocusEvent):void
+    {
+        // Note: event.relatedObject is the object getting focus.
+        // It can be null in some cases, such as when you open
+        // the popUp and then click outside the application.
+
+        // If the dropdown is open...
+        if (showingPopUp && _popUp)
+        {
+            // If focus is moving outside the popUp...
+            if (!event.relatedObject)
+            {
+                close();
+            }
+            else if (event.relatedObject is Menu)
+            {
+                // For nested Menu's find parent.
+                var target:Menu = Menu(event.relatedObject);
+                while (target.parentMenu)
+                {
+                    target = target.parentMenu;
+                }
+                if (_popUp is DisplayObjectContainer && !DisplayObjectContainer(_popUp).contains(target))
+                    close();
+            }
+            else if (_popUp is DisplayObjectContainer && !DisplayObjectContainer(_popUp).contains(event.relatedObject))
+            {
+                close();
+            }
+        }
+
+        super.focusOutHandler(event);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden event handlers: Button
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function rollOverHandler(event:MouseEvent):void
+    {
+        // Check if the pop-up button was pressed.
+        if (overArrowButton(event))
+        {
+            phase = "arrowOver";
+            viewSkin();
+            return;
+        }
+
+        super.rollOverHandler(event);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function rollOutHandler(event:MouseEvent):void
+    {
+        // Check if the pop-up button was pressed.
+        if (overArrowButton(event))
+        {
+            phase = "up";
+            viewSkin();
+            return;
+        }
+
+        super.rollOutHandler(event);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function mouseDownHandler(event:MouseEvent):void
+    {
+        // Check if the pop-up button was pressed.
+        if (overArrowButton(event))
+        {
+            phase = "arrowDown";
+            viewSkin();
+            return;
+        }
+
+        super.mouseDownHandler(event);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function mouseUpHandler(event:MouseEvent):void
+    {
+        // Check if the pop-up button was pressed.
+        if (overArrowButton(event))
+        {
+            phase = "arrowOver";
+            viewSkin();
+            return;
+        }
+
+        super.mouseUpHandler(event);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function clickHandler(event:MouseEvent):void
+    {
+        if (overArrowButton(event))
+        {
+            if (showingPopUp)
+                closeWithEvent(event);
+            else
+                openWithEvent(event);
+
+            event.stopImmediatePropagation();
+        }
+        else
+        {
+            super.clickHandler(event);
+            if (openAlways)
+            {
+                if (showingPopUp)
+                    closeWithEvent(event);
+                else
+                    openWithEvent(event);
+            }
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function mouseMoveHandler(event:MouseEvent):void
+    {
+        // Check if the pop-up button was pressed.
+        if (phase == "over" || phase == "arrowOver")
+        {
+            phase = overArrowButton(event) ? "arrowOver" : "over";
+            viewSkin();
+        }
+    }
+
+    /**
+     *  @private
+     *  Close popUp for IListItemRenderer's like List/Menu.
+     */
+    private function popUpItemClickHandler(event:Event):void
+    {
+        if (_closeOnActivity)
+            close();
+    }
+
+    /**
+     *  @private
+     *  Hide is called intermittently before close gets called.
+     *  Call close() in such cases to  reset variables.
+     */
+    private function menuHideHandler(event:MenuEvent):void
+    {
+        //we don't want to close the popUp if we're just hiding
+        //a submenu
+        if (event.menu != Menu(_popUp).mx_internal::getRootMenu())
+        {
+            return;
+        }
+
+        // Menu is hidden through a call to hide()
+        // Make it visible again so that the menu can
+        // be tweened and closed.
+        showingPopUp = true;
+        _popUp.visible = true;
+        displayPopUp(false);
+    }
+
+    /**
+     *  @private
+     */
+    private function popMouseDownOutsideHandler(event:MouseEvent):void
+    {
+        // for automated testing, since we're generating this event and
+        // can only set localX and localY, transpose those coordinates
+        // and use them for the test point.
+        var p:Point = event.target.localToGlobal(new Point(event.localX,
+                                                           event.localY));
+        if (hitTestPoint(p.x, p.y, true))
+        {
+            // do nothing
+        }
+        else
+        {
+            close();
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function removedFromStageHandler(event:Event):void
+    {
+        // Ensure we've unregistered ourselves from PopupManager, else
+        // we'll be leaked.
+        if (_popUp) {
+            PopUpManager.removePopUp(_popUp);
+            _popUp = null;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function getUnscaledWidth():Number
+    {
+        return unscaledWidth;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function getUnscaledHeight():Number
+    {
+        return unscaledHeight;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function get isShowingPopUp():Boolean
+    {
+        return showingPopUp;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function getArrowButtonsWidth():Number
+    {
+        return arrowButtonsWidth;
+    }
+
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 4142
Author:   cframpto@adobe.com
Date:     2008-11-19T22:32:48.335847Z

Log Message:
-----------
Implement FxRadioButtonGroup.  Fix spelling in ASDOC in RadioButtonGroup.as.

QE Notes: none
Doc Notes: example code for FxRadioButton and FxRadioButtonGroup
Reviewer: Glenn and Paul
tests: checkintests

Modified Paths:
--------------
<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/modules/compiler/src/java/flex2/compiler/mxml/builder/ComponentBuilder.java</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxRadioButtonGroup.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxRadioButtonGroup.png</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/lang/StandardDefs.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxRadioButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/mxml-2009-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/bundles/en_US/controls.properties</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/DocumentBuilder.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RadioButtonGroup.as</path>

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

--- frameworks/projects/mx/src/mx/controls/RadioButton.as
+++ frameworks/projects/mx/src/mx/controls/RadioButton.as
@@ -45,11 +45,9 @@

 [AccessibilityClass(implementation="mx.accessibility.RadioButtonAccImpl")]

-[DefaultBindingProperty(source="selected", destination="selected")]
-
-[DefaultTriggerEvent("click")]
-
 [IconFile("RadioButton.png")]
+
+[ResourceBundle("controls")]

 /**
  *  The RadioButton control lets the user make a single choice
@@ -336,6 +334,7 @@
      *  if this RadioButton is part of a group defined by a RadioButtonGroup control.
      *
      *  @default "undefined"
+     *  @throws ArgumentError if Flex 4 or later and the groupName starts with _fx_
      */
     public function get groupName():String
     {
@@ -351,6 +350,20 @@
         if (!value || value == "")
             return;

+        // Since Halo and Gumbo share the same automaticRadioButtonGroups slot in
+        // UIComponent, the Gumbo group names are decorated with a prefix to
+        // differentiate.  Gumbo group names can not start with the prefix.
+        if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
+        {
+            const FX_GROUP_NAME_PREFIX:String = "_fx_";
+            if (value.indexOf(FX_GROUP_NAME_PREFIX) == 0)
+            {
+                var message:String = resourceManager.getString(
+                    "controls", "invalidGroupName", [ value, FX_GROUP_NAME_PREFIX ]);
+                throw ArgumentError(message);
+            }
+        }
+
         deleteGroup(); // Delete the old group

         _groupName = value;


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

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

 package mx.skins.halo
 {


辅助函数不使用闭包

辅助函数不使用闭包

--- as3/com/netease/protobuf/messageToString.as
+++ as3/com/netease/protobuf/messageToString.as
@@ -12,30 +12,31 @@
 	public function messageToString(message:Object):String {
 		var s:String = getQualifiedClassName(message) + "(\n"
 		const descriptor:XML = describeType(message)
-		function testField(name:String):void {
-			var hasField:String = "has" + name.charAt(0).toUpperCase() + name.substr(1)
-			if (descriptor.accessor.(@name == hasField).length() != 0 && !message[hasField]) {
-				return
-			}
-			var field:* = message[name]
-			if (field.constructor == Array && field.length == 0) {
-				return
-			}
-			s += name + "=" + message[name] + ";\n"
-		}
 		for each(var getter:String in descriptor.accessor.(@access != "writeonly").@name) {
 			if (getter.search(/^has(.)(.*)$/) != -1) {
 				continue
 			}
-			testField(getter)
+			s += fieldToString(message, descriptor, getter)
 		}
 		for each(var field:String in descriptor.variable.@name) {
-			testField(field)
+			s += fieldToString(message, descriptor, field)
 		}
-		for (var k:String in message) {
+		for (var k:* in message) {
 			s += k + "=" + message[k] + ";\n"
 		}
 		s += ")"
 		return s
 	}
 }
+
+function fieldToString(message:Object, descriptor:XML, name:String):String {
+	var hasField:String = "has" + name.charAt(0).toUpperCase() + name.substr(1)
+	if (descriptor.accessor.(@name == hasField).length() != 0 && !message[hasField]) {
+		return ""
+	}
+	var field:* = message[name]
+	if (field.constructor == Array && field.length == 0) {
+		return ""
+	}
+	return name + "=" + message[name] + ";\n"
+}


fix null pointer error

fix null pointer error

--- WeaveCore/src/weave/core/SessionManager.as
+++ WeaveCore/src/weave/core/SessionManager.as
@@ -343,7 +343,7 @@

 		private function applyDiff(base:Object, diff:Object):Object
 		{
-			if (typeof(base) != 'object')
+			if (base == null || typeof(base) != 'object')
 				return diff;

 			for (var key:String in diff)


Admin: Fixed incorrect lookup of methodnames; fixed invalid reference to primitive type; always set castedQuery to something.

--- WeaveJS/src/weavejs/net/WeaveAdminService.as
+++ WeaveJS/src/weavejs/net/WeaveAdminService.as
@@ -74,18 +74,30 @@
 		{
 			adminService = Weave.linkableChild(this, new AMF3Servlet(url + "/AdminService"));
 			dataService = Weave.linkableChild(this, new AMF3Servlet(url + "/DataService"));
+
 			resetQueue();
-
-			//var info:* = DescribeType.getInfo(this, DescribeType.METHOD_FLAGS);
-			/* ??? */
-			for each (var item:String in JS.getPropertyNames(this, true))
-			{
-				var func:Function = this[item] as Function;
-				if (func != null)
-					propertyNameLookup.set(func, item);
-			}
-
 			initializeAdminService();
+		}
+
+		private var map_method_name:Object = new JS.Map(); // method->string
+
+		private function getMethodName(method:Object):String
+		{
+			if (method is String)
+				return method as String;
+
+			if (!map_method_name.has(method))
+			{
+				for each (var name:String in JS.getPropertyNames(this, true))
+				{
+					if (this[name] === method)
+					{
+						map_method_name.set(method, name);
+						return name;
+					}
+				}
+			}
+			return map_method_name.get(method);
 		}

 		private function resetQueue():void
@@ -98,7 +110,6 @@
 		private var queue:AsyncInvocationQueue;
 		private var adminService:AMF3Servlet;
 		private var dataService:AMF3Servlet;
-		private var propertyNameLookup:Object = new JS.Map(); // Function -> String
 		private var methodHooks:Object = {}; // methodName -> Array (of MethodHook)
         /*Bindable*/ public var initialized:Boolean = false;
 		/*Bindable*/ public var migrationProgress:String = '';
@@ -145,7 +156,7 @@
 		 */
 		public function addHook(method:Function, captureHandler:Function, resultHandler:Function, faultHandler:Function = null):void
 		{
-			var methodName:String = propertyNameLookup.get(method);
+			var methodName:String = getMethodName(method);
 			if (!methodName)
 				throw new Error("method must be a member of WeaveAdminService");
 			var hooks:Array = methodHooks[methodName];
@@ -201,7 +212,7 @@
 		 */
 		private function invokeAdmin(method:Function, parameters:Array, queued:Boolean = true, returnType:Class = null):WeavePromise/*/<any>/*/
 		{
-			var methodName:String = propertyNameLookup.get(method);
+			var methodName:String = getMethodName(method);
 			if (!methodName)
 				throw new Error("method must be a member of WeaveAdminService");
 			return generateQuery(adminService, methodName, parameters, queued, returnType);
@@ -216,7 +227,7 @@
 		 */
 		private function invokeDataService(method:Function, parameters:Array, queued:Boolean = true, returnType:Class = null):WeavePromise/*/<any>/*/
 		{
-			var methodName:String = propertyNameLookup.get(method);
+			var methodName:String = getMethodName(method);
 			if (!methodName)
 				throw new Error("method must be a member of WeaveAdminService");
 			return generateQuery(dataService, methodName, parameters, queued, returnType);
@@ -241,9 +252,13 @@

 			hookCaptureHandler(methodName, parameters, query);

-			if ([null, Array, String, Number, int, uint].indexOf(returnType) < 0)
+			if ([null, Array, String, Number].indexOf(returnType) < 0)
 			{
 				castedQuery = query.then(WeaveDataServlet.castResult.bind(this, returnType));
+			}
+			else
+			{
+				castedQuery = query;
 			}

 			castedQuery.then(hookHandler.bind(this, methodName, parameters), alertFault.bind(this, methodName, parameters, query));


Transferred from the Adobe Open Source Subversion Repository

Revision: 4486
Author:   chaase@adobe.com
Date:     2009-01-12T18:41:56.497953Z

Log Message:
-----------
Bitmap/shader transition feature, along with FxWipe and FxCrossFade, the two concrete effects based on this new shader-based transition infrastructure.

QE Notes: None
Doc Notes: None
Bugs:
Reviewer: Corey
Tests: checkintests, Mustella: Effects, gumbo/effects, ListDataEffects

Modified Paths:
--------------
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxCrossFade.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxWipe.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxWipe.pbk</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/effectClasses/FxAnimateShaderTransitionInstance.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxAnimateShaderTransition.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxCrossFade.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxCrossFade.pbk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/mxml-2009-manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/effectClasses/FxWipeInstance.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxWipe.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/WipeDirection.as</path>

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

--- frameworks/projects/spark/src/spark/effects/supportClasses/AnimateTransitionShaderInstance.as
+++ frameworks/projects/spark/src/spark/effects/supportClasses/AnimateTransitionShaderInstance.as
@@ -0,0 +1,272 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2008 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.effects.effectClasses
+{
+import flash.display.Bitmap;
+import flash.display.BitmapData;
+import flash.display.Shader;
+import flash.display.ShaderJob;
+import flash.events.ShaderEvent;
+import flash.filters.ShaderFilter;
+import flash.utils.ByteArray;
+
+import mx.containers.Panel;
+import mx.core.Application;
+import mx.core.UIComponent;
+import mx.effects.PropertyValuesHolder;
+import mx.events.AnimationEvent;
+
+public class FxAnimateShaderTransitionInstance extends FxAnimateInstance
+{
+    include "../../core/Version.as";
+
+    public function FxAnimateShaderTransitionInstance(target:Object)
+    {
+        super(target);
+        // Automatically keep disappearing targets around during this effect
+        autoRemoveTarget = true;
+    }
+
+    /**
+     * The bitmap data representing the start state of this effect.
+     * If this property is not set, it will be calculated automatically
+     * when the effect is played by grabbing a snapshot of the target
+     * object, or by using a transparent bitmap if the object does not
+     * exist in the start state of a transition.
+     */
+    public var bitmapFrom:BitmapData;
+
+    /**
+     * The bitmap data representing the end state of this effect.
+     * If this property is not set, it will be calculated automatically
+     * when the effect is played by grabbing a snapshot of the target
+     * object, or by using a transparent bitmap if the object does not
+     * exist in the end state of a transition.
+     */
+    public var bitmapTo:BitmapData;
+
+    /**
+     * The bytecode that a Shader object will use
+     * for running the transition between the two bitmaps.
+     *
+     *
The shader can have arbitrary functionality and inputs, but
+     * must, at a minimum, have three image4 inputs.
+     * The first input, which can be named anything, should go
+     * unused by your shader code - it exists only to satisfy the
+     * Flash requirement of assigning a filtered object to the
+     * first input. Note that inputs that go completely unused in a
+     * shader kernel may be optimized out, so your kernel code should
+     * at least reference this input to keep it around.

+     *
+     *
There must be at least two other inputs
+     * named from and to and one
+     * float parameter named progress, where
+     * from/to are the before/after bitmaps, respectively,
+     * and progress is the elapsed fraction of
+     * the effect.

+     *
+     *
Also, there are two optional parameters, width
+     * and height, which if they exist in the shader
+     * will be automatically set to the width and height for the
+     * effect instance target.

+     *
+     *
See the Pixel Bender Toolkit documentation for more
+     * information on writing shaders for Flash.

+     *
+     * @example To play an effect that uses a fictional Pixel Bender pbj
+     * file MyShader.pbj, which takes a single direction
+     * parameter, the calling code could do this:
+     * @example <listing version="3.0">
+     *   [Embed(source="MyShader.pbj", mimeType="application/octet-stream")]
+     *   private var ShaderCodeClass:Class;
+     *   var shaderEffect = new FxAnimateShaderTransition();
+     *   shaderEffect.shaderCode = ShaderCodeClass;
+     *   shaderEffect.shaderProperties = {direction : 1};</listing>
+     * or in MXML code, this:<listing version="3.0">
+     *   <FxAnimateShaderTransition
+     *       shaderCode="@Embed(source="MyShader.pbj", mimeType="application/octet-stream")"
+     *       shaderProperties="{{direction : 1}}}"/>
+     * </listing>
+     *
+     * @see flash.display.Shader
+     */
+    public var shaderCode:ByteArray;
+
+    /**
+     * A map of parameter name/value pairs that the shader
+     * will set its data values to prior to playing. For example,
+     * to set a parameter named direction in a
+     * shader with a Pixel Bender pbj file in Wipe.pbj, the calling
+     * code could do this:
+     * @example <listing version="3.0">
+     *   [Embed(source="Wipe.pbj", mimeType="application/octet-stream")]
+     *   private var WipeCodeClass:Class;
+     *   var shaderEffect = new FxAnimateShaderTransition();
+     *   shaderEffect.shaderCode = WipeCodeClass;
+     *   shaderEffect.shaderProperties = {direction:1};</listing>
+     */
+    public var shaderProperties:Object;
+
+    /**
+     * The Shader that is created using the shaderCode
+     * property as the underlying bytecode. Each instance needs its
+     * own separate Shader, but can share the bytecode. When each instance
+     * is played, we create the Shader that the instance will use.
+     */
+    protected var shader:Shader;
+
+
+    /**
+     * @private
+     * Cache the filters set on the target when the effect begins.
+     * We will assign our own filters during the effect, so we should
+     * restore the old filters when we're done
+     */
+    private var oldFilters:Array;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     * The filter wrapped around the instance's shader
+     * property. This filter is assigned to the filters
+     * property of the target object with every update during the animation,
+     * so that animated updates to the underlying shader are reflected
+     * in the filter applied to the display object that the user sees.
+     */
+    protected var shaderFilter:ShaderFilter;
+
+    /**
+     *  @private
+     */
+    override public function play():void
+    {
+        // TODO (chaase): Should take the 'from' snapshot on the
+        // fly, in case the object has changed since the overall
+        // effect (composite, etc) started much earlier and the
+        // object has changed since propertyChanges was initialized
+        if (!bitmapFrom)
+            if (propertyChanges &&
+                propertyChanges.start["bitmap"] !== undefined)
+            {
+                bitmapFrom = propertyChanges.start["bitmap"];
+            }
+        if (!bitmapTo)
+            if (propertyChanges &&
+                propertyChanges.end["bitmap"] !== undefined)
+            {
+                bitmapTo = propertyChanges.end["bitmap"];
+            }
+        if (!bitmapFrom)
+            if (propertyChanges &&
+                (propertyChanges.start["visible"] == false) ||
+                (propertyChanges.start["parent"] == null))
+                if (bitmapTo)
+                    bitmapFrom = new BitmapData(bitmapTo.width, bitmapTo.height, true, 0);
+                else
+                    bitmapFrom = new BitmapData(1, 1, true, 0);
+        if (!bitmapTo)
+            if (propertyChanges &&
+                (propertyChanges.end["visible"] == false) ||
+                (propertyChanges.end["parent"] == null))
+                if (bitmapFrom)
+                    bitmapTo = new BitmapData(bitmapFrom.width, bitmapFrom.height, true, 0);
+                else
+                    bitmapTo = new BitmapData(1, 1, true, 0);
+
+        // Fix up the visibility if it's becoming visible
+        if (propertyChanges &&
+            !propertyChanges.start["visible"] &&
+            propertyChanges.end["visible"])
+        {
+            target.visible = true;
+        }
+        shader = new Shader(shaderCode);
+        if (shader.data)
+        {
+            shader.data.from.input = bitmapFrom;
+            shader.data.to.input = bitmapTo;
+
+            propertyValuesList = [
+                new PropertyValuesHolder("progress", [0,1])
+            ];
+        }
+        // auto-set width/height if exposed in shader
+        if ("width" in shader.data)
+            shader.data.width.value = [target.width];
+        if ("height" in shader.data)
+            shader.data.height.value = [target.height];
+
+        if (shaderProperties)
+        {
+            for (var prop:String in shaderProperties)
+            {
+                var value:Object = shaderProperties[prop];
+                shader.data[prop].value = (value is Array) ?
+                    value :
+                    [value];
+            }
+        }
+        shaderFilter = new ShaderFilter(shader);
+        super.play();
+    }
+
+    /**
+     * Unlike Animate's setValue we assign the new value to the filter
+     * associated with our effect instance rather than the target of
+     * the effect.
+     *
+     * @private
+     */
+    override protected function setValue(property:String, value:Object):void
+    {
+        if (roundValues && (value is Number))
+            value = Math.round(Number(value));
+
+        shader.data.progress.value = [value];
+        target.filters = [shaderFilter];
+    }
+
+    override protected function startHandler(event:AnimationEvent):void
+    {
+        // Note that we don't want the old filters active on the target
+        // during the animation; these filters will already be accounted
+        // for when we take a bitmap snapshot of the object. Applying
+        // the same filters during the animation will effectively double
+        // their impact. So we simply record what the filters are, so that
+        // we can replace them when we're done, and then use only our
+        // shader filter during the animation.
+        oldFilters  = target.filters;
+
+    }
+    override protected function endHandler(event:AnimationEvent):void
+    {
+        target.filters = oldFilters;
+        oldFilters = null;
+        super.endHandler(event);
+    }
+
+    /**
+     * Unlike FxAnimate's getValue we return the value of the property requested
+     * from the filter associated with our effect instance rather than
+     * the effect target.
+     *
+     * @private
+     */
+    override protected function getCurrentValue(property:String):*
+    {
+        return shader[property];
+    }
+}
+}


Can now login as an anonymous user again

git-svn-id: c197267f952b24206666de142881703007ca05d5@9428 b35dd754-fafc-0310-a699-88a17e54d16e

--- src/org/jivesoftware/xiff/core/XMPPConnection.as
+++ src/org/jivesoftware/xiff/core/XMPPConnection.as
@@ -763,20 +763,13 @@
 		protected function sendAnonymousLogin_result(resultIQ:IQ):void
 		{
 			if( resultIQ.type == IQ.RESULT_TYPE ) {
-				try
-				{
-					// update resource
-					var resultAuth:Array = resultIQ.getAllExtensionsByNS(AuthExtension.NS)[0];
-					resource = resultAuth.resource;
-					// dispatch login event
-					loggedIn = true;
-					var event:LoginEvent = new LoginEvent();
-					dispatchEvent( event );
-				}
-				catch (e:Error)
-				{
-					trace("Error : null trapped. Resuming.");
-				}
+				// update resource
+				var resultAuth:AuthExtension = resultIQ.getAllExtensionsByNS(AuthExtension.NS)[0];
+				resource = resultAuth.resource;
+				// dispatch login event
+				loggedIn = true;
+				var event:LoginEvent = new LoginEvent();
+				dispatchEvent( event );
 			}
 		}


Shortened and fixed PathUtil.lastPathComponent

--- src/reprise/utils/PathUtil.as
+++ src/reprise/utils/PathUtil.as
@@ -128,34 +128,10 @@

 		public static function lastPathComponent(path:String) : String
 		{
-			var sepIndex:int = path.lastIndexOf('/');
-			var component : String;
-
-			if (sepIndex == -1)
-			{
-				component = '';
-			}
-			else
-			{
-				if (sepIndex == path.length - 1)
-				{
-					if (sepIndex == 0)
-					{
-						component = '';
-					}
-					else
-					{
-						component = lastPathComponent(path.substring(0, sepIndex));
-					}
-				}
-				else
-				{
-					component = path.substring(sepIndex + 1);
-				}
-			}
-			return component;
-		}
-
+			var endIndex : int = path.charAt(path.length-1) == '/'?path.length - 2 : path.length - 1;
+			return endIndex == -1 ? '' : path.substring(path.lastIndexOf('/', endIndex) + 1, endIndex + 1);
+		}
+
 		public static function stringByDeletingLastPathComponent(path:String) : String
 		{
 			var index:int = path.lastIndexOf(lastPathComponent(path));


Transferred from the Adobe Open Source Subversion Repository

Revision: 18987
Author:   rfrishbe@adobe.com
Date:     2010-12-03T01:08:34.503999Z

Log Message:
-----------
PARB changes for sizeElement/positionElement.  MobileSkin and MobileItemRenderer's methods have been renamed: resizeElement() -> setElementSize(), positionElement() -> setElementPosition().

Also, cleaning up text reflow for TextAreaSkin

QE notes:
Doc notes:
Bugs:
Reviewer: Evtim
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ButtonSkinBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/MobileSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ActionBarSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/VScrollBarSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/TextSkinBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileIconItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ButtonSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableTextField.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/TextAreaSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/HSliderTrackSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ActionBarButtonSkinBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/SelectableButtonSkinBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/HSliderSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/HSliderThumbSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/HScrollBarSkin.as</path>

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

--- frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ActionBarButtonSkinBase.as
+++ frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ActionBarButtonSkinBase.as
@@ -103,8 +103,8 @@
     override protected function layoutBorder(bgImg:DisplayObject, unscaledWidth:Number, unscaledHeight:Number):void
     {
         // extend 1px outside measured width to overlap highlight borders
-        resizeElement(bgImg, unscaledWidth + layoutBorderSize, unscaledHeight);
-        positionElement(bgImg, 0, 0);
+        setElementSize(bgImg, unscaledWidth + layoutBorderSize, unscaledHeight);
+        setElementPosition(bgImg, 0, 0);
     }

     override protected function drawChromeColor(chromeColorGraphics:Graphics, unscaledWidth:Number, unscaledHeight:Number):void


UpdateDisplaylist is now triggered on Event.RENDER instead of Event.ENTER_FRAME

--- src/org/openPyro/core/MeasurableControl.as
+++ src/org/openPyro/core/MeasurableControl.as
@@ -559,7 +559,10 @@
 			if(this._parentContainer && _dimensionsChanged){
 				dispatchEvent(new PyroEvent(PyroEvent.SIZE_CHANGED));
 			}else{
-				this.addEventListener(Event.ENTER_FRAME, validateDisplayList)
+				if(this.stage){
+					stage.invalidate();
+					this.addEventListener(Event.RENDER, validateDisplayList);
+				}

 			}
 		}
@@ -573,7 +576,7 @@
 				return;
 			}
 			if(event){
-				this.removeEventListener(Event.ENTER_FRAME,validateDisplayList)
+				this.removeEventListener(Event.RENDER,validateDisplayList)
 			}
 			for(var j:uint=0; j<this.numChildren; j++){
 				var child:MeasurableControl = this.getChildAt(j) as MeasurableControl;


Link caching; fixed seg positioning.

Link caching; fixed seg positioning.

--- src/Displays/DLink.as
+++ src/Displays/DLink.as
@@ -13,7 +13,9 @@

 		public var link:Link;

-		protected var cached:Boolean;
+		protected var cachedLines:Vector.<FlxSprite>;
+		protected var cachedStart:Point;
+		protected var cachedEnd:Point;
 		protected var cachedZoom:Number;

 		protected static const hSegs:Array = [];
@@ -32,6 +34,9 @@
 		}

 		protected function setSegs():void {
+			if (hSeg && U.zoom == segZoom)
+				return;
+
 			if (!hSegs[zoomIndex])
 				buildSegsForZoom();

@@ -64,22 +69,70 @@
 		}

 		protected function cacheValid():Boolean {
-			if (!cached)
-				return false;
-			if (U.zoom != cachedZoom)
-				return false;
-			return true;
+			return cachedLines && U.zoom == cachedZoom && link.source.Loc.equals(cachedStart) && link.destination.Loc.equals(cachedEnd);
 		}
 		protected function canBuildCache():Boolean {
-			return link.deployed && cachesThisFrame < MAX_CACHES_PER_FRAME && false; //TODO
+			return link.deployed && cachesThisFrame < MAX_CACHES_PER_FRAME; //TODO
 		}

 		protected function buildCache():void {
-			//TODO
-			//same as wire, but per jags, not per pre-path
-
-			cached = true;
+			cachedLines = new Vector.<FlxSprite>;
+			_bounds = null;
+
+			var source:Point = link.source.Loc;
+			var dest:Point = link.destination.Loc;
+			var midpoint:Point = new Point(Math.floor((source.x + dest.x) / 2),
+										   Math.floor((source.y + dest.y) / 2));
+			var primaryHorizontal:Boolean = Math.abs(source.x - dest.x) >= Math.abs(source.y - dest.y);
+
+			var width:int = getWidth();
+
+			//TODO: split up very long wires
+			if (primaryHorizontal) {
+				cachedLines.push(new FlxSprite(
+					Math.min(source.x, midpoint.x) * U.GRID_DIM - width/2,
+					source.y * U.GRID_DIM - width / 2
+				).makeGraphic(Math.abs(source.x - midpoint.x) * U.GRID_DIM + width, width, 0xffffffff, true));
+
+				cachedLines.push(new FlxSprite(
+					midpoint.x * U.GRID_DIM - width/2,
+					Math.min(source.y, dest.y) * U.GRID_DIM - width/2
+				).makeGraphic(width, Math.abs(source.y - dest.y) * U.GRID_DIM + width, 0xffffffff, true));
+
+				cachedLines.push(new FlxSprite(
+					Math.min(midpoint.x, dest.x) * U.GRID_DIM - width/2,
+					dest.y * U.GRID_DIM - width/2
+				).makeGraphic(Math.abs(midpoint.x - dest.x) * U.GRID_DIM + width, width, 0xffffffff, true));
+			} else {
+				cachedLines.push(new FlxSprite(
+					source.x * U.GRID_DIM - width/2,
+					Math.min(source.y, midpoint.y) * U.GRID_DIM - width/2
+				).makeGraphic(width, Math.abs(source.y - midpoint.y) * U.GRID_DIM + width, 0xffffffff, true));
+
+				cachedLines.push(new FlxSprite(
+					Math.min(source.x, dest.x) * U.GRID_DIM - width/2,
+					midpoint.y * U.GRID_DIM - width/2
+				).makeGraphic(Math.abs(source.x - dest.x) * U.GRID_DIM + width, width, 0xffffffff, true));
+
+				cachedLines.push(new FlxSprite(
+					dest.x * U.GRID_DIM - width/2,
+					Math.min(midpoint.y, dest.y) * U.GRID_DIM - width/2
+				).makeGraphic(width, Math.abs(midpoint.y - dest.y) * U.GRID_DIM + width, 0xffffffff, true));
+			}
+
+
 			cachedZoom = U.zoom;
+			cachedStart = link.source.Loc.clone();
+			cachedEnd = link.destination.Loc.clone();
+		}
+
+		protected function drawCached():void {
+			var color:uint = getColor();
+			for each (var line:FlxSprite in cachedLines) {
+				if (line.color != color)
+					line.color = color;
+				line.draw();
+			}
 		}

 		protected function drawDynamic(drawFromOrigin:Boolean = false):void {
@@ -105,8 +158,8 @@
 			end.x *= U.GRID_DIM;
 			end.y *= U.GRID_DIM;

-			if (!hSeg || U.zoom != segZoom)
-				setSegs();
+			setSegs();
+			var width:int = getWidth();

 			var color:uint = getColor();
 			if (hSeg.color != color)
@@ -116,48 +169,44 @@
 			//the following is awful

 			if (primaryHorizontal) {
-				hSeg.y = start.y;
+				hSeg.y = start.y - width/2;
 				for (x = start.x; x < midpoint.x; x += U.GRID_DIM) {
-					hSeg.x = x;
+					hSeg.x = x - width/2;
 					hSeg.draw();
 				}

-				vSeg.x = midpoint.x;
+				vSeg.x = midpoint.x - width/2;
 				var bottom:int = Math.max(start.y, end.y);
 				for (y = Math.min(start.y, end.y); y < bottom; y += U.GRID_DIM) {
-					vSeg.y = y;
+					vSeg.y = y - width/2;
 					vSeg.draw();
 				}

-				hSeg.y = end.y;
+				hSeg.y = end.y - width/2;
 				for (x = midpoint.x; x < end.x; x += U.GRID_DIM) {
-					hSeg.x = x;
+					hSeg.x = x - width/2;
 					hSeg.draw();
 				}
 			} else {
-				vSeg.x = start.x;
+				vSeg.x = start.x - width/2;
 				for (y = start.y; y < midpoint.y; y += U.GRID_DIM) {
-					vSeg.y = y;
+					vSeg.y = y - width/2;
 					vSeg.draw();
 				}

-				hSeg.y = midpoint.y;
+				hSeg.y = midpoint.y - width/2;
 				var right:int = Math.max(start.x, end.x);
 				for (x = Math.min(start.x, end.x); x < right; x += U.GRID_DIM) {
-					hSeg.x = x;
+					hSeg.x = x - width/2;
 					hSeg.draw();
 				}

-				vSeg.x = end.x;
+				vSeg.x = end.x - width/2;
 				for (y = midpoint.y; y < end.y; y += U.GRID_DIM) {
-					vSeg.y = y;
+					vSeg.y = y - width/2;
 					vSeg.draw();
 				}
 			}
-		}
-
-		protected function drawCached():void {
-			 //TODO
 		}

 		protected function getColor():uint {
@@ -173,37 +222,32 @@
 			return !boundingBox.intersects(U.screenRect());
 		}

+		protected var _bounds:Rectangle;
 		public function get boundingBox():Rectangle {
+			if (cacheValid() && _bounds)
+				return _bounds;
+
 			var sourceLoc:Point = link.source.Loc;
 			var destLoc:Point = link.destination.Loc;
 			var width:int = getWidth();
-			return new Rectangle(Math.min(sourceLoc.x, destLoc.x) * U.GRID_DIM - width, Math.min(sourceLoc.y, destLoc.y) * U.GRID_DIM - width,
-								 Math.abs(sourceLoc.x - destLoc.x) * U.GRID_DIM + width * 2,
-								 Math.abs(sourceLoc.y - destLoc.y) * U.GRID_DIM + width * 2); //TODO: cache?
+			_bounds = new Rectangle(Math.min(sourceLoc.x, destLoc.x) * U.GRID_DIM - width, Math.min(sourceLoc.y, destLoc.y) * U.GRID_DIM - width,
+									Math.abs(sourceLoc.x - destLoc.x) * U.GRID_DIM + width * 2,
+									Math.abs(sourceLoc.y - destLoc.y) * U.GRID_DIM + width * 2);
+			return _bounds;
 		}

 		override public function overlapsPoint(p:FlxPoint, _:Boolean=false, __:FlxCamera=null):Boolean {
 			if (!link.exists) return false;

-			if (cacheValid())
-				return super.overlapsPoint(p, _, __);
-
-			var bounds:Rectangle = boundingBox;
-			return (p.x < bounds.x || p.y < bounds.y || p.x >= bounds.right || p.y >= bounds.bottom)
+			//TODO: implement
+			return false;
 		}

 		override public function overlaps(o:FlxBasic, _:Boolean=false, __:FlxCamera=null):Boolean {
 			if (!link.exists) return false;

-			if (cacheValid())
-				return super.overlaps(o, _, __);
-
-			var bounds:Rectangle = boundingBox;
-			x = bounds.left;
-			y = bounds.top;
-			width = bounds.width;
-			height = bounds.height;
-			return super.overlaps(o, _, __);
+			//TODO: implement
+			return false;
 		}


added workaround for "set selectedItems" not working with
selectedItemsCompareFunction

Change-Id: Ibdf72733702211fca0508959d189e5fe8b4c5a85

--- WeaveUI/src/weave/ui/CustomTree.as
+++ WeaveUI/src/weave/ui/CustomTree.as
@@ -23,6 +23,7 @@
 	import flash.events.Event;
 	import flash.events.KeyboardEvent;
 	import flash.events.MouseEvent;
+	import flash.utils.Dictionary;

 	import mx.collections.ICollectionView;
 	import mx.collections.IViewCursor;
@@ -222,6 +223,53 @@
 		}

 		///////////////////////////////////////////////////////////////////////////////
+		// fixes bug where setting selectedItems does not work if the items are not in the dataProvider
+
+		[Bindable("change")]
+		[Bindable("valueCommit")]
+		[Inspectable(category="General")]
+		override public function get selectedItems():Array
+		{
+			return super.selectedItems;
+		}
+		override public function set selectedItems(items:Array):void
+		{
+			_uidCache = new Dictionary(true);
+			super.selectedItems = items;
+			_uidCache = null;
+		}
+		private var _uidCache:Dictionary;
+		override protected function itemToUID(data:Object):String
+		{
+			// call super.super.itemToUID(data) either way to avoid breaking other things
+			var uid:String = super.itemToUID(data);
+			if (_uidCache)
+			{
+				var cached:String = _uidCache[data];
+				if (cached)
+				{
+					// one-time override for ListBase.setSelectionDataLoop()
+					uid = cached;
+					delete _uidCache[data];
+				}
+			}
+			return uid;
+		}
+		override public function get selectedItemsCompareFunction():Function
+		{
+			if (super.selectedItemsCompareFunction != null)
+				return wrappedSelectedItemCompare as Function;
+			return null;
+		}
+		private function wrappedSelectedItemCompare(inDataProvider:Object, inSelectedItems:Object):Boolean
+		{
+			var equal:Boolean = super.selectedItemsCompareFunction(inDataProvider, inSelectedItems);
+			if (equal && _uidCache)
+				_uidCache[inDataProvider] = super.itemToUID(inSelectedItems);
+			return equal;
+		}
+
+		///////////////////////////////////////////////////////////////////////////////
 		// solution for display bugs when hierarchical data changes

 		private var _dataProvider:Object; // remembers previous value that was passed to "set dataProvider"


fixed bug handling missing async state

fixed bug handling missing async state

--- WeaveData/src/weave/data/KeySets/FilteredKeySet.as
+++ WeaveData/src/weave/data/KeySets/FilteredKeySet.as
@@ -236,7 +236,9 @@

 			for (; _i < _asyncInput.length; ++_i)
 			{
-				if (getTimer() > stopTime || !_asyncFilter)
+				if (!_asyncFilter)
+					return 1;
+				if (getTimer() > stopTime)
 					return _i / _asyncInput.length;

 				var key:IQualifiedKey = _asyncInput[_i] as IQualifiedKey;


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

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

 package mx.controls.olapDataGridClasses
 {


FLEX-35031 Added two more test functions to assert that dynamic object instances should work the same as anonymous object instances for finding items via HierarchicalCollectionViewCursor. Currently they pass, as expected.

--- frameworks/projects/advancedgrids/tests/mx/collections/HierarchicalCollectionViewCursor_FindAny_Tests.as
+++ frameworks/projects/advancedgrids/tests/mx/collections/HierarchicalCollectionViewCursor_FindAny_Tests.as
@@ -277,6 +277,36 @@
             assertEquals(ID_TO_FIND, currentEmployee.uniqueID);
         }

+        [Test]
+        public function test_findAny_finds_sealed_class_instance_via_dynamic_class_instance_with_subset_of_properties():void
+        {
+            //given
+            _utils.openAllNodes(_collectionView);
+            var lastEmployee:EmployeeVO = _employeesByID[_employeesByID.length - 1];
+
+            //when
+            var found:Boolean = _sut.findLast(new DynamicVO(lastEmployee.name));
+
+            //then
+            assertTrue(found);
+            assertEquals(lastEmployee, _sut.current);
+        }
+
+        [Test]
+        public function test_findLast_finds_sealed_class_instance_via_dynamic_class_instance_with_subset_of_properties():void
+        {
+            //given
+            _utils.openAllNodes(_collectionView);
+            var firstEmployee:EmployeeVO = _employeesByID[0];
+
+            //when
+            var found:Boolean = _sut.findLast(new DynamicVO(firstEmployee.name));
+
+            //then
+            assertTrue(found);
+            assertEquals(firstEmployee, _sut.current);
+        }
+
         /**
          * Note that in a perfect world this would work. However, to accomplish this task
          * we'd need to use flash.utils.describeType() (or
@@ -405,4 +435,12 @@
     {
         this.name = name;
     }
+}
+
+dynamic class DynamicVO
+{
+    public function DynamicVO(name:String)
+    {
+        this.name = name;
+    }
 }


去除无效引用

去除无效引用

--- src/net/manaca/loaderqueue/LoaderProgress.as
+++ src/net/manaca/loaderqueue/LoaderProgress.as
@@ -5,7 +5,6 @@
 import flash.utils.clearInterval;
 import flash.utils.setInterval;

-import net.manaca.utils.ArrayUtil;
 /**
  * 任务队列总进度更新时派发
  * @eventType flash.events.Event.CHANGE
@@ -131,10 +130,10 @@
         var itemsLen:int = items.length;
         var loader:ILoaderAdapter;
         var tp:Number = 0;
-        for (var i:int = 0; i < itemsLen; i++)
-        {
+        for (var i:int = 0; i < itemsLen; i++)
+        {
             loader = items[i];
-            tp += loader.bytesLoaded / loader.bytesTotal;
+            tp += loader.bytesLoaded / loader.bytesTotal;
         }
         _totalProgress = tp / itemsLen;
         dispatchEvent(new Event(Event.CHANGE));


fixed a bug in GGroup

fixed a bug in GGroup

--- source/fairygui/GGroup.as
+++ source/fairygui/GGroup.as
@@ -60,7 +60,7 @@

 		public function setBoundsChangedFlag(childSizeChanged:Boolean = false):void
 		{
-			if (_updating == 0 && parent != null && !_underConstruct)
+			if (_updating == 0 && parent != null)
 			{
 				if (childSizeChanged)
 					_percentReady = false;


fixed error in disposeObject()

fixed error in disposeObject()

--- WeaveJS/src/weavejs/core/SessionManager.as
+++ WeaveJS/src/weavejs/core/SessionManager.as
@@ -1002,7 +1002,7 @@

 				// unregister from parents
 				var parents:Array = d2d_child_parent.secondaryKeys(object);
-				for (var parent:Object in parents)
+				for each (var parent:Object in parents)
 					d2d_parent_child.remove(parent, object);
 				d2d_child_parent.removeAllPrimary(object);

@@ -1063,7 +1063,7 @@
 		{
 			var results:Array = [];
 			var parents:Array = d2d_child_parent.secondaryKeys(descendant);
-			for (var parent:Object in parents)
+			for each (var parent:Object in parents)
 			{
 				var name:String = _getChildPropertyName(parent as ILinkableObject, descendant);
 				if (name != null)


simplified code

simplified code

--- WeaveJS/src/weavejs/core/SessionManager.as
+++ WeaveJS/src/weavejs/core/SessionManager.as
@@ -39,10 +39,6 @@
 	 */
 	public class SessionManager implements ISessionManager
 	{
-		public function SessionManager()
-		{
-		}
-
 		public var debugBusyTasks:Boolean = false;

 		/**
@@ -193,11 +189,7 @@
 		 */
 		private function _getRegisteredChildren(parent:ILinkableObject):Array
 		{
-			var result:Array = [];
-			var children:Array = d2d_parent_child.secondaryKeys(parent);
-			for each (var child:ILinkableObject in children)
-				result.push(child);
-			return result;
+			return d2d_parent_child.secondaryKeys(parent);
 		}

 		/**
@@ -443,7 +435,7 @@
 		/**
 		 * keeps track of which objects are currently being traversed
 		 */
-		private var _getSessionStateIgnoreList:Object = new JS.WeakMap();
+		private var map_obj_getSessionStateIgnore:Object = new JS.WeakMap();

 		/**
 		 * @inheritDoc
@@ -490,13 +482,13 @@
 						JS.error('Unable to get property "'+name+'" of class "'+Weave.className(linkableObject)+'"');
 					}
 					// first pass: set result[name] to the ILinkableObject
-					if (property != null && !_getSessionStateIgnoreList.get(property))
+					if (property != null && !map_obj_getSessionStateIgnore.get(property))
 					{
 						// skip this property if it should not appear in the session state under the parent.
 						if (!d2d_child_parent.get(property, linkableObject))
 							continue;
 						// avoid infinite recursion in implicit session states
-						_getSessionStateIgnoreList.set(property, true);
+						map_obj_getSessionStateIgnore.set(property, true);
 						resultNames.push(name);
 						resultProperties.push(property);
 					}
@@ -526,7 +518,7 @@
 				}
 			}

-			_getSessionStateIgnoreList.set(linkableObject, undefined);
+			map_obj_getSessionStateIgnore.set(linkableObject, undefined);

 			return result;
 		}


SessionStateLog now uses default delay when loading history without
delay info.

Change-Id: Ibbd6856be7e7461bc734d4e94733c18c50228f9c

--- WeaveCore/src/weave/core/SessionStateLog.as
+++ WeaveCore/src/weave/core/SessionStateLog.as
@@ -382,8 +382,8 @@
 					case 0:
 					{
 						_prevState = state.currentState;
-						_undoHistory = LogEntry.convertGenericObjectsToLogEntries(state.undoHistory);
-						_redoHistory = LogEntry.convertGenericObjectsToLogEntries(state.redoHistory);
+						_undoHistory = LogEntry.convertGenericObjectsToLogEntries(state.undoHistory, _syncDelay);
+						_redoHistory = LogEntry.convertGenericObjectsToLogEntries(state.redoHistory, _syncDelay);
 						_nextId = state.nextId;
 						enableLogging.value = state.enableLogging;

@@ -433,13 +433,13 @@
 	 * This will convert an Array of generic objects to an Array of LogEntry objects.
 	 * Generic objects are easier to create backwards compatibility for.
 	 */
-	public static function convertGenericObjectsToLogEntries(array:Array):Array
+	public static function convertGenericObjectsToLogEntries(array:Array, defaultTriggerDelay:int):Array
 	{
 		for (var i:int = 0; i < array.length; i++)
 		{
 			var o:Object = array[i];
 			if (!(o is LogEntry))
-				array[i] = new LogEntry(o.id, o.forward, o.backward, o.triggerDelay);
+				array[i] = new LogEntry(o.id, o.forward, o.backward, o.triggerDelay || defaultTriggerDelay);
 		}
 		return array;
 	}