<?xml version="1.0" encoding="utf-8"?>

<!--

ADOBE SYSTEMS INCORPORATED
Copyright 2008 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: Adobe permits you to use, modify, and distribute this file
in accordance with the terms of the license agreement accompanying it.

-->

<!--- 
The default skin class for a Spark DataGrid component in the Wireframe theme.  

@see spark.components.DataGrid
@langversion 3.0
@playerversion Flash 10
@playerversion AIR 2.5
@productversion Flex 4.5
-->

<s:Skin 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
    alpha.disabled="0.5" minWidth="89" minHeight="84">
    
    <fx:Metadata>
    <![CDATA[
        /** 
        * @copy spark.skins.spark.ApplicationSkin#hostComponent
         */
        [HostComponent("spark.components.DataGrid")]
    ]]>
    </fx:Metadata>
    
    <s:states>
        <s:State name="normal" />
        <s:State name="disabled" />
    </s:states>
    
    <fx:Declarations>
        <!--- @private -->        
        <fx:Component id="alternatingRowColorsBackground">
            <s:Rect implements="spark.components.gridClasses.IGridVisualElement">
                <fx:Script>
                    <![CDATA[
                        import spark.components.DataGrid;
                        import spark.components.Grid;
                        
                        /**
                         * @private
                         */
                        public function prepareGridVisualElement(grid:Grid, rowIndex:int, columnIndex:int):void
                        {
                            const dataGrid:DataGrid = grid.dataGrid;
                            if (!dataGrid)
                                return;
                            
                            const colors:Array = dataGrid.getStyle("alternatingRowColors");
                            if (colors && (colors.length > 0))
                            {
                                dataGrid.styleManager.getColorNames(colors); // lazily replace color names with ints
                                rowBackgroundFillColor.color = colors[rowIndex % colors.length];
                            }
                            else
                            {          
                                // This should be the same as bgFill.color.
                                rowBackgroundFillColor.color = 0xFFFFFF;
                            }
                        }
                    ]]>
                </fx:Script>  
                <s:fill>
                    <!--- @private -->   
                    <s:SolidColor id="rowBackgroundFillColor" color="0xFFFFFF"/>
                </s:fill>
            </s:Rect>
        </fx:Component>
        
        <!--- @private -->        
        <fx:Component id="caretIndicator">
            <s:Rect>
                <s:stroke>
                    <s:SolidColorStroke color="0x707070" weight="1"/>
                </s:stroke>
            </s:Rect>
        </fx:Component>
        
        <!--- @private -->        
        <fx:Component id="columnSeparator">
            <s:Line>
                <s:stroke>
                    <s:SolidColorStroke color="0xE6E6E6" weight="1" caps="square"/>
                </s:stroke>
            </s:Line>
        </fx:Component>
        
        <!--- Defines the value of the columnSeparator property for the columnHeaderGroup. -->
        <fx:Component id="headerColumnSeparator">
            <s:Line>
                <s:stroke>
                    <s:SolidColorStroke color="0x666666" weight="1" caps="square"/>
                </s:stroke>
            </s:Line>
        </fx:Component>
        
        <!--- @private -->
        <fx:Component id="hoverIndicator">
            <s:Rect>
                <s:fill>
                    <s:SolidColor color="0xEEEEEE"/>
                </s:fill>                
            </s:Rect>
        </fx:Component>      

        <!--- @private -->
        <fx:Component id="rowSeparator">
            <s:Line>
                <s:stroke>
                    <s:SolidColorStroke color="0xE6E6E6" weight="1" caps="square"/>
                </s:stroke>
            </s:Line>
        </fx:Component>
        
        <!--- @private -->
        <fx:Component id="selectionIndicator">
            <s:Rect>
                <s:fill>
                    <s:SolidColor color="0xCCCCCC"/>
                </s:fill>
            </s:Rect>
        </fx:Component>
        
        <!--- @private -->
        <fx:Component id="editorIndicator">
            <s:Rect>
                <s:fill>
                    <s:SolidColor color="0xFFFFFF"/>
                </s:fill>                
            </s:Rect>
        </fx:Component>   
    </fx:Declarations>
    
    <!-- fill -->
    <!--- Defines the background appearance of the list-based component. -->
    <s:Rect left="1" right="1" top="1" bottom="1" >
        <s:fill>
            <!--- Defines the color of the background. The default color is 0xFFFFFF. -->
            <s:SolidColor color="0xFFFFFF" />
        </s:fill>
    </s:Rect>
    
    <s:VGroup horizontalAlign="justify" gap="0" left="0" right="0" top="0" bottom="0">
        <!--- @private -->
        <s:GridColumnHeaderGroup id="columnHeaderGroup"
            paddingLeft="1" paddingTop="1" paddingRight="1" minHeight="21"
            columnSeparator="{headerColumnSeparator}"
            headerRenderer="spark.skins.wireframe.DefaultGridHeaderRenderer" />
        
        <s:VGroup horizontalAlign="justify" height="100%" gap="-1">
            <!--- @private -->
            <s:Line id="headerSeparator">
                <s:stroke>
                    <s:SolidColorStroke color="0x666666" weight="1" caps="square"/>
                </s:stroke>
            </s:Line>   
            
            <!--- @private -->
            <s:Scroller id="scroller" minViewportInset="1" hasFocusableChildren="false" height="100%">
                <!--- @private -->
                <s:Grid id="grid" itemRenderer="spark.skins.spark.DefaultGridItemRenderer">
                    <s:GridLayer name="backgroundLayer"/>
                    <s:GridLayer name="selectionLayer"/>
                    <s:GridLayer name="editorIndicatorLayer"/>
                    <s:GridLayer name="rendererLayer"/>
                    <s:GridLayer name="overlayLayer"/>
                </s:Grid>
            </s:Scroller>
        </s:VGroup>
    </s:VGroup>
    
    <!-- border -->
    <!--- @private -->
    <s:Rect left="0" right="0" top="0" bottom="0">
        <s:stroke>
            <!--- @private -->
            <s:SolidColorStroke weight="1" color="0x666666" />
        </s:stroke>
    </s:Rect>

</s:Skin>
