<?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:barCode="ardisia.components.barCode.*" 
          xmlns:barCode1="components.barCode.*"
          xmlns:containers="containers.*"
          xmlns:data="containers.data.*"
          xmlns:separators="ardisia.components.separators.*"
          xmlns:colorPicker="ardisia.components.colorPicker.*"
          frameRate="60"
          width="100%" height="100%"
          removedFromStage="removedFromStageHandler(event)">
    
    <!-- scripts -->
    <fx:Script>
        <![CDATA[
            
            import spark.events.IndexChangeEvent;
            
            //--------------------------------------
            //  methods
            //--------------------------------------
            
            public function creationComplete():void
            {
                demoAppWrapper.viewstack.addEventListener(IndexChangeEvent.CHANGE, function(event:IndexChangeEvent):void 
                {
                    colorFormItem.enabled = demoAppWrapper.tabBar.selectedItem.label != 'PDF417' ? true : false;
                });
            }
            
            //--------------------------------------
            //  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="BarCode Description"
                                       description="The Ardisia BarCode package has components that generate and display several different types of barcodes.&#13;&#13;Try scanning the examples to the right using a bar code scanner, such as the one on your smartphone."
                                       currentState.stockholm="stockholm" currentState.london="london" currentState.spark="spark">
        
        <containers:expandingContainerContent>
            
            <!--- expanding container #1 -->
            <data:ExpandingContainerData>
                <data:label>API</data:label>
                <data:content>
                    <s:FormItem id="colorFormItem" 
                                label="Color:">
                        <colorPicker:ColorPicker id="colorSelect"
                                                 selectedColor="#000000"/>
                    </s:FormItem>
                    <s:FormItem label="Resolution:">
                        <s:HSlider id="resolutionSelect"
                                   value="2" minimum="1" maximum="10"/>
                        <s:helpContent>
                            <s:Image source="@Embed(source='icons/question.png')"
                                     toolTip="Resolution to draw data in the bar code. Only applicable when the bar code is sized according to its measured dimensions.&#13;&#13;Defines the length of the sides of the rectangles that make up the barcode.&#13;&#13;Adjust to make the bar code wider and/or smaller. Minimum of 1."/>
                        </s:helpContent>
                    </s:FormItem>
                </data:content>
            </data:ExpandingContainerData>
            
        </containers:expandingContainerContent>
        
        <containers:centerContent>
            
            <!--- example #1 -->
            <data:PrimaryContentData>
                <data:tabLabel>CodaBar</data:tabLabel>
                <data:exampleDescription>Codabar. See Wikipedia - http://en.wikipedia.org/wiki/Codabar&#13;&#13;This standard is old and typically represents numeric data. However, it can represent a few letters and symbols.</data:exampleDescription>
                <data:primaryContent>
                    <s:Panel horizontalCenter="0" verticalCenter="0" 
                             title="CodaBar"
                             backgroundColor="#FFFFFF">
                        <s:VGroup top="20" right="20" bottom="20" left="20" 
                                  horizontalAlign="center">
                            <barCode:BarCode type="codabar" 
                                             barColor="{colorSelect.selectedColor}"
                                             resolution="{resolutionSelect.value}"
                                             value="A18348323232B" />
                            <s:Label text="A18348323232B"
                                     fontSize="13"/>
                        </s:VGroup>
                    </s:Panel>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #2 -->
            <data:PrimaryContentData>
                <data:tabLabel>Code128</data:tabLabel>
                <data:exampleDescription>Code 128. See http://www.azalea.com/faq.html/code-128/#Q3 for a good explanation (and http://en.wikipedia.org/wiki/Code_128).&#13;&#13;Code set A - alphanumeric data with uppercase letters only and non-typeable control codes.&#13;&#13;Code set B - alphanumeric data with upper/lowercase letters, numbers, and punctuation.</data:exampleDescription>
                <data:primaryContent>
                    <s:HGroup horizontalCenter="0" verticalCenter="0"
                              gap="20">
                        <s:Panel title="Code 128 A"
                                 backgroundColor="#FFFFFF">
                            <s:VGroup top="20" right="20" bottom="20" left="20" 
                                      horizontalAlign="center">
                                <barCode:BarCode type="code128A" 
                                                 barColor="{colorSelect.selectedColor}"
                                                 resolution="{resolutionSelect.value}"
                                                 value="AAB372S" />
                                <s:Label text="AAB372S"
                                         fontSize="13"/>
                            </s:VGroup>
                            
                        </s:Panel>
                        <s:Panel title="Code 128 B"
                                 backgroundColor="#FFFFFF">
                            <s:VGroup top="20" right="20" bottom="20" left="20" 
                                      horizontalAlign="center">
                                <barCode:BarCode type="code128B" 
                                                 barColor="{colorSelect.selectedColor}"
                                                 resolution="{resolutionSelect.value}"
                                                 value="aaAbB372s" />
                                <s:Label text="aaAbB372s"
                                         fontSize="13"/>
                            </s:VGroup>
                            
                        </s:Panel>
                    </s:HGroup>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #3 -->
            <data:PrimaryContentData>
                <data:tabLabel>Code39</data:tabLabel>
                <data:exampleDescription>Code 39. See Wikipedia: http://en.wikipedia.org/wiki/Code_39.&#13;&#13;Spec includes 43 characters; A through Z, 0 through 9, and special characters. A '*' is the start/stop delimiter.&#13;&#13;Only supports uppercase characters. Lowercase characters are encoded as uppercase characters.</data:exampleDescription>
                <data:primaryContent>
                    <s:Panel title="Code 39"
                             horizontalCenter="0" verticalCenter="0"
                             backgroundColor="#FFFFFF">
                        <s:VGroup top="20" right="20" bottom="20" left="20" 
                                  horizontalAlign="center">
                            <barCode:BarCode type="code39" 
                                             barColor="{colorSelect.selectedColor}"
                                             resolution="{resolutionSelect.value}"
                                             value="GF17384D" />
                            <s:Label text="GF17384D"
                                     fontSize="13"/>
                        </s:VGroup>
                    </s:Panel>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #4 -->
            <data:PrimaryContentData>
                <data:tabLabel>Code93</data:tabLabel>
                <data:exampleDescription>Code 93. see http://en.wikipedia.org/wiki/Code_93.&#13;&#13;Code 93 is designed to encode 26 upper case letters, 10 digits, and 7 special characters. Lowercase characters are encoded as uppercase characters.</data:exampleDescription>
                <data:primaryContent>
                    <s:Panel title="Code 93"
                             horizontalCenter="0" verticalCenter="0"
                             backgroundColor="#FFFFFF">
                        <s:VGroup top="20" right="20" bottom="20" left="20" 
                                  horizontalAlign="center">
                            <barCode:BarCode type="code93" 
                                             barColor="{colorSelect.selectedColor}"
                                             resolution="{resolutionSelect.value}"
                                             value="$UT239%D" />
                            <s:Label text="$UT239%D"
                                     fontSize="13"
                                     fontWeight="normal"/>
                        </s:VGroup>
                    </s:Panel>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #5 -->
            <data:PrimaryContentData>
                <data:tabLabel>EAN</data:tabLabel>
                <data:exampleDescription>International Article Number ('EAN'). See Wikipedia http://en.wikipedia.org/wiki/International_Article_Number_(EAN).&#13;&#13;Superset of the UPC 12 digit system created in Europe.&#13;&#13;Supports EAN-13 and EAN-8. EAN-13 expects a string length of 12 to encode and EAN-8 expects a string of length 7 to encode.</data:exampleDescription>
                <data:primaryContent>
                    <s:HGroup horizontalCenter="0" verticalCenter="0"
                              gap="20">
                        <s:Panel title="EAN 8"
                                 backgroundColor="#FFFFFF">
                            <s:VGroup top="20" right="20" bottom="20" left="20" 
                                      horizontalAlign="center">
                                <barCode:BarCode type="ean8" 
                                                 barColor="{colorSelect.selectedColor}"
                                                 resolution="{resolutionSelect.value}"
                                                 value="56478921" />
                                <s:Label text="56478921"
                                         fontSize="13"/>
                            </s:VGroup>
                        </s:Panel>
                        <s:Panel title="EAN 13"
                                 backgroundColor="#FFFFFF">
                            <s:VGroup top="20" right="20" bottom="20" left="20" 
                                      horizontalAlign="center">
                                <barCode:BarCode type="ean13" 
                                                 barColor="{colorSelect.selectedColor}"
                                                 resolution="{resolutionSelect.value}"
                                                 value="284734593821" />
                                <s:Label text="2847345938210"
                                         fontSize="13"/>
                            </s:VGroup>
                        </s:Panel>
                    </s:HGroup>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #6 -->
            <data:PrimaryContentData>
                <data:tabLabel>UPC</data:tabLabel>
                <data:exampleDescription>Universal Product Code ('UPC'): See http://en.wikipedia.org/wiki/Universal_Product_Code.&#13;&#13;UPC A is a 12 digit numerical system  (11 with a check). UPC E is a compressed, 6 digit code.&#13;&#13;Both UPC A &amp; E expect a string length of 11 or 12.</data:exampleDescription>
                <data:primaryContent>
                    <s:HGroup horizontalCenter="0" verticalCenter="0"
                              gap="20">
                        <s:Panel title="UPC A"
                                 backgroundColor="#FFFFFF">
                            <s:VGroup top="20" right="20" bottom="20" left="20" 
                                      horizontalAlign="center">
                                <barCode:BarCode type="upca" 
                                                 barColor="{colorSelect.selectedColor}"
                                                 resolution="{resolutionSelect.value}"
                                                 value="088391988770" />
                                <s:Label text="088391988770"
                                         fontSize="13"/>
                            </s:VGroup>
                        </s:Panel>
                        <s:Panel title="UPC E"
                                 backgroundColor="#FFFFFF">
                            <s:VGroup top="20" right="20" bottom="20" left="20" 
                                      horizontalAlign="center">
                                <barCode:BarCode type="upce" 
                                                 barColor="{colorSelect.selectedColor}"
                                                 resolution="{resolutionSelect.value}"
                                                 value="042100005264" />
                                <s:Label text="04252614"
                                         fontSize="13"/>
                            </s:VGroup>
                        </s:Panel>
                    </s:HGroup>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #7 -->
            <data:PrimaryContentData>
                <data:tabLabel>Int25</data:tabLabel>
                <data:exampleDescription>Interleaved 2 of 5. See http://en.wikipedia.org/wiki/Interleaved_2_of_5.&#13;&#13;Numeric only.  Must be an even number of digits.  Zeroes will be added if an odd number of digits are encoded.</data:exampleDescription>
                <data:primaryContent>
                    <s:Panel title="Interleaved 2 of 5"
                             horizontalCenter="0" verticalCenter="0"
                             minWidth="0"
                             backgroundColor="#FFFFFF">
                        <s:VGroup top="20" right="20" bottom="20" left="20"
                                  horizontalAlign="center">
                            <barCode:BarCode type="int25"
                                             barColor="{colorSelect.selectedColor}"
                                             resolution="{resolutionSelect.value}"
                                             value="5623783423" />
                            <s:Label text="5623783423"
                                     fontSize="13"/>
                        </s:VGroup>
                    </s:Panel>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #8 -->
            <data:PrimaryContentData>
                <data:tabLabel>MSI</data:tabLabel>
                <data:exampleDescription>Modified Plessey ('MSI'). See http://en.wikipedia.org/wiki/MSI_Barcode.&#13;&#13;Numeric only, very simple barcode.</data:exampleDescription>
                <data:primaryContent>
                    <s:Panel title="Modified Plessey"
                             horizontalCenter="0" verticalCenter="0"
                             backgroundColor="#FFFFFF"
                             dropShadowVisible="true">
                        <s:VGroup top="20" right="20" bottom="20" left="20" 
                                  horizontalAlign="center">
                            <barCode:BarCode type="msi" 
                                             barColor="{colorSelect.selectedColor}"
                                             resolution="{resolutionSelect.value}"
                                             value="12345674" />
                            <s:Label text="123456744"
                                     fontSize="13"/>
                        </s:VGroup>
                    </s:Panel>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            <!--- example #9 -->
            <data:PrimaryContentData>
                <data:tabLabel>QRCode</data:tabLabel>
                <data:exampleDescription>License holders will be provided with (i) a modified version of a third-party library, and (ii) a visual class that links to the modified third-party library to encode and display QR Codes. All provided source code for the display of QR Codes is licensed under the Apache License version 2.0.&#13;&#13;Explicit dimensions will work, but it is recommended to use measured dimensions because in that case encoded data will be displayed using whole pixels. Explicit dimensions may use partial pixels and therefore be harder for barcode readers to decode. To control the relative size of measured bar codes, use the 'resolution' property.</data:exampleDescription>
                <data:primaryContent>
                    <s:Panel horizontalCenter="0" verticalCenter="0" 
                             title="QR Code"
                             backgroundColor="#FFFFFF"
                             dropShadowVisible="true">
                        <barCode1:BarCodeQRCode top="20" right="20" bottom="20" left="20" 
                                                horizontalCenter="0" verticalCenter="0" 
                                                barColor="{colorSelect.selectedColor}"
                                                resolution="{resolutionSelect.value}"
                                                value="You scanned me with your smartphone didn't you?" />
                    </s:Panel>
                </data:primaryContent>
            </data:PrimaryContentData>
            
            
            
        </containers:centerContent>
        
    </containers:DemoApplicationWrapper>
    
</s:Module>