 package spark.components.supportClasses
 {
     
+import mx.core.IInvalidating;
 import mx.core.IVisualElement;
+import mx.core.IVisualElementContainer;
 import mx.core.mx_internal;
 
 import spark.components.Grid;

    /**
     *  Add the specified element to this GridLayer.  The relative order of elements
     *  is not guaranteed.
     */
    public function addGridElement(elt:IVisualElement):void
    {
        if (elt.parent != root)
            root.addElement(elt);
    }
    
    /**
     *  Remove the specified element from this GridLayer.  
     */
    public function removeGridElement(elt:IVisualElement):void
    {
        if (elt.parent == root)
            root.removeElement(elt);
    }      
}
}



use namespace mx_internal;

/**
 *  The element type for the Grid layers property.
 * 
 *  <p>A GridLayer is a non-visual object that has a simple no-layout container for Grid visual elements.  
 *  Visual elements are added to the layer's (internal) container with addElement() and removed with 
 *  removeElement().   GridLayer containers must not impose a layout on their elements, the Grid's 
 *  layout is responsible for sizing and positioning all GridLayer elements.</p>
 * 
 *  @langversion 3.0
 *  @playerversion Flash 10
 *  @playerversion AIR 2.4
 *  @productversion Flex 4.5
 */
public class GridLayer
{
    public function GridLayer()
    {
        super();
    }
    
    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //-------------------------------------------------------------------------- 
    
    //----------------------------------
    //  id
    //----------------------------------

    private var _id:String;
    
    /**
     *  A unique identifier for this layer.   The Grid's layout looks up layers by id.
     * 
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 2.4
     *  @productversion Flex 4.5  
     */
    public function get id():String
    {
        return _id;
    }
    
    /**
     *  @private
     */
    public function set id(value:String):void
    {
        _id = value;
    }
    
    
    //----------------------------------
    //  root
    //----------------------------------
    
    private var _root:IVisualElement;
    
    /**
     *  The root of the hierarchy that addElement() adds visual elements to and
     *  removeElement() removes them from.   To add a GridLayer to another Group,
     *  add its root: myGroup.addElement(myGridLayer.root).
     * 
     *  @default A Group configured with a no-op layout.
     * 
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 2.4
     *  @productversion Flex 4.5
     */
    public function get root():IVisualElement
    {
        if (!_root)
            _root = new LayerGroup();
        
        return _root;
    }
    
    /**
     *  @private
     */
    public function set root(value:IVisualElement):void
    {
        _root = value;
    }
    
    //--------------------------------------------------------------------------
