<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cafx="http://www.cffex.com.cn/tech/cafx/xsd">
    <xs:import namespace="http://www.cffex.com.cn/tech/cafx/xsd" schemaLocation="CommonTypes.xsd"/>
    <xs:element name="panels">
        <xs:annotation>
            <xs:documentation>面板配置文件根元素</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="panel" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="version" type="cafx:FrameworkVersion" use="required">
                <xs:annotation>
                    <xs:documentation>配置文件对应的框架版本号</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="panel">
        <xs:annotation>
            <xs:documentation>面板</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="properties" minOccurs="0"/>
                <xs:element ref="group" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="actions" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>面板名称。
该属性用于在面板和窗体配置文件(*.Forms.xml)之间进行关联</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="class" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>静态化：面板的类名。
动态化：面板的基类类名。
保持一个原则：这个类名所指向的类是用来创建这个面板的，它必须在代码中存在。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="controllerClass" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>自定义控制器类的全名。
如果不需要使用自定义控制器，那么删除该属性。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="properties">
        <xs:annotation>
            <xs:documentation>属性集合。该元素用于给父元素对应的控件动态设置属性。</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="property">
        <xs:annotation>
            <xs:documentation>对象属性。</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>属性名称</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="value" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>属性值</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="group">
        <xs:annotation>
            <xs:documentation>分组。
用于给面板下属的控件设置分组。</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice minOccurs="0">
                <xs:annotation>
                    <xs:documentation>在同一个分组下面，只能包含一种元素。例如，全部是 edit 或者全部是 button。</xs:documentation>
                </xs:annotation>
                <xs:element ref="edit" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="button" minOccurs="0" maxOccurs="unbounded"/>
            </xs:choice>
            <xs:attribute name="caption" type="xs:string">
                <xs:annotation>
                    <xs:documentation>分组标题。如果不设置该属性，或属性值为空，那么不会显示分组控件的标题栏。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="bound" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>控件的边界。
格式：Left,Top,Width,Height
分别对应控件的这四个属性。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="allowExpand" type="xs:boolean" use="optional" default="true">
                <xs:annotation>
                    <xs:documentation>是否允许展开分组。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="showBorder" type="xs:boolean" use="optional" default="true">
                <xs:annotation>
                    <xs:documentation>是否显示分组的边框。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="showCaption" type="xs:boolean" use="optional" default="false">
                <xs:annotation>
                    <xs:documentation>是否显示分组的标题栏。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="layoutControlClass" type="LayoutControlType" use="optional">
                <xs:annotation>
                    <xs:documentation>布局控件类名。
目前可选的是 CafxTableLayoutPanel</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="layoutParams" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>布局控件的参数。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="edit">
        <xs:annotation>
            <xs:documentation>表示一个编辑控件。用于提供输入项。</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="properties" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>控件名称。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="class" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>控件类名。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="caption" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>控件标签。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="default" type="xs:string" use="optional" default="">
                <xs:annotation>
                    <xs:documentation>默认值。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="bound" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>控件边界。在CafxTableLayoutPanel中进行布局时，bound 的四个参数分别是Column, Row, ColumnSpan, RowSpan</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="linkControl" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>关联输入控件的名称。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="nullable" type="xs:boolean" use="optional" default="true">
                <xs:annotation>
                    <xs:documentation>设置控件是否可以填入空值。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="readonly" type="xs:boolean" use="optional" default="true">
                <xs:annotation>
                    <xs:documentation>设置控件是否只读。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="visible" type="xs:boolean" use="optional" default="true">
                <xs:annotation>
                    <xs:documentation>设置控件是否可见。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="button">
        <xs:annotation>
            <xs:documentation>表示一个按钮控件。</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>控件名称。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="caption" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>控件标题。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="bound" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>控件的边界。
格式：Left,Top,Width,Height
分别对应控件的这四个属性。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="image" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>控件的图标资源文件名。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="enabled" type="xs:boolean" use="optional" default="true">
                <xs:annotation>
                    <xs:documentation>设置控件是否可用。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="default" type="xs:boolean" use="optional" default="false">
                <xs:annotation>
                    <xs:documentation>设置是否为默认按钮。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="visible" type="xs:boolean" use="optional" default="true">
                <xs:annotation>
                    <xs:documentation>设置控件是否可见。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="action" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>设置控件的动作。该属性用于控制器自动调用功能。当点击了带有 action 的按钮之后，控制器会将对应的动作在窗体范围内进行广播，所有设置了对应 action 元素的面板会自动响应。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="actions">
        <xs:annotation>
            <xs:documentation>设置面板可以响应的动作列表</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="action" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="action">
        <xs:annotation>
            <xs:documentation>动作。</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>动作的名称。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="mode" type="ActionMode" use="required">
                <xs:annotation>
                    <xs:documentation>动作的模式。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="funcid" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>对应的功能号。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="reference" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>引用的对象。
对于新增/修改功能的调用，该参数应当填写对应窗体的完整类名。特别地，如果引用动态窗体，那么应当在类名之前加上 # 字符。</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:simpleType name="ActionMode">
        <xs:annotation>
            <xs:documentation>动作模式。</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="Custom">
                <xs:annotation>
                    <xs:documentation>自定义动作。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="Query">
                <xs:annotation>
                    <xs:documentation>查询。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="Add">
                <xs:annotation>
                    <xs:documentation>新增。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="Delete">
                <xs:annotation>
                    <xs:documentation>删除。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="Modify">
                <xs:annotation>
                    <xs:documentation>修改。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="CallAdd">
                <xs:annotation>
                    <xs:documentation>调用新增界面。对应 action 的 reference 属性应当是被调用界面的全名。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="CallModify">
                <xs:annotation>
                    <xs:documentation>调用修改界面。对应 action 的 reference 属性应当是被调用界面的全名。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="RelativeQuery">
                <xs:annotation>
                    <xs:documentation>关联查询。对应 action 的 name 必须是 RelativeQuery, funcId 应当是关联查询的目的功能号。</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="DockStyle">
        <xs:annotation>
            <xs:documentation>停靠样式。</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="None"/>
            <xs:enumeration value="Top"/>
            <xs:enumeration value="Bottom"/>
            <xs:enumeration value="Left"/>
            <xs:enumeration value="Right"/>
            <xs:enumeration value="Fill"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="LayoutControlType">
        <xs:annotation>
            <xs:documentation>布局面板类型。</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="CafxTableLayoutPanel"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
