Transferred from the Adobe Open Source Subversion Repository

Revision: 4600
Author:   jszeto@adobe.com
Date:     2009-01-20T21:11:33.133710Z

Log Message:
-----------
Flex SDK - Move style metadata from base class down to component classes

Previously, all spark and text styles were defined on FxComponent even though not every component supports all of those styles. So I have moved each style to the top-most base class where the style will apply to all descendant classes of that base class.

This is the set of styles that were added to the various classes:

baseColor
color
focusColor
symbolColor
selectionColor
contentBackgroundColor
rollOverColor
alternatingItemColors
basic text styles
advanced text styles

Here are some details about the implementation:
- baseColor was added to FxComponent because every component and container supports it
- FxContainer and GroupBase are containers, so their children can potentially support any of the styles. Thus the container classes support all of the styles indirectly.
- FxDataContainer doesn't support all of the styles because its subclasses (FxButtonBar, FxList) don't support all styles.
- FxList supports selectionColor, but not inactiveSelectionColor or unfocusedSelectionColor. All other components that support selectionColor, support the other two styles, and thus include styles/metadata/SelectionFormatTextStyles.as
- GroupBase contains the style declarations that have the full ASDoc. All other declarations use the @copy keyword to reference the asdoc from GroupBase.

QE Notes: Update tests to remove references to styles that are no longer allowed on various components/FxButton.as
Doc Notes: Write the ASDoc comments for the style declarations in GroupBase
Bugs: n/a
Reviewer: Glenn

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxNumericStepper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxScroller.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxCheckBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/FxTextBase.as</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/projects/flex4/src/mx/components/baseClasses/FxComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/FxSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/FxScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxDataContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxTextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxSpinner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxContainer.as</path>

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

--- frameworks/projects/spark/src/spark/components/List.as
+++ frameworks/projects/spark/src/spark/components/List.as
@@ -22,6 +22,31 @@
 import mx.layout.HorizontalLayout;
 import mx.layout.VerticalLayout;
 import mx.skins.spark.FxDefaultItemRenderer;
+
+/**
+ *  @copy mx.components.baseClasses.GroupBase#alternatingItemColors
+ */
+[Style(name="alternatingItemColors", type="Array", arrayType="uint", format="Color", inherit="yes")]
+
+/**
+ *  @copy mx.components.baseClasses.GroupBase#contentBackgroundColor
+ */
+[Style(name="contentBackgroundColor", type="uint", format="Color", inherit="yes")]
+
+/**
+ *  @copy mx.components.baseClasses.GroupBase#rollOverColor
+ */
+[Style(name="rollOverColor", type="uint", format="Color", inherit="yes")]
+
+/**
+ *  @copy mx.components.baseClasses.GroupBase#selectionColor
+ */
+[Style(name="selectionColor", type="uint", format="Color", inherit="yes")]
+
+/**
+ *  @copy mx.components.baseClasses.GroupBase#symbolColor
+ */
+[Style(name="symbolColor", type="uint", format="Color", inherit="yes")]

 [IconFile("FxList.png")]


Transferred from the Adobe Open Source Subversion Repository

Revision: 142
Author:   proberts@adobe.com
Date:     2008-01-09T21:41:12.224334Z

Log Message:
-----------
Severity: ignore
Description: docs update -- fixing formatting of @mxml sections; also minor enhancements to FlexHTMLLoader class and member descriptions.

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/Window.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/FlexHTMLLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/WindowedApplication.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FlexNativeMenu.as</path>

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

--- frameworks/projects/airframework/src/mx/core/FlexHTMLLoader.as
+++ frameworks/projects/airframework/src/mx/core/FlexHTMLLoader.as
@@ -18,7 +18,8 @@
 import mx.utils.NameUtil;

 /**
- *  FlexLoader is a subclass of the Player's Loader class.
+ *  FlexHTMLLoader is a subclass of the Player's HTMLLoader class used by the
+ *  Flex HTML control.
  *  It overrides the toString() method
  *  to return a string indicating the location of the object
  *  within the hierarchy of DisplayObjects in the application.
@@ -87,14 +88,14 @@

     /**
      *  A flag that indicates whether the component can receive focus when selected.
-     *
-     *
As an optimization, if a child component in your component
+     *
+     *
As an optimization, if a child component in your component
      *  implements the IFocusManagerComponent interface, and you
      *  never want it to receive focus,
      *  you can set focusEnabled
      *  to false before calling addChild()
      *  on the child component.

-     *
+     *
      *
This will cause the FocusManager to ignore this component
      *  and not monitor it for changes to the tabEnabled,
      *  tabChildren, and mouseFocusEnabled properties.
@@ -110,7 +111,7 @@
     {
         return _focusEnabled;
     }
-
+
     /**
      *  @private
      */
@@ -136,9 +137,9 @@
     [Inspectable(defaultValue="true")]

     /**
-     *  Whether you can receive focus when clicked on.
+     *  Whether the component can receive focus when clicked on.
      *  If false, focus will be transferred to
-     *  the first parent that is mouseFocusEnable
+     *  the first parent that is mouseFocusEnable
      *  set to true.
      *
      *  @default true
@@ -174,7 +175,7 @@

     /**
      *  Called by the FocusManager when the component receives focus.
-     *  The component should draw or hide a graphic
+     *  The component should draw or hide a graphic
      *  that indicates that the component has focus.
      *
      *  @param isFocused If true, draw the focus indicator,
@@ -187,9 +188,9 @@
     /**
      *  Called by the FocusManager when the component receives focus.
      *  The component may in turn set focus to an internal component.
-     *  The components setFocus() method will still be called when focused by
+     *  The component's setFocus() method will still be called when focused by
      *  the mouse, but this method will be used when focus changes via the
-     *  keyboard
+     *  keyboard.
      *
      *  @param direction one of flash.display.FocusDirection
      */
@@ -211,9 +212,9 @@
      *  is built by the displayObjectToString() method
      *  of the mx.utils.NameUtils class from the name
      *  property of the object and its ancestors.
-     *
+     *
      *  @return A String indicating the location of this object
-     *  within the DisplayObject hierarchy.
+     *  within the DisplayObject hierarchy.
      *
      *  @see flash.display.DisplayObject#name
      *  @see mx.utils.NameUtils#displayObjectToString()


Transferred from the Adobe Open Source Subversion Repository

Revision: 3057
Author:   jimurphy@adobe.com
Date:     2008-09-02T15:18:38.819662Z

Log Message:
-----------
Merged 3.0.x revisions [2966,2969,2995,3004,3018-3019,3023,3029-3030,3046,3049,3052] -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/TileListItemRenderer.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/ModalWindowRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Menu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/dragClasses/DragProxy.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Button.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ColorPicker.as</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/3.0.x/frameworks/projects/framework/src/mx/events/InterDragManagerEvent.as" copyfrom-rev="3052" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterDragManagerEvent.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/PopUpRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManagerGlobals.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SWFBridgeEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/systemClasses/EventProxy.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DateField.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ISystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/tools/dependencychecker/flex/tools/dependencychecker/FrameworkSwcDependencyRules.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/sliderClasses/SliderThumb.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/treeClasses/TreeItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/DividedBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/DragManagerImpl.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SizeRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridHeader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/3.0.x/frameworks/projects/framework/src/mx/events/InterManagerRequest.as" copyfrom-rev="3052" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterManagerRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/FocusRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/wsdl/WSDL.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/PopUpButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/scrollClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/dividedBoxClasses/BoxDivider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Panel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ToolTipManagerImpl.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxRootDragEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/FocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ComboBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/3.0.x/frameworks/projects/framework/src/mx/events/SandboxMouseEvent.as" copyfrom-rev="3052" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxMouseEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManagerProxy.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxRootRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/EventUtil.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxRootMouseEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ScrollControlBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/sliderClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/CursorManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SWFBridgeRequest.as</path>

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

--- frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
+++ frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
@@ -2173,6 +2173,7 @@

         var o:Point = new Point(relX, relY);
         var r:Point = localToGlobal(o);
