     
     /**
      *  @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);
+            value.addEventListener(IndexChangedEvent.CHANGE, dataProvider_changeHandler);
+        }
+        
+        super.dataProvider = value;
+        
+        if (value is ISelectableList)
+            selectedIndex = ISelectableList(dataProvider).selectedIndex;
+    }    
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden Methods
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  @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
     {

        setCurrentCaretIndex(0);        
    }
    
    /**
     *  @private
     */    
    private var inCollectionChangeHandler:Boolean = false;
    
    //--------------------------------------------------------------------------
    //
    //  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);
            value.addEventListener(IndexChangedEvent.CHANGE, dataProvider_changeHandler);
        }
        
        super.dataProvider = value;
        
        if (value is ISelectableList)
            selectedIndex = ISelectableList(dataProvider).selectedIndex;
    }    
    
    //--------------------------------------------------------------------------
    //
    //  Overridden Methods
    //
    //--------------------------------------------------------------------------
    
    /**
     *  @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
     *  If false, don't show the focusRing for the tab at caretIndex, see
     *  itemShowingCaret() below.

            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;
            }            
