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

////////////////////////////////////////////////////////////////////////////////
//
//    Copyright 2014 Ardisia Labs LLC. All Rights Reserved.
//
//    This file is licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////

-->
<s:Module 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:containers="containers.*"
          xmlns:data="containers.data.*"
          xmlns:separators="ardisia.components.separators.*"
          xmlns:colorPicker="ardisia.components.colorPicker.*" 
          xmlns:clocks="ardisia.components.clocks.*"
          frameRate="60"
          width="100%" height="100%"
          removedFromStage="removedFromStageHandler(event)">
    
    <!-- scripts -->
    <fx:Script>
        <![CDATA[
            
            import spark.effects.easing.Bounce;
            import spark.effects.easing.Elastic;
            import spark.effects.easing.Linear;
            import spark.effects.easing.Power;
            import spark.effects.easing.Sine;
            
            //--------------------------------------
            //  methods
            //--------------------------------------
            
            public function creationComplete():void
            {
                
            }
            
            //--------------------------------------
            //  event handlers
            //--------------------------------------
            
            protected function removedFromStageHandler(event:Event):void
            {
                
            }
            
        ]]>
    </fx:Script>
    
    <!-- declarations -->
    <fx:Declarations>
        
    </fx:Declarations>
    
    <!-- states -->
    <s:states>
        <s:State name="stockholm" />
        <s:State name="london" />
        <s:State name="spark" />
    </s:states>
    
    <!-- application -->
    <containers:DemoApplicationWrapper id="demoAppWrapper" 
                                       width="100%" height="100%"
                                       westRegionTitle="Clocks Description"
                                       description="Lightweight, efficient, and highly customizable clock components. Designed for performance and minimizing layout calls and vector drawing.&#13;&#13;The clocks are not skinnable due to the complexity of separating layout and logic between the skin and the host, as well as to reduce the processor footprint since clocks generally run for long periods of time.  Use the styles or override to customize.&#13;&#13;The Ardisia Component Set includes both an analog and a digital clock."
                                       currentState.stockholm="stockholm" currentState.london="london" currentState.spark="spark">
        
        <containers:centerContent>
            
            <!--- example #1 -->
            <data:PrimaryContentData>
                <data:tabLabel>Analog Clock</data:tabLabel>
                <data:exampleDescription>The Analog clock supports many customization options. Designed to be efficient and minimize layout calls and processor usage.</data:exampleDescription>
                <data:toolbarContent>
                    <s:HGroup>
                        <s:Form>
                            <s:FormHeading label="Properties:"/>
                            <s:FormItem label="Start / Stop:">
                                <s:HGroup>
                                    <s:Button label="Start"
                                              click="analogClock.start();"/>
                                    <s:Button label="Stop"
                                              click="analogClock.stop();"/>
                                </s:HGroup>
                            </s:FormItem>
                            <s:FormItem label="Circular:">
                                <s:CheckBox id="circleSelect"
                                            selected="false"/>
                            </s:FormItem>
                            <s:FormItem label="Width:"
                                        enabled="{!circleSelect.selected}">
                                <s:HSlider id="widthSelect"
                                           width="100"
                                           minimum="50" maximum="300" value="280"/>
                            </s:FormItem>
                            <s:FormItem label="Height:"
                                        enabled="{!circleSelect.selected}">
                                <s:HSlider id="heightSelect"
                                           width="100"
                                           minimum="50" maximum="300" value="200"/>
                            </s:FormItem>
                            <s:FormItem label="24 Hour Mode:">
                                <s:CheckBox id="use24Mode" 
                                            selected="false"/>
                            </s:FormItem>
                            <s:FormItem label="Tick Inset:">
                                <s:HSlider id="tickInsetSelect"
                                           width="100"
                                           value="0" minimum="0" maximum="20" snapInterval="1"/>
                            </s:FormItem>
                        </s:Form>
                        <s:Form>
                            <s:FormItem label="Time Zone:">
                                <s:VGroup>
                                    <s:RadioButton groupName="timeZone" 
                                                   id="utcSelect" 
                                                   label="UTC" 
                                                   selected="false"/>
                                    <s:RadioButton groupName="timeZone" 
                                                   id="localSelect" 
                                                   label="Local" 
                                                   selected="true"/>
                                </s:VGroup>
                            </s:FormItem>
                            <s:FormItem enabled="{utcSelect.selected}" 
                                        label="UTC Offsets:"/>
                            <s:FormItem enabled="{utcSelect.selected}" 
                                        label="Hours:">
                                <s:HSlider id="utcHourOffset"
                                           width="100"
                                           minimum="0" maximum="24" value="0"/>
                            </s:FormItem>
                            <s:FormItem enabled="{utcSelect.selected}" 
                                        label="Minutes:">
                                <s:HSlider id="utcMinutesOffset"
                                           width="100"
                                           minimum="0" maximum="60" value="0"/>
                            </s:FormItem>
                            <s:FormHeading label="Animation"/>
                            <s:FormItem label="Enable:">
                                <s:CheckBox id="animateSelect" 
                                            selected="true"/>
                            </s:FormItem>
                            <s:FormItem label="Duration:"
                                        enabled="{animateSelect.selected}">
                                <s:HSlider id="durationSelect"
                                           width="100"
                                           value="1000" minimum="0" maximum="1000" snapInterval="100"/>
                            </s:FormItem>
                            <s:FormItem label="Easer:"
                                        enabled="{animateSelect.selected}">
                                <s:DropDownList id="animationEaserSelect"
                                                width="100"
                                                labelField="name"
                                                selectedIndex="4">
                                    <s:ArrayCollection>
                                        <fx:Object name="Sine" easer="{new Sine()}"/>
                                        <fx:Object name="Linear" easer="{new Linear()}"/>
                                        <fx:Object name="Power" easer="{new Power(0.1, 4)}"/>
                                        <fx:Object name="Bounce" easer="{new Bounce()}"/> 
                                        <fx:Object name="Elastic" easer="{new Elastic()}"/>
                                    </s:ArrayCollection>
                                </s:DropDownList>
                            </s:FormItem>
                        </s:Form>
                        <s:Form>
                            <s:FormHeading label="Major Ticks:"/>
                            <s:FormItem label="Height:">
                                <s:HSlider id="majorHeightSelect"
                                           width="100"
                                           value="12" minimum="0" maximum="20" snapInterval="1"/>
                            </s:FormItem>
                            <s:FormItem label="Width:">
                                <s:HSlider id="majorWidthSelect"
                                           width="100"
                                           value="3" minimum="0" maximum="20" snapInterval="1"/>
                            </s:FormItem>
                            
                            <s:FormHeading label="Minor Ticks:"/>
                            <s:FormItem label="Tick Count:">
                                <s:HSlider id="minorTickCountSelect"
                                           width="100"
                                           value="4" minimum="0" maximum="20" snapInterval="1"/>
                            </s:FormItem>
                            <s:FormItem label="Height:">
                                <s:HSlider id="minorHeightSelect"
                                           width="100"
                                           value="5" minimum="0" maximum="20" snapInterval="1"/>
                            </s:FormItem>
                            <s:FormItem label="Width:">
                                <s:HSlider id="minorWidthSelect"
                                           width="100"
                                           value="1" minimum="0" maximum="20" snapInterval="1"/>
                            </s:FormItem>
                        </s:Form>
                        <s:Form>
                            <s:FormHeading label="Colors:"/>
                            <s:FormItem label="Tick Color:"
                                        enabled="{displayLabelsSelect.selected}">
                                <colorPicker:ColorPicker id="tickColor"
                                                         selectedColor="#333333" />
                            </s:FormItem>
                            <s:FormItem label="Hour Color:">
                                <colorPicker:ColorPicker id="hourColor"
                                                         selectedColor="#000000" />
                            </s:FormItem>
                            <s:FormItem label="Minutes Color:">
                                <colorPicker:ColorPicker id="minutesColor"
                                                         selectedColor="#454545" />
                            </s:FormItem>
                            <s:FormItem label="Seconds Color:">
                                <colorPicker:ColorPicker id="secondsColor"
                                                         selectedColor="#454545" />
                            </s:FormItem>
                            <s:FormItem label="Center Color:">
                                <colorPicker:ColorPicker id="pinColor"
                                                         selectedColor="#AA0000" />
                            </s:FormItem>
                        </s:Form>
                        <s:Form>
                            <s:FormHeading label="Labels:"/>
                            <s:FormItem label="Display Labels:">
                                <s:CheckBox id="displayLabelsSelect" 
                                            selected="true"/>
                            </s:FormItem>
                            <s:FormItem label="Inset:"
                                        enabled="{displayLabelsSelect.selected}">
                                <s:HSlider id="labelInsetSelect"
                                           width="100"
                                           value="18" minimum="0" maximum="20" snapInterval="1"/>
                            </s:FormItem>
                            <s:FormItem label="Orientation:"
                                        enabled="{displayLabelsSelect.selected}">
                                <s:DropDownList id="labelOrientationSelect" 
                                                width="100"
                                                selectedIndex="3">
                                    <s:dataProvider>
                                        <s:ArrayCollection>
                                            <fx:String>tangential</fx:String>
                                            <fx:String>parallel</fx:String>
                                            <fx:String>parallelFlipped</fx:String>
                                            <fx:String>none</fx:String>
                                        </s:ArrayCollection>
                                    </s:dataProvider>
                                </s:DropDownList>
                            </s:FormItem>
                            <s:FormItem label="Label Color:"
                                        enabled="{displayLabelsSelect.selected}">
                                <colorPicker:ColorPicker id="labelColor"
                                                         selectedColor="#333333"
                                                         change="analogClock.setStyle('color', labelColor.selectedColor);"/>
                            </s:FormItem>
                        </s:Form>
                    </s:HGroup>
                </data:toolbarContent>
                <data:primaryContent>
                    <clocks:ClockAnalog id="analogClock" 
                                        verticalCenter="0" horizontalCenter="0"
                                        width="{widthSelect.value}"
                                        height="{heightSelect.value}"
                                        animationDuration="{durationSelect.value}"
                                        easer="{animationEaserSelect.selectedItem.easer}"
                                        tickColor="{tickColor.selectedColor}"
                                        hoursNeedleColor="{hourColor.selectedColor}"
                                        minutesNeedleColor="{minutesColor.selectedColor}"
                                        secondsNeedleColor="{secondsColor.selectedColor}"
                                        centerPinColor="{pinColor.selectedColor}"
                                        majorTickHeight="{majorHeightSelect.value}"
                                        majorTickWidth="{majorWidthSelect.value}"
                                        minorTickCount="{minorTickCountSelect.value}"
                                        minorTickHeight="{minorHeightSelect.value}"
                                        minorTickWidth="{minorWidthSelect.value}"
                                        labelRotation="{labelOrientationSelect.selectedItem}"
                                        tickInset="{tickInsetSelect.value}"
                                        labelInset="{labelInsetSelect.value}"
                                        useCircle="{circleSelect.selected}"
                                        useUTC="{utcSelect.selected}"
                                        utcOffsetHours="{utcHourOffset.value}"
                                        utcOffsetMinutes="{utcMinutesOffset.value}"
                                        use24HourMode="{use24Mode.selected}"
                                        displayLabels="{displayLabelsSelect.selected}"
                                        animated="{animateSelect.selected}"
                                        creationComplete="analogClock.start();"/>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <data:PrimaryContentData>
                <data:tabLabel>Digital Clock</data:tabLabel>
                <data:exampleDescription>The Digital Clock component supports a variety of styling options.&#13;&#13;Embed an LCD font to mimic the look of a digital clock.</data:exampleDescription>
                <data:toolbarContent>
                    <s:HGroup>
                        <s:Form>
                            <s:FormHeading label="Properties:"/>
                            <s:FormItem label="Width:">
                                <s:HSlider id="digitalWidthSelect"
                                           width="100"
                                           minimum="50" maximum="400" value="300"/>
                            </s:FormItem>
                            <s:FormItem label="Height:">
                                <s:HSlider id="digitalHeightSelect"
                                           width="100"
                                           minimum="50" maximum="300" value="70"/>
                            </s:FormItem>
                            
                            <s:FormItem label="Padding Top:">
                                <s:HSlider id="paddingTopSelect"
                                           width="100"
                                           value="9" minimum="0" maximum="50" snapInterval="1"/>
                            </s:FormItem>
                            <s:FormItem label="Padding Right:">
                                <s:HSlider id="paddingRightSelect"
                                           width="100"
                                           value="15" minimum="0" maximum="50" snapInterval="1"/>
                            </s:FormItem>
                            <s:FormItem label="Padding Bottom:">
                                <s:HSlider id="paddingBottomSelect"
                                           width="100"
                                           value="3" minimum="0" maximum="50" snapInterval="1"/>
                            </s:FormItem>
                            <s:FormItem label="Padding Left:">
                                <s:HSlider id="paddingLeftSelect"
                                           width="100"
                                           value="15" minimum="0" maximum="50" snapInterval="1"/>
                            </s:FormItem>
                        </s:Form>
                        <s:Form>
                            <s:FormItem label="Show Meridian:">
                                <s:CheckBox id="meridianSelect"
                                            selected="true"/>
                            </s:FormItem>
                            <s:FormItem label="Display Seconds:">
                                <s:CheckBox id="displaySecondsSelect"
                                            selected="true"/>
                            </s:FormItem>
                            <s:FormItem label="24 Hour Mode:">
                                <s:CheckBox id="digital24HourMode"
                                            selected="false"/>
                            </s:FormItem>
                            <s:FormItem label="Label Color:">
                                <colorPicker:ColorPicker id="digitalLabelColorSelect"
                                                         selectedColor="#F8010A"
                                                         change="digitalClock.setStyle('color', digitalLabelColorSelect.selectedColor);"/>
                            </s:FormItem>
                        </s:Form>
                        <s:Form>
                            <s:FormHeading label="Border:"/>
                            <s:FormItem label="Border Visible:">
                                <s:CheckBox id="digitalBorderSelect"
                                            selected="false"/>
                            </s:FormItem>
                            <s:FormItem enabled="{digitalBorderSelect.selected}" 
                                        label="Border Color:">
                                <colorPicker:ColorPicker id="digitalBorderColorSelect"
                                                         selectedColor="#AA0000"/>
                            </s:FormItem>
                            <s:FormItem enabled="{digitalBorderSelect.selected}" 
                                        label="Border Alpha:">
                                <s:HSlider id="digitalBorderAlphaSelect"
                                           width="100" 
                                           minimum="0" maximum="1" snapInterval="0" value="1"/>
                            </s:FormItem>
                            <s:FormItem enabled="{digitalBorderSelect.selected}" 
                                        label="Border Thickness:">
                                <s:HSlider id="digitalBorderThicknessSelect"
                                           width="100" 
                                           minimum="0" maximum="10" snapInterval="1" value="2"/>
                            </s:FormItem>
                            
                            <s:FormHeading label="Background:"/>
                            <s:FormItem label="Color:">
                                <colorPicker:ColorPicker id="digitalBackgroundColorSelect"
                                                         selectedColor="#000000"/>
                            </s:FormItem>
                            <s:FormItem label="Alpha:">
                                <s:HSlider id="digitalBackgroundAlphaSelect"
                                           width="100" 
                                           minimum="0" maximum="1" snapInterval="0" value="1"/>
                            </s:FormItem>
                        </s:Form>
                    </s:HGroup>
                </data:toolbarContent>
                <data:primaryContent>
                    <clocks:ClockDigital id="digitalClock"
                                         verticalCenter="0" horizontalCenter="0"
                                         width="{digitalWidthSelect.value}"
                                         height="{digitalHeightSelect.value}"
                                         paddingTop="{paddingTopSelect.value}"
                                         paddingRight="{paddingRightSelect.value}"
                                         paddingBottom="{paddingBottomSelect.value}"
                                         paddingLeft="{paddingLeftSelect.value}"
                                         displayMeridian="{meridianSelect.selected}"
                                         displaySeconds="{displaySecondsSelect.selected}"
                                         use24HourMode="{digital24HourMode.selected}"
                                         borderVisible="{digitalBorderSelect.selected}"
                                         borderColor="{digitalBorderColorSelect.selectedColor}"
                                         borderThickness="{digitalBorderThicknessSelect.value}"
                                         borderAlpha="{digitalBorderAlphaSelect.value}"
                                         backgroundColor="{digitalBackgroundColorSelect.selectedColor}"
                                         backgroundAlpha="{digitalBackgroundAlphaSelect.value}"
                                         creationComplete="digitalClock.start();"/>
                </data:primaryContent>
            </data:PrimaryContentData>
            
        </containers:centerContent>
        
    </containers:DemoApplicationWrapper>
    
</s:Module>