+		r = dataTip.parent.globalToLocal(r);

         dataTip.x = r.x < 0 ? 0 : r.x;
         dataTip.y = r.y < 0 ? 0 : r.y;


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

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

 package mx.rpc.soap.types
 {


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

--- frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridRendererProvider.as
+++ frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridRendererProvider.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.advancedDataGridClasses
 {


Rewrite ProxyPair to be more generic.

Rewrite ProxyPair to be more generic.

--- ProxyPair.as
+++ ProxyPair.as
@@ -1,6 +1,5 @@
 package
 {
-    import flash.errors.IllegalOperationError;
     import flash.events.Event;
     import flash.events.EventDispatcher;
     import flash.events.IOErrorEvent;
@@ -11,119 +10,122 @@
     import flash.utils.ByteArray;
     import flash.utils.clearTimeout;
     import flash.utils.setTimeout;
-
-    import swfcat;
-
+
+    /* An instance of a client-relay connection. */
     public class ProxyPair extends EventDispatcher
     {
+        // Socket to client.
+        private var s_c:*;
+        private var connect_c:Function;
+
+        // Socket to relay.
+        private var s_r:*;
+        private var connect_r:Function;
+
+        // Parent swfcat, for UI updates and rate meter.
         private var ui:swfcat;
-
-        protected var client_addr:Object;
-
-        /* Not defined here: subclasses should define their own
-         * protected var client_socket:Object;
-         */
-
+
+        // Pending byte read counts for relay and client sockets.
+        private var r2c_schedule:Array;
         private var c2r_schedule:Array;
-
-        private var relay_addr:Object;
-        private var relay_socket:Socket;
-        private var r2c_schedule:Array;
-
         // Callback id.
         private var flush_id:uint;
-
-        public function ProxyPair(self:ProxyPair, ui:swfcat)
+
+        public function log(msg:String):void
         {
-            if (self != this) {
-                //only a subclass can pass a valid reference to self
-            	throw new IllegalOperationError("ProxyPair cannot be instantiated directly.");
-            }
-
-            this.ui = ui;
-            this.c2r_schedule = new Array();
-            this.r2c_schedule = new Array();
-
-            setup_relay_socket();
-
-            /* client_socket setup should be taken */
-            /* care of in the subclass constructor */
-        }
-
-        public function close():void
-        {
-            if (relay_socket != null && relay_socket.connected) {
-                relay_socket.close();
-            }
-
-            /* subclasses should override to close */
-            /* their client_socket according to impl. */
-        }
-
-        public function get connected():Boolean
-        {
-            return (relay_socket != null && relay_socket.connected);
-
-            /* subclasses should override to check */
-            /* connectivity of their client_socket. */
-        }
-
-        public function set client(client_addr:Object):void
-        {
-            /* subclasses should override to */
-            /* connect the client_socket here */
-        }
-
-        public function set relay(relay_addr:Object):void
-        {
-            this.relay_addr = relay_addr;
-            log("Relay: connecting to " + relay_addr.host + ":" + relay_addr.port + ".");
-            relay_socket.connect(relay_addr.host, relay_addr.port);
-        }
-
-        protected function transfer_bytes(src:Object, dst:Object, num_bytes:uint):void
-        {
-            /* No-op: must be overridden by subclasses */
+            ui.puts(id() + ": " + msg)
         }

-        protected function socket_error(message:String):Function
+        // String describing this pair for output.
+        public function id():String
+        {
+            return "<>";
+        }
+
+        public function ProxyPair(ui:swfcat, s_c:*, connect_c:Function, s_r:*, connect_r:Function)
+        {
+            this.ui = ui;
+            /* s_c is a socket for connecting to the client. connect_c is a
+               function that, when called, connects s_c. Likewise for s_r and
+               connect_r. */
+            this.s_c = s_c;
+            this.connect_c = connect_c;
+            this.s_r = s_r;
+            this.connect_r = connect_r;
+
+            this.c2r_schedule = [];
+            this.r2c_schedule = [];
+        }
+
+        /* Return a function that shows an error message and closes the other half
+           of a communication pair. */
+        private function socket_error(message:String, other:*):Function
         {
             return function(e:Event):void {
                 if (e is TextEvent)
                     log(message + ": " + (e as TextEvent).text + ".");
                 else
                     log(message + ".");
-                close();
+                if (other && other.connected)
+                    other.close();
+                dispatchEvent(new Event(Event.COMPLETE));
             };
         }
-
-        private function setup_relay_socket():void
+
+        public function connect():void
         {
-            relay_socket = new Socket();
-            relay_socket.addEventListener(Event.CONNECT, function (e:Event):void {
-                log("Relay: connected to " + relay_addr.host + ":" + relay_addr.port + ".");
-                if (connected) {
-                    dispatchEvent(new Event(Event.CONNECT));
-                }
-            });
-            relay_socket.addEventListener(Event.CLOSE, socket_error("Relay: closed"));
-            relay_socket.addEventListener(IOErrorEvent.IO_ERROR, socket_error("Relay: I/O error"))
-            relay_socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socket_error("Relay: security error"))
-            relay_socket.addEventListener(ProgressEvent.SOCKET_DATA, relay_to_client);
+            s_r.addEventListener(Event.CONNECT, relay_connected);
+            s_r.addEventListener(Event.CLOSE, socket_error("Relay: closed", s_c));
+            s_r.addEventListener(IOErrorEvent.IO_ERROR, socket_error("Relay: I/O error", s_c));
+            s_r.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socket_error("Relay: security error", s_c));
+            s_r.addEventListener(ProgressEvent.SOCKET_DATA, relay_to_client);
+
+            s_c.addEventListener(Event.CONNECT, client_connected);
+            s_c.addEventListener(Event.CLOSE, socket_error("Client: closed", s_r));
+            s_c.addEventListener(IOErrorEvent.IO_ERROR, socket_error("Client: I/O error", s_r));
+            s_c.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socket_error("Client: security error", s_r));
+            s_c.addEventListener(ProgressEvent.SOCKET_DATA, client_to_relay);
+
+            log("Relay: connecting.");
+            connect_r();
+            log("Client: connecting.");
+            connect_c();
         }
-
-        protected function client_to_relay(e:ProgressEvent):void
+
+        private function relay_connected(e:Event):void
         {
-            c2r_schedule.push(e.bytesLoaded);
-            flush();
+            log("Relay: connected.");
         }
-
+
+        private function client_connected(e:Event):void
+        {
+            log("Client: connected.");
+        }
+
         private function relay_to_client(e:ProgressEvent):void
         {
             r2c_schedule.push(e.bytesLoaded);
             flush();
         }
-
+
+        private function client_to_relay(e:ProgressEvent):void
+        {
+            c2r_schedule.push(e.bytesLoaded);
+            flush();
+        }
+
+        private function transfer_chunk(s_from:*, s_to:*, n:uint,
+            label:String):void
+        {
+            var bytes:ByteArray;
+
+            bytes = new ByteArray();
+            s_from.readBytes(bytes, 0, n);
+            s_to.writeBytes(bytes);
+            ui.rate_limit.update(n);
+            log(label + ": read " + bytes.length + ".");
+        }
+
         /* Send as much data as the rate limit currently allows. */
         private function flush():void
         {
@@ -131,37 +133,21 @@
                 clearTimeout(flush_id);
             flush_id = undefined;

-            if (!connected)
-                /* Can't do anything until connected. */
+            if (!(s_r.connected && s_c.connected))
+                /* Can't do anything until both sockets are connected. */
                 return;

-            while (!ui.rate_limit.is_limited() && (c2r_schedule.length > 0 || r2c_schedule.length > 0)) {
-                var num_bytes:uint;
-
-                if (c2r_schedule.length > 0) {
-                    num_bytes = c2r_schedule.shift();
-                    transfer_bytes(null, relay_socket, num_bytes);
-                    ui.rate_limit.update(num_bytes);
-                }
-
-                if (r2c_schedule.length > 0) {
-                    num_bytes = r2c_schedule.shift();
-                    transfer_bytes(relay_socket, null, num_bytes);
-                    ui.rate_limit.update(num_bytes);
-                }
+            while (!ui.rate_limit.is_limited() &&
+                   (r2c_schedule.length > 0 || c2r_schedule.length > 0)) {
+                if (r2c_schedule.length > 0)
+                    transfer_chunk(s_r, s_c, r2c_schedule.shift(), "Relay");
+                if (c2r_schedule.length > 0)
+                    transfer_chunk(s_c, s_r, c2r_schedule.shift(), "Client");
             }

             /* Call again when safe, if necessary. */
-            if (c2r_schedule.length > 0 || r2c_schedule.length > 0)
+            if (r2c_schedule.length > 0 || c2r_schedule.length > 0)
                 flush_id = setTimeout(flush, ui.rate_limit.when() * 1000);
-        }
-
-        /* Helper function to write output to the
-         * swfcat console. Set as protected for
-         * subclasses */
-        protected function log(s:String):void
-        {
-            ui.puts(s);
         }
     }
 }


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

--- frameworks/projects/charts/src/mx/charts/styles/metadata/ItemRendererStyles.as
+++ frameworks/projects/charts/src/mx/charts/styles/metadata/ItemRendererStyles.as
@@ -1,24 +1,4 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.
-//
-////////////////////////////////////////////////////////////////////////////////

-/**
- *  A factory that represents the class the series will use to represent individual items on the chart. This class is instantiated once for each element in the chart.
- *	Classes used as an itemRenderer should implement the IFlexDisplayObject, ISimpleStyleClient, and IDataRenderer interfaces. The data property is assigned the
- *	chartItem that the skin instance renders.
- *
- *  @langversion 3.0
- *  @playerversion Flash 9
- *  @playerversion AIR 1.1
- *  @productversion Flex 3
- */
 [Style(name="itemRenderer", type="mx.core.IFactory", inherit="no")]

 /**


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

--- frameworks/projects/framework/src/mx/managers/IFocusManagerComplexComponent.as
+++ frameworks/projects/framework/src/mx/managers/IFocusManagerComplexComponent.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.managers
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 17740
Author:   clucier@adobe.com
Date:     2010-09-16T23:18:52.749737Z

Log Message:
-----------
Spark and Wireframe button skins now support the icon and iconPlacement functionality of ButtonBase.
ButtonBarBase now supports iconField an iconFunction.

QE notes: None
Doc notes: None
Bugs: None
Reviewer: Glenn
Tests run: Checking, Full Cyclone
Is noteworthy for integration: Yes

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/TabBarButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/wireframe/src/spark/skins/wireframe/TabBarButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/spark-manifest.xml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/defaults.css</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ButtonBarFirstButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonBarFirstButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ButtonBarMiddleButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonBarMiddleButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ToggleButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/wireframe/src/spark/skins/wireframe/ToggleButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/DefaultButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ButtonBarLastButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/wireframe/src/spark/skins/wireframe/DefaultButtonSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonBarLastButtonSkin.mxml</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/SparkButtonSkin.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as
@@ -11,545 +11,710 @@

 package spark.components.supportClasses
 {
-import flash.events.Event;
-import flash.events.EventPhase;
-import flash.events.FocusEvent;
-import flash.events.KeyboardEvent;
-import flash.events.MouseEvent;
-import flash.ui.Keyboard;
-
-import mx.collections.IList;
-import mx.core.EventPriority;
-import mx.core.IFactory;
-import mx.core.ISelectableList;
-import mx.core.IVisualElement;
-import mx.core.mx_internal;
-import mx.events.FlexEvent;
-import mx.events.IndexChangedEvent;
-import mx.managers.IFocusManagerComponent;
-
-import spark.components.ButtonBarButton;
-import spark.components.IItemRenderer;
-import spark.events.IndexChangeEvent;
-import spark.events.RendererExistenceEvent;
-
-use namespace mx_internal;  // use of ListBase/setCurrentCaretIndex(index);
-
-[AccessibilityClass(implementation="spark.accessibility.ButtonBarBaseAccImpl")]
-/**
- *  The ButtonBarBase class defines the common behavior for the ButtonBar, TabBar and similar subclasses.
- *  This class does not add any new API however it refines selection, keyboard focus and keyboard navigation
- *  behavior for the control's ItemRenderer elements.
- *  This base class is not intended to be instantiated directly.
- *
- *
Clicking on an ItemRenderer selects it by setting the selectedIndex and the
- *  caretIndex properties.  If requireSelection is false, then clicking
- *  again deselects it.  If the data provider is an ISelectableList object, then its
- *  selectedIndex is set as well.

- *
- *
Arrow key events are handled by adjusting the caretIndex.
- *  If arrowKeysWrapFocus is true, then the caretIndex wraps.
- *  Pressing the Space key selects the ItemRenderer at the caretIndex.

- *
- *
The showsCaret property of the ItemRenderer at caretIndex
- *  is set to true when the ButtonBarBase object has focus and
- *  the caretIndex was reached as a consequence
- *  of a keyboard gesture.
- *  If the caretIndex was set as a side effect of responding to a
- *  mouse click, then showsCaret is not set.

- *
- *
The allowDeselection property of ButtonBarButton
- *  ItemRenderers is set to !requireSelection.

- *
- *  @mxml
- *
- *
The <s:ButtonBarBase> tag inherits all of the tag
- *  attributes of its superclass and adds no new tag attributes:

- *
- *

- *  <s:ButtonBarBase/>
- *

-  *
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-public class ButtonBarBase extends ListBase
-{
-    include "../../core/Version.as";
-
-    //--------------------------------------------------------------------------
-    //
-    //  Class mixins
-    //
-    //--------------------------------------------------------------------------
+    import flash.events.Event;
+    import flash.events.EventPhase;
+    import flash.events.FocusEvent;
+    import flash.events.KeyboardEvent;
+    import flash.events.MouseEvent;
+    import flash.ui.Keyboard;

+    import mx.collections.IList;
+    import mx.core.EventPriority;
+    import mx.core.IFactory;
+    import mx.core.ISelectableList;
+    import mx.core.IVisualElement;
+    import mx.core.mx_internal;
+    import mx.events.FlexEvent;
+    import mx.events.IndexChangedEvent;
+    import mx.managers.IFocusManagerComponent;
+
+    import spark.components.ButtonBarButton;
+    import spark.components.IItemRenderer;
+    import spark.components.supportClasses.ButtonBase;
+    import spark.events.IndexChangeEvent;
+    import spark.events.RendererExistenceEvent;
+
+    use namespace mx_internal;  // use of ListBase/setCurrentCaretIndex(index);
+
+    [AccessibilityClass(implementation="spark.accessibility.ButtonBarBaseAccImpl")]
     /**
-     *  @private
-     *  Placeholder for mixin by ButtonBarBaseAccImpl.
-     */
-    mx_internal static var createAccessibilityImplementation:Function;
-
-    /**
-     *  Constructor.
+     *  The ButtonBarBase class defines the common behavior for the ButtonBar, TabBar and similar subclasses.
+     *  This class does not add any new API however it refines selection, keyboard focus and keyboard navigation
+     *  behavior for the control's ItemRenderer elements.
+     *  This base class is not intended to be instantiated directly.
      *
-     *
Initializes tab processing: tabbing to this component will give it the focus, but not
-     *  clicking on it with the mouse.  Tabbing to the children is disabled.

-     *
+     *
Clicking on an ItemRenderer selects it by setting the selectedIndex and the
+     *  caretIndex properties.  If requireSelection is false, then clicking
+     *  again deselects it.  If the data provider is an ISelectableList object, then its
+     *  selectedIndex is set as well.

+     *
+     *
Arrow key events are handled by adjusting the caretIndex.
+     *  If arrowKeysWrapFocus is true, then the caretIndex wraps.
+     *  Pressing the Space key selects the ItemRenderer at the caretIndex.

+     *
+     *
The showsCaret property of the ItemRenderer at caretIndex
+     *  is set to true when the ButtonBarBase object has focus and
+     *  the caretIndex was reached as a consequence
+     *  of a keyboard gesture.
+     *  If the caretIndex was set as a side effect of responding to a
+     *  mouse click, then showsCaret is not set.

+     *
+     *
The allowDeselection property of ButtonBarButton
+     *  ItemRenderers is set to !requireSelection.

+     *
+     *  @mxml
+     *
+     *
The <s:ButtonBarBase> tag inherits all of the tag
+     *  attributes of its superclass and adds no new tag attributes:

+     *
+     *

+     *  <s:ButtonBarBase/>
+     *

+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
-     */
-    public function ButtonBarBase()
+     */
+    public class ButtonBarBase extends ListBase
     {
-        super();
-
-        tabChildren = false;
-        tabEnabled = true;
-        tabFocusEnabled = true;
-        setCurrentCaretIndex(0);
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Variables
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     *  If false, don't show the focusRing for the tab at caretIndex, see
-     *  itemShowingCaret() below.
-     *
-     *  If the caret index changes because of something other than a arrow
-     *  or space keypress then we don't show the focus ring, i.e. we do not
-     *  set showsCaret=true for the item renderer at caretIndex.
-     *
-     *  This flag is valid at commitProperties() time.  It's set to false
-     *  if at least one selectedIndex change (see item_clickHandler()) occurred
-     *  because of a mouse click.
-     */
-    private var enableFocusHighlight:Boolean = true;
-
-    /**
-     *  @private
-     */
-    private var inCollectionChangeHandler:Boolean = false;
-
-    /**
-     *  @private
-     *  Used to distinguish item_clickHandler() calls initiated by the mouse, from calls
-     *  initiated by pressing the space bar.
-     */
-    private var inKeyUpHandler:Boolean = false;
-
-    /**
-     *  @private
-     *  Index of item that is currently pressed by the
-     *  spacebar.
-     */
-    private var pressedIndex:Number;
-
-    //--------------------------------------------------------------------------
-    //
-    //  Overridden Properties
-    //
-    //--------------------------------------------------------------------------
-
-    //----------------------------------
-    //  requireSelection
-    //----------------------------------
-
-    private var requireSelectionChanged:Boolean;
-
-    /**
-     *  @private
-     *  See commitProperties().
-     */
-    override public function set requireSelection(value:Boolean):void
-    {
-        if (value == requireSelection)
-            return;
-
-        super.requireSelection = value;
-        requireSelectionChanged = true;
-        invalidateProperties();
-    }
-
-    //----------------------------------
-    //  dataProvider
-    //----------------------------------
-
-    /**
-     *  @private
-     */
-    override public function set dataProvider(value:IList):void
-    {
-        if (dataProvider is ISelectableList)
-        {
-            dataProvider.removeEventListener(FlexEvent.VALUE_COMMIT, dataProvider_changeHandler);
-            dataProvider.removeEventListener(IndexChangedEvent.CHANGE, dataProvider_changeHandler);
-        }
-
-        if (value is ISelectableList)
-        {
-            value.addEventListener(FlexEvent.VALUE_COMMIT, dataProvider_changeHandler, false, 0, true);
-            value.addEventListener(IndexChangedEvent.CHANGE, dataProvider_changeHandler, false, 0, true);
-        }
-
-        super.dataProvider = value;
-
-        if (value is ISelectableList)
+        include "../../core/Version.as";
+
+        //--------------------------------------------------------------------------
+        //
+        //  Class mixins
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         *  Placeholder for mixin by ButtonBarBaseAccImpl.
+         */
+        mx_internal static var createAccessibilityImplementation:Function;
+
+        /**
+         *  Constructor.
+         *
+         *
Initializes tab processing: tabbing to this component will give it the focus, but not
+         *  clicking on it with the mouse.  Tabbing to the children is disabled.

+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        public function ButtonBarBase()
+        {
+            super();
+
+            tabChildren = false;
+            tabEnabled = true;
+            tabFocusEnabled = true;
+            setCurrentCaretIndex(0);
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Variables
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         *  If false, don't show the focusRing for the tab at caretIndex, see
+         *  itemShowingCaret() below.
+         *
+         *  If the caret index changes because of something other than a arrow
+         *  or space keypress then we don't show the focus ring, i.e. we do not
+         *  set showsCaret=true for the item renderer at caretIndex.
+         *
+         *  This flag is valid at commitProperties() time.  It's set to false
+         *  if at least one selectedIndex change (see item_clickHandler()) occurred
+         *  because of a mouse click.
+         */
+        private var enableFocusHighlight:Boolean = true;
+
+        /**
+         *  @private
+         */
+        private var inCollectionChangeHandler:Boolean = false;
+
+        /**
+         *  @private
+         *  Used to distinguish item_clickHandler() calls initiated by the mouse, from calls
+         *  initiated by pressing the space bar.
+         */
+        private var inKeyUpHandler:Boolean = false;
+
+        /**
+         *  @private
+         *  Index of item that is currently pressed by the
+         *  spacebar.
+         */
+        private var pressedIndex:Number;
+
+        //--------------------------------------------------------------------------
+        //
+        //  Overridden Properties
+        //
+        //--------------------------------------------------------------------------
+
+        //----------------------------------
+        //  dataProvider
+        //----------------------------------
+
+        /**
+         *  @private
+         */
+        override public function set dataProvider(value:IList):void
+        {
+            if (dataProvider is ISelectableList)
+            {
+                dataProvider.removeEventListener(FlexEvent.VALUE_COMMIT, dataProvider_changeHandler);
+                dataProvider.removeEventListener(IndexChangedEvent.CHANGE, dataProvider_changeHandler);
+            }
+
+            if (value is ISelectableList)
+            {
+                value.addEventListener(FlexEvent.VALUE_COMMIT, dataProvider_changeHandler, false, 0, true);
+                value.addEventListener(IndexChangedEvent.CHANGE, dataProvider_changeHandler, false, 0, true);
+            }
+
+            super.dataProvider = value;
+
+            if (value is ISelectableList)
+                selectedIndex = ISelectableList(dataProvider).selectedIndex;
+        }
+
+        //----------------------------------
+        //  iconField
+        //----------------------------------
+
+        /**
+         *  @private
+         */
+        private var _iconField:String;
+
+        /**
+         *  @private
+         */
+        private var iconFieldOrFunctionChanged:Boolean;
+
+        /**
+         *  The name of the field in the data provider items which serves
+         *  as the icon to display.
+         *
+         *  The iconFunction property overrides this property.
+         *
+         *  @default null
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4.5
+         */
+        public function get iconField():String
+        {
+            return _iconField;
+        }
+
+        /**
+         *  @private
+         */
+        public function set iconField(value:String):void
+        {
+            if (value == _iconField)
+                return
+
+                _iconField = value;
+            iconFieldOrFunctionChanged = true;
+            invalidateProperties();
+        }
+
+        //----------------------------------
+        //  iconFunction
+        //----------------------------------
+
+        /**
+         *  @private
+         */
+        private var _iconFunction:Function;
+
+        /**
+         *  A user-supplied function to run on each item to determine its icon.
+         *  The iconFunction property overrides
+         *  the iconField property.
+         *
+         *
You can supply an iconFunction that finds the
+         *  appropriate fields and returns a displayable icon.

+         *
+         *
The icon function takes a single argument which is the item in
+         *  the data provider and returns a valid BitmapImage source.

+         *

+         *  myIconFunction(item:Object):Object

+         *
+         *  @default null
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4.5
+         */
+        public function get iconFunction():Function
+        {
+            return _iconFunction;
+        }
+
+        /**
+         *  @private
+         */
+        public function set iconFunction(value:Function):void
+        {
+            if (value == _iconFunction)
+                return
+
+                _iconFunction = value;
+            iconFieldOrFunctionChanged = true;
+            invalidateProperties();
+        }
+
+        //----------------------------------
+        //  requireSelection
+        //----------------------------------
+
+        private var requireSelectionChanged:Boolean;
+
+        /**
+         *  @private
+         *  See commitProperties().
+         */
+        override public function set requireSelection(value:Boolean):void
+        {
+            if (value == requireSelection)
+                return;
+
+            super.requireSelection = value;
+            requireSelectionChanged = true;
+            invalidateProperties();
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Overridden Methods
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         *  Called by the initialize() method of UIComponent
+         *  to hook in the accessibility code.
+         */
+        override protected function initializeAccessibility():void
+        {
+            if (ButtonBarBase.createAccessibilityImplementation != null)
+                ButtonBarBase.createAccessibilityImplementation(this);
+        }
+
+        /**
+         *  @private
+         *  if the collection is changing and the collection is a viewstack
+         *  the viewstack will also adjust the selection and notify us
+         *  via dataProvider_changeHandler so we want to
+         *  ignore calls to adjustSelection that the base class
+         *  calls so we don't increment or decrement
+         *  selectedIndex twice
+         */
+        override protected function dataProvider_collectionChangeHandler(event:Event):void
+        {
+            inCollectionChangeHandler = true;
+
+            super.dataProvider_collectionChangeHandler(event);
+
+            inCollectionChangeHandler = false;
+
+        }
+
+        /**
+         *  @private
+         */
+        override protected function adjustSelection(newIndex:int, add:Boolean=false):void
+        {
+            // see comment in dataProvider_collectionChangeHandler
+            if (inCollectionChangeHandler && dataProvider is ISelectableList)
+                return;
+
+            super.adjustSelection(newIndex, add);
+        }
+
+        /**
+         *  @private
+         */
+        override protected function commitProperties():void
+        {
+            super.commitProperties();
+
+            if (requireSelectionChanged && dataGroup)
+            {
+                requireSelectionChanged = false;
+                const n:int = dataGroup.numElements;
+                for (var i:int = 0; i < n; i++)
+                {
+                    var renderer:ButtonBarButton = dataGroup.getElementAt(i) as ButtonBarButton;
+                    if (renderer)
+                        renderer.allowDeselection = !requireSelection;
+                }
+            }
+
+            if (iconFieldOrFunctionChanged)
+            {
+                updateRendererIcons();
+                iconFieldOrFunctionChanged = false;
+            }
+
+            enableFocusHighlight = true;
+        }
+
+        /**
+         *  @private
+         *  Return the item renderer at the specified index, or null.
+         */
+        private function getItemRenderer(index:int):IVisualElement
+        {
+            if (!dataGroup || (index < 0) || (index >= dataGroup.numElements))
+                return null;
+
+            return dataGroup.getElementAt(index);
+        }
+
+        /**
+         *  @private
+         *  Called when setCurrentCaretIndex() moves the caret, or when it's moved as a consequence
+         *  of items being moved/removed.   See ListBase/caretIndexAdjusted.
+         */
+        override protected function itemShowingCaret(index:int, showsCaret:Boolean):void
+        {
+            super.itemShowingCaret(index, showsCaret);
+
+            const renderer:IVisualElement = getItemRenderer(index);
+            if (renderer)
+            {
+                const hasFocus:Boolean = focusManager && (focusManager.getFocus() == this);
+                renderer.depth = (showsCaret) ? 1 : 0;
+                if (renderer is IItemRenderer)
+                    IItemRenderer(renderer).showsCaret = showsCaret && enableFocusHighlight && hasFocus;
+            }
+        }
+
+        /**
+         *  @private
+         *  Called when the focus is gained/lost by tabbing in or out.
+         */
+        override public function drawFocus(isFocused:Boolean):void
+        {
+            const renderer:IVisualElement = getItemRenderer(caretIndex);
+            if (renderer)
+            {
+                renderer.depth = (isFocused) ? 1 : 0;
+                if (renderer is IItemRenderer)
+                    IItemRenderer(renderer).showsCaret = isFocused;
+            }
+        }
+
+        /**
+         *  @private
+         */
+        override protected function itemSelected(index:int, selected:Boolean):void
+        {
+            super.itemSelected(index, selected);
+
+            const renderer:IItemRenderer = getItemRenderer(index) as IItemRenderer;
+            if (renderer)
+            {
+                if (selected)
+                    setCurrentCaretIndex(index);  // causes itemShowingCaret() call
+                renderer.selected = selected;
+            }
+
+            if ((dataProvider is ISelectableList) && selected)
+                ISelectableList(dataProvider).selectedIndex = index;
+        }
+
+        /**
+         *  @private
+         */
+        override protected function partAdded(partName:String, instance:Object):void
+        {
+            super.partAdded(partName, instance);
+
+            if (instance == dataGroup)
+            {
+                dataGroup.addEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
+                dataGroup.addEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
+            }
+        }
+
+        /**
+         *  @private
+         */
+        override protected function partRemoved(partName:String, instance:Object):void
+        {
+            if (instance == dataGroup)
+            {
+                dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
+                dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
+            }
+
+            super.partRemoved(partName, instance);
+        }
+
+        /**
+         *  @private
+         */
+        override public function updateRenderer(renderer:IVisualElement, itemIndex:int, data:Object):void
+        {
+            itemToIcon(renderer, data);
+            super.updateRenderer(renderer, itemIndex, data);
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Methods
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         */
+        private function itemToIcon(renderer:IVisualElement, item:Object):void
+        {
+            if (!(renderer is ButtonBase))
+                return;
+
+            // iconFunction takes precedence.
+            if (_iconFunction != null)
+            {
+                ButtonBase(renderer).icon = _iconFunction(item);
+                return;
+            }
+
+            // iconField
+            if (_iconField && _iconField.length > 0)
+            {
+                if (item is Object)
+                {
+                    try
+                    {
+                        if (item[_iconField] != null)
+                        {
+                            ButtonBase(renderer).icon = item[_iconField];
+                            return;
+                        }
+                    }
+                    catch(e:Error)
+                    {
+                    }
+                }
+            }
+        }
+
+        /**
+         *  @private
+         */
+        private function updateRendererIcons():void
+        {
+            if (!dataGroup)
+                return;
+
+            const count:int = dataGroup.numElements;
+            for (var i:int = 0; i < count; i++)
+            {
+                var renderer:IItemRenderer = dataGroup.getElementAt(i) as IItemRenderer;
+                if (renderer && renderer.data)
+                    itemToIcon(renderer, renderer.data);
+            }
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Event Handlers
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *  @private
+         */
+        private function dataProvider_changeHandler(event:Event):void
+        {
             selectedIndex = ISelectableList(dataProvider).selectedIndex;
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Overridden Methods
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     *  Called by the initialize() method of UIComponent
-     *  to hook in the accessibility code.
-     */
-    override protected function initializeAccessibility():void
-    {
-        if (ButtonBarBase.createAccessibilityImplementation != null)
-            ButtonBarBase.createAccessibilityImplementation(this);
-    }
-
-    /**
-     *  @private
-     *  if the collection is changing and the collection is a viewstack
-     *  the viewstack will also adjust the selection and notify us
-     *  via dataProvider_changeHandler so we want to
-     *  ignore calls to adjustSelection that the base class
-     *  calls so we don't increment or decrement
-     *  selectedIndex twice
-     */
-    override protected function dataProvider_collectionChangeHandler(event:Event):void
-    {
-        inCollectionChangeHandler = true;
-
-        super.dataProvider_collectionChangeHandler(event);
-
-        inCollectionChangeHandler = false;
-
-    }
-
-    /**
-     *  @private
-     */
-    override protected function adjustSelection(newIndex:int, add:Boolean=false):void
-    {
-        // see comment in dataProvider_collectionChangeHandler
-        if (inCollectionChangeHandler && dataProvider is ISelectableList)
-            return;
-
-        super.adjustSelection(newIndex, add);
-    }
-
-    /**
-     *  @private
-     */
-    override protected function commitProperties():void
-    {
-        super.commitProperties();
-
-        if (requireSelectionChanged && dataGroup)
-        {
-            requireSelectionChanged = false;
-            const n:int = dataGroup.numElements;
-            for (var i:int = 0; i < n; i++)
-            {
-                var renderer:ButtonBarButton = dataGroup.getElementAt(i) as ButtonBarButton;
-                if (renderer)
-                    renderer.allowDeselection = !requireSelection;
-            }
-        }
-
-        enableFocusHighlight = true;
-    }
-
-    /**
-     *  @private
-     *  Return the item renderer at the specified index, or null.
-     */
-    private function getItemRenderer(index:int):IVisualElement
-    {
-        if (!dataGroup || (index < 0) || (index >= dataGroup.numElements))
-            return null;
-
-        return dataGroup.getElementAt(index);
-    }
-
-    /**
-     *  @private
-     *  Called when setCurrentCaretIndex() moves the caret, or when it's moved as a consequence
-     *  of items being moved/removed.   See ListBase/caretIndexAdjusted.
-     */
-    override protected function itemShowingCaret(index:int, showsCaret:Boolean):void
-    {
-        super.itemShowingCaret(index, showsCaret);
-
-        const renderer:IVisualElement = getItemRenderer(index);
-        if (renderer)
-        {
-            const hasFocus:Boolean = focusManager && (focusManager.getFocus() == this);
-            renderer.depth = (showsCaret) ? 1 : 0;
-            if (renderer is IItemRenderer)
-                IItemRenderer(renderer).showsCaret = showsCaret && enableFocusHighlight && hasFocus;
-        }
-    }
-
-    /**
-     *  @private
-     *  Called when the focus is gained/lost by tabbing in or out.
-     */
-    override public function drawFocus(isFocused:Boolean):void
-    {
-        const renderer:IVisualElement = getItemRenderer(caretIndex);
-        if (renderer)
-        {
-            renderer.depth = (isFocused) ? 1 : 0;
-            if (renderer is IItemRenderer)
-                IItemRenderer(renderer).showsCaret = isFocused;
-        }
-    }
-
-    /**
-     *  @private
-     */
-    override protected function itemSelected(index:int, selected:Boolean):void
-    {
-        super.itemSelected(index, selected);
-
-        const renderer:IItemRenderer = getItemRenderer(index) as IItemRenderer;
-        if (renderer)
-        {
-            if (selected)
-                setCurrentCaretIndex(index);  // causes itemShowingCaret() call
-            renderer.selected = selected;
-        }
-
-        if ((dataProvider is ISelectableList) && selected)
-            ISelectableList(dataProvider).selectedIndex = index;
-    }
-
-    /**
-     *  @private
-     */
-    override protected function partAdded(partName:String, instance:Object):void
-    {
-        super.partAdded(partName, instance);
-
-        if (instance == dataGroup)
-        {
-            dataGroup.addEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
-            dataGroup.addEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
-        }
-    }
-
-    /**
-     *  @private
-     */
-    override protected function partRemoved(partName:String, instance:Object):void
-    {
-        if (instance == dataGroup)
-        {
-            dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_ADD, dataGroup_rendererAddHandler);
-            dataGroup.removeEventListener(RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
-        }
-
-        super.partRemoved(partName, instance);
-    }
-
-
-    //--------------------------------------------------------------------------
-    //
-    //  Event Handlers
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     */
-    private function dataProvider_changeHandler(event:Event):void
-    {
-        selectedIndex = ISelectableList(dataProvider).selectedIndex;
-    }
-
-    /**
-     *  @private
-     */
-    private function dataGroup_rendererAddHandler(event:RendererExistenceEvent):void
-    {
-        const renderer:IVisualElement = event.renderer;
-        if (renderer)
-        {
-            renderer.addEventListener(MouseEvent.CLICK, item_clickHandler);
-            if (renderer is IFocusManagerComponent)
-                IFocusManagerComponent(renderer).focusEnabled = false;
-            if (renderer is ButtonBarButton)
-                ButtonBarButton(renderer).allowDeselection = !requireSelection;
-        }
-    }
-
-    /**
-     *  @private
-     */
-    private function dataGroup_rendererRemoveHandler(event:RendererExistenceEvent):void
-    {
-        const renderer:IVisualElement = event.renderer;
-        if (renderer)
-            renderer.removeEventListener(MouseEvent.CLICK, item_clickHandler);
-    }
-
-    /**
-     *  @private
-     *  Called synchronously when the space bar is pressed or the mouse is clicked.
-     */
-    private function item_clickHandler(event:MouseEvent):void
-    {
-        var newIndex:int;
-        if (event.currentTarget is IItemRenderer)
-            newIndex = IItemRenderer(event.currentTarget).itemIndex;
-        else
-            newIndex = dataGroup.getElementIndex(event.currentTarget as IVisualElement);
-
-        var oldSelectedIndex:int = selectedIndex;
-        if (newIndex == selectedIndex)
-        {
-            if (!requireSelection)
-                setSelectedIndex(NO_SELECTION, true);
-        }
-        else
-            setSelectedIndex(newIndex, true);
-
-        // Changing the selectedIndex typically causes a call to itemSelected() at
-        // commitProperties() time.   We'll update the caretIndex then.  If this
-        // method was -not- called as a consequence of a keypress, we will not show
-        // the focus highlight at caretIndex.  See itemShowingCaret().
-
-        if (enableFocusHighlight && (selectedIndex != oldSelectedIndex))
-            enableFocusHighlight = inKeyUpHandler;
-    }
-
-    /**
-     *  @private
-     *  Increment or decrement the caretIndex.  Wrap if arrowKeysWrapFocus=true.
-     */
-    private function adjustCaretIndex(delta:int):void
-    {
-        if (!dataGroup || (caretIndex < 0))
-            return;
-
-        const oldCaretIndex:int = caretIndex;
-        const length:int = dataGroup.numElements;
-
-        if (arrowKeysWrapFocus)
-            setCurrentCaretIndex((caretIndex + delta + length) % length);
-        else
-            setCurrentCaretIndex(Math.min(length - 1, Math.max(0, caretIndex + delta)));
-
-        if (oldCaretIndex != caretIndex)
-            dispatchEvent(new IndexChangeEvent(IndexChangeEvent.CARET_CHANGE, false, false, oldCaretIndex, caretIndex));
-    }
-
-    /**
-     *  @private
-     */
-    override protected function keyDownHandler(event:KeyboardEvent):void
-    {
-        if (event.eventPhase == EventPhase.BUBBLING_PHASE)
-            return;
-
-        if (!enabled || !dataGroup || event.isDefaultPrevented())
-            return;
-
-        // Block input if space bar is being held down.
-        if (!isNaN(pressedIndex))
-        {
-            event.preventDefault();
-            return;
-        }
-
-        super.keyDownHandler(event);
-
-        // If rtl layout, need to swap LEFT/UP and RIGHT/DOWN so correct action
-        // is done.
-        var keyCode:uint = mapKeycodeForLayoutDirection(event, true);
-
-        switch (keyCode)
-        {
-            case Keyboard.UP:
-            case Keyboard.LEFT:
-            {
+        }
+
+        /**
+         *  @private
+         */
+        private function dataGroup_rendererAddHandler(event:RendererExistenceEvent):void
+        {
+            const renderer:IVisualElement = event.renderer;
+            if (renderer)
+            {
+                renderer.addEventListener(MouseEvent.CLICK, item_clickHandler);
+                if (renderer is IFocusManagerComponent)
+                    IFocusManagerComponent(renderer).focusEnabled = false;
+                if (renderer is ButtonBarButton)
+                    ButtonBarButton(renderer).allowDeselection = !requireSelection;
+            }
+        }
+
+        /**
+         *  @private
+         */
+        private function dataGroup_rendererRemoveHandler(event:RendererExistenceEvent):void
+        {
+            const renderer:IVisualElement = event.renderer;
+            if (renderer)
+                renderer.removeEventListener(MouseEvent.CLICK, item_clickHandler);
+        }
+
+        /**
+         *  @private
+         *  Called synchronously when the space bar is pressed or the mouse is clicked.
+         */
+        private function item_clickHandler(event:MouseEvent):void
+        {
+            var newIndex:int;
+            if (event.currentTarget is IItemRenderer)
+                newIndex = IItemRenderer(event.currentTarget).itemIndex;
+            else
+                newIndex = dataGroup.getElementIndex(event.currentTarget as IVisualElement);
+
+            var oldSelectedIndex:int = selectedIndex;
+            if (newIndex == selectedIndex)
+            {
+                if (!requireSelection)
+                    setSelectedIndex(NO_SELECTION, true);
+            }
+            else
+                setSelectedIndex(newIndex, true);
+
+            // Changing the selectedIndex typically causes a call to itemSelected() at
+            // commitProperties() time.   We'll update the caretIndex then.  If this
+            // method was -not- called as a consequence of a keypress, we will not show
+            // the focus highlight at caretIndex.  See itemShowingCaret().
+
+            if (enableFocusHighlight && (selectedIndex != oldSelectedIndex))
+                enableFocusHighlight = inKeyUpHandler;
+        }
+
+        /**
+         *  @private
+         *  Increment or decrement the caretIndex.  Wrap if arrowKeysWrapFocus=true.
+         */
+        private function adjustCaretIndex(delta:int):void
+        {
+            if (!dataGroup || (caretIndex < 0))
+                return;
+
+            const oldCaretIndex:int = caretIndex;
+            const length:int = dataGroup.numElements;
+
+            if (arrowKeysWrapFocus)
+                setCurrentCaretIndex((caretIndex + delta + length) % length);
+            else
+                setCurrentCaretIndex(Math.min(length - 1, Math.max(0, caretIndex + delta)));
+
+            if (oldCaretIndex != caretIndex)
+                dispatchEvent(new IndexChangeEvent(IndexChangeEvent.CARET_CHANGE, false, false, oldCaretIndex, caretIndex));
+        }
+
+        /**
+         *  @private
+         */
+        override protected function keyDownHandler(event:KeyboardEvent):void
+        {
+            if (event.eventPhase == EventPhase.BUBBLING_PHASE)
+                return;
+
+            if (!enabled || !dataGroup || event.isDefaultPrevented())
+                return;
+
+            // Block input if space bar is being held down.
+            if (!isNaN(pressedIndex))
+            {
+                event.preventDefault();
+                return;
+            }
+
+            super.keyDownHandler(event);
+
+            // If rtl layout, need to swap LEFT/UP and RIGHT/DOWN so correct action
+            // is done.
+            var keyCode:uint = mapKeycodeForLayoutDirection(event, true);
+
+            switch (keyCode)
+            {
+                case Keyboard.UP:
+                case Keyboard.LEFT:
+                {
                     adjustCaretIndex(-1);
-                event.preventDefault();
-                break;
-            }
-            case Keyboard.DOWN:
-            case Keyboard.RIGHT:
-            {
+                    event.preventDefault();
+                    break;
+                }
+                case Keyboard.DOWN:
+                case Keyboard.RIGHT:
+                {
                     adjustCaretIndex(+1);
-                event.preventDefault();
-                break;
-            }
-            case Keyboard.SPACE:
-            {
-                const renderer:IItemRenderer = getItemRenderer(caretIndex) as IItemRenderer;
-                if (renderer && ((!renderer.selected && requireSelection) || !requireSelection))
+                    event.preventDefault();
+                    break;
+                }
+                case Keyboard.SPACE:
                 {
-                    renderer.dispatchEvent(event);
-                    pressedIndex = caretIndex;
-                }
-                break;
-            }
-        }
-    }
-
-    /**
-     *  @private
-     */
-    override protected function keyUpHandler(event:KeyboardEvent):void
-    {
-        if (event.eventPhase == EventPhase.BUBBLING_PHASE)
-            return;
-
-        if (!enabled)
-            return;
-
-        super.keyUpHandler(event);
-
-        switch (event.keyCode)
-        {
-            case Keyboard.SPACE:
-            {
-                inKeyUpHandler = true;
-
-                // Need to check pressedIndex for NaN for the case when key up
-                // happens on an already selected renderer and under the condition
-                // that requireSelection=true.
-                if (!isNaN(pressedIndex))
-                {
-                    // Dispatch key up to the previously pressed item in case focus was lost
-                    // through other interaction (e.g. mouse clicks, etc...)
-                    const renderer:IItemRenderer = getItemRenderer(pressedIndex) as IItemRenderer;
+                    const renderer:IItemRenderer = getItemRenderer(caretIndex) as IItemRenderer;
                     if (renderer && ((!renderer.selected && requireSelection) || !requireSelection))
                     {
                         renderer.dispatchEvent(event);
-                        pressedIndex = NaN;
+                        pressedIndex = caretIndex;
                     }
-                }
-                inKeyUpHandler = false;
-                break;
-            }
+                    break;
+                }
+            }
+        }
+
+        /**
+         *  @private
+         */
+        override protected function keyUpHandler(event:KeyboardEvent):void
+        {
+            if (event.eventPhase == EventPhase.BUBBLING_PHASE)
+                return;
+
+            if (!enabled)
+                return;
+
+            super.keyUpHandler(event);
+
+            switch (event.keyCode)
+            {
+                case Keyboard.SPACE:
+                {
+                    inKeyUpHandler = true;
+
+                    // Need to check pressedIndex for NaN for the case when key up
+                    // happens on an already selected renderer and under the condition
+                    // that requireSelection=true.
+                    if (!isNaN(pressedIndex))
+                    {
+                        // Dispatch key up to the previously pressed item in case focus was lost
+                        // through other interaction (e.g. mouse clicks, etc...)
+                        const renderer:IItemRenderer = getItemRenderer(pressedIndex) as IItemRenderer;
+                        if (renderer && ((!renderer.selected && requireSelection) || !requireSelection))
+                        {
+                            renderer.dispatchEvent(event);
+                            pressedIndex = NaN;
+                        }
+                    }
+                    inKeyUpHandler = false;
+                    break;
+                }
+            }
         }
     }
-}
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 7929
Author:   hmuller@adobe.com
Date:     2009-06-17T23:06:42.698986Z

Log Message:
-----------
Range et al PARB changes, Opus #1.   In addition to the changes listed below, updated
flex4tests, notably ScrollBarFrenzy, for the new API.   These changes will break
performance test suite (TwoThumbSlider.as).

Range
  valueInterval => snapInterval
  step() => changeValueByStep()
  remove protected nearestValidSize() method

Slider
  Add protected pendingValue property
  Remove protected pointClickToPosition() method

TrackBase
  Add two new protected methods: updateSkinDisplayList(), pointToValue()
  Remove the following protected properties: get trackSize:Number, thumbSize:Number
  Remove the following protected methods:
      clickOffset()
      positionToValue()
      valueToPosition()
      pointToPosition()
      positionThumb()
      sizeThumb()
      calculateThumbSize()
      calculateNewValue()

ScrollBar
  page() => changeValueByPage()

Spinner
  valueWrap => allowValueWrap

NumericStepper
  displayFormatFunction => valueFormatFunction
  extractValueFunction => valueParseFunction
  commitTextInput => make private

QE Notes: Most Mustella tests passed after the protected API changes but prior to the renames.
Doc Notes:
Bugs:
Reviewer: Jason, Chet

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/Range.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/TrackBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/HSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/HScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/mediaClasses/ScrubBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/VideoPlayerSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/VideoPlayerSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/SkinTest.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/testWheel.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/NumericStepper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Spinner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/ScrollbarFrenzy.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/flex4test.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/components/CircularScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/skins/CircularScrollBarSkin.mxml</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/ScrollBarBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/ScrollBarBase.as
@@ -58,13 +58,13 @@

 /**
  *  If true (the default), the thumb's visibility will be reset
- *  whenever it's size is updated.
+ *  whenever its size is updated.
  *
  *  Overrides of sizeThumb() in HScrollBar and
  *  VScrollBar make the thumb visible if it's smaller than
  *  the track, unless this style is false.
  *
- *  Set this style to control thumb visiblity directly.
+ *  Set this style to false to control thumb visiblity directly.
  *
  *  @default true
  *
@@ -255,7 +255,7 @@
     /**
      * @private
      * This variable tracks whether we are currently running an animation to
-     * do a single page() operation. This is used to end that operation properly
+     * do a single changeValueByPage() operation. This is used to end that operation properly
      * if another operation interrupts it.
      */
     private var animatingSinglePage:Boolean;
@@ -297,11 +297,11 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-     override public function set valueInterval(value:Number):void
-    {
-        super.valueInterval = value;
+     override public function set snapInterval(value:Number):void
+    {
+        super.snapInterval = value;

-        // setting valueInterval may change the pageSize
+        // setting snapInterval may change the pageSize
         pageSizeChanged = true;
     }

@@ -321,7 +321,7 @@

     /**
      *  The change in the value of the value property
-     *  when you call the page() method.
+     *  when you call the changeValueByPage() method.
      *
      *  @default 20
      *
@@ -372,7 +372,7 @@
      *
      *
The VScrollBar and HScrollBar classes override these methods to
      *  keep their pageSize, maximum, and value properties in sync with the
-     *  viewport.   Similarly, they override their page() and step() methods to
+     *  viewport.   Similarly, they override their changeValueByPage() and changeValueByStep() methods to
      *  use the viewport's scrollPositionDelta methods to compute page and
      *  and step offsets.

      *
@@ -439,6 +439,33 @@

     /**
      *  @private
+     *  Returns the integer multiple of snapInterval that's closest to size.
+     *
+     *
If snapInterval is 0, which means that values are only constrained
+     *  by the minimum and maximum properties, then size is returned unchanged.

+     *
+     *
This method is used by commitProperties() to validate the
+     *  pageSize.  There's a copy of this method in Range.as

+     *
+     *  @param size The input size.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    private function nearestValidSize(size:Number):Number
+    {
+        var interval:Number = snapInterval;
+        if (interval == 0)
+            return size;
+
+        var validSize:Number = Math.round(size / interval) * interval
+        return (Math.abs(validSize) < interval) ? interval : validSize;
+    }
+
+    /**
+     *  @private
      */
     override protected function commitProperties():void
     {
@@ -446,9 +473,7 @@

         if (pageSizeChanged)
         {
-            if (valueInterval != 0)
-                _pageSize = nearestValidInterval(_pageSize, valueInterval);
-
+            _pageSize = nearestValidSize(_pageSize);
             pageSizeChanged = false;
         }
     }
@@ -550,7 +575,7 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function page(increase:Boolean = true):void
+    public function changeValueByPage(increase:Boolean = true):void
     {
         var val:Number;
         if (increase)
@@ -566,31 +591,6 @@
             setValue(val);
             dispatchEvent(new Event("change"));
         }
-    }
-
-    /**
-     *  Calculates the size for the thumb from the current range, pageSize, and
-     *  trackSize settings.
-     *
-     *  If fixedThumbSize is true, then subclasses should return a value based
-     *  on the thumb's preferred size instead.
-     *
-     *  @see #fixedThumbSize
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    override protected function calculateThumbSize():Number
-    {
-        var range:Number = maximum - minimum;
-
-        // Thumb takes up entire track.
-        if (range == 0)
-            return trackSize;
-
-        return Math.min((pageSize / (range + pageSize) ) * trackSize, trackSize);
     }

     //--------------------------------------------------------------------------
@@ -716,13 +716,7 @@
             // TODO (chaase): first step is non-animated, just to simplify the delayed
             // start of the animated stepping. Seems okay, but worth thinking
             // about whether we should animate the first step too
-            step(increment);
-
-            if (value != oldValue)
-            {
-                positionThumb(valueToPosition(value));
-                dispatchEvent(new Event("change"));
-            }
+            changeValueByStep(increment);

             if (getStyle("smoothScrolling"))
             {
@@ -802,26 +796,28 @@
         if (animatingSinglePage)
             animator.end();

-        var pt:Point = new Point(event.stageX, event.stageY);
         // Cache original event location for use on later repeating events
-        trackPosition = track.globalToLocal(pt);
-        var newScrollPosition:Number = pointToPosition(trackPosition.x, trackPosition.y);
-        var newScrollValue:Number = positionToValue(newScrollPosition);
+        trackPosition = track.globalToLocal(new Point(event.stageX, event.stageY));

+        // If the user shift-clicks on the track, then offset the event coordinates so
+        // that the thumb ends up centered under the mouse.
+        if (event.shiftKey)
+        {
+            var thumbW:Number = (thumb) ? thumb.getLayoutBoundsWidth() : 0;
+            var thumbH:Number = (thumb) ? thumb.getLayoutBoundsHeight() : 0;
+            trackPosition.x -= (thumbW / 2);
+            trackPosition.y -= (thumbH / 2);
+        }
+
+        var newScrollValue:Number = pointToValue(trackPosition.x, trackPosition.y);
         trackScrollDown = (newScrollValue > value);
-
-        var oldValue:Number = value;

         if (event.shiftKey)
         {
             // shift-click positions jumps to the clicked location instead
             // of incrementally paging
             var slideDuration:Number = getStyle("slideDuration");
-            // Adjust the position - we want the clicked position to be at the
-            // half-way point of the thumb when it's done moving
-            newScrollPosition -= thumbSize/2;
-            newScrollValue = positionToValue(newScrollPosition);
-            var adjustedValue:Number = nearestValidValue(newScrollValue, valueInterval);
+            var adjustedValue:Number = nearestValidValue(newScrollValue, snapInterval);
             if (getStyle("smoothScrolling") &&
                 slideDuration != 0 &&
                 (maximum - minimum) != 0)
@@ -839,7 +835,7 @@
             return;
         }

-        page(trackScrollDown);
+        changeValueByPage(trackScrollDown);

         trackScrolling = true;

@@ -967,7 +963,7 @@
             // If we're animating stepping, end on a final real step call in the
             // appropriate direction, ensuring that we stop on a content
             // item boundary
-            step(steppingDown);
+            changeValueByStep(steppingDown);
             steppingUp = steppingDown = false;
             animator.startDelay = 0;
         }
@@ -986,10 +982,8 @@
         // Only repeat the scrolling if the current scroll position
         // (represented by fraction) is not past the current
         // mouse position on the track
-        var newScrollPosition:Number = pointToPosition(
-            trackPosition.x, trackPosition.y);
-        var newScrollValue:Number = positionToValue(newScrollPosition);
-
+        var newScrollValue:Number = pointToValue(trackPosition.x, trackPosition.y);
+
         if (trackScrollDown)
         {
             var range:Number = maximum - minimum;
@@ -1015,13 +1009,7 @@

         var oldValue:Number = value;

-        page(trackScrollDown);
-
-        if (value != oldValue)
-        {
-            positionThumb(valueToPosition(value));
-            dispatchEvent(new Event("change"));
-        }
+        changeValueByPage(trackScrollDown);

         if (trackScrollTimer && trackScrollTimer.repeatCount == 1)
         {


Transferred from the Adobe Open Source Subversion Repository

Revision: 7472
Author:   chaase@adobe.com
Date:     2009-06-01T17:57:10.489577Z

Log Message:
-----------
Changing a handful of behavior-related properties to styles instead, for usability and consistency:
Scroller.horizontalScrollPolicy
Scroller.verticalScrollPolicy
TextArea.horizontalScrollPolicy
TextArea.verticalScrollPolicy
Slider.liveDragging

Also made previous properties-as-styles changes (smoothScrolling and fixedThumbSize) not inheritable and not exposed in SkinnableContainer/GroupBase.

QE Notes: Requires Mustella updates to handle changes from properties to styles
Doc Notes:
Bugs: sdk-21032
Reviewer: Glenn
Tests: checkintests, Mustella gumbo/components/Scroller, gumbo/components/ScrollBar, gumbo/components/TextArea/, and gumbo/components/Slider

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/TextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ScrollerLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/GroupBase.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/ScrollBarBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/ScrollBarBase.as
@@ -52,7 +52,7 @@
  *  @playerversion AIR 1.5
  *  @productversion Flex 4
  */
-[Style(name="fixedThumbSize", type="Boolean", inherit="yes")]
+[Style(name="fixedThumbSize", type="Boolean", inherit="no")]

 /**
  *  Number of milliseconds after the first page event
@@ -94,7 +94,7 @@
  *  @playerversion AIR 1.5
  *  @productversion Flex 4
  */
-[Style(name="smoothScrolling", type="Boolean", inherit="yes")]
+[Style(name="smoothScrolling", type="Boolean", inherit="no")]

 /**
  *  The ScrollBar class helps to position


Fixed a unit test that was set up wrong, was passing before bug fix but then failed after the fix.

--- tests/org/osflash/signals/DeluxeSignalWithGenericEventTest.as
+++ tests/org/osflash/signals/DeluxeSignalWithGenericEventTest.as
@@ -11,10 +11,9 @@

 	public class DeluxeSignalWithGenericEventTest
 	{
-		public var completed:DeluxeSignal;
+		protected var completed:DeluxeSignal;
+		protected var delegate:Function;

-		public function DeluxeSignalWithGenericEventTest() {}
-
 		[Before]
 		public function setUp():void
 		{
@@ -26,6 +25,7 @@
 		{
 			completed.removeAll();
 			completed = null;
+			delegate = null;
 		}

 		[Test]
@@ -78,7 +78,8 @@
 		[Test(async)]
 		public function add_one_listener_and_dispatch_then_listener_remove_itself_using_event_signal():void
 		{
-			completed.add(addAsync(remove_myself_from_signal, 10));
+			delegate = addAsync(remove_myself_from_signal, 10);
+			completed.add(delegate);
 			completed.dispatch(new GenericEvent());
 		}

@@ -86,7 +87,8 @@
 		{
 			assertEquals('listener still in signal', 1, e.signal.numListeners);

-			e.signal.remove(arguments.callee);
+			// Can't remove(arguments.callee) because it's wrapped with delegate created by addAsync().
+			e.signal.remove(delegate);

 			assertEquals('listener removed from signal', 0, e.signal.numListeners);
 		}