<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2008-2016 Haulmont.
  ~
  ~ 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.
  ~
  -->

<xs:schema targetNamespace="http://schemas.haulmont.com/cuba/window.xsd"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        xmlns:views="http://schemas.haulmont.com/cuba/view.xsd"
        elementFormDefault="qualified"
        attributeFormDefault="unqualified">

    <xs:import namespace="http://schemas.haulmont.com/cuba/view.xsd"
               schemaLocation="http://schemas.haulmont.com/cuba/view.xsd"/>

    <!-- Enums -->

    <xs:simpleType name="filterMode">
        <xs:restriction base="xs:string">
            <xs:enumeration value="NO"/>
            <xs:enumeration value="STARTS_WITH"/>
            <xs:enumeration value="CONTAINS"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="datatypeEnum">
        <xs:restriction base="xs:string">
            <xs:enumeration value="decimal"/>
            <xs:enumeration value="boolean"/>
            <xs:enumeration value="byte array"/>
            <xs:enumeration value="date"/>
            <xs:enumeration value="double"/>
            <xs:enumeration value="int"/>
            <xs:enumeration value="long"/>
            <xs:enumeration value="string"/>
            <xs:enumeration value="uuid"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="dateFieldResolution">
        <xs:restriction base="xs:string">
            <xs:enumeration value="SEC"/>
            <xs:enumeration value="MIN"/>
            <xs:enumeration value="HOUR"/>
            <xs:enumeration value="DAY"/>
            <xs:enumeration value="MONTH"/>
            <xs:enumeration value="YEAR"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="tokenListType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="LOOKUP"/>
            <xs:enumeration value="PICKER"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="tokenListPosition">
        <xs:restriction base="xs:string">
            <xs:enumeration value="TOP"/>
            <xs:enumeration value="BOTTOM"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="aggregation">
        <xs:restriction base="xs:string">
            <xs:enumeration value="SUM"/>
            <xs:enumeration value="COUNT"/>
            <xs:enumeration value="AVG"/>
            <xs:enumeration value="MIN"/>
            <xs:enumeration value="MAX"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="aggregationStyle">
        <xs:restriction base="xs:string">
            <xs:enumeration value="TOP"/>
            <xs:enumeration value="BOTTOM"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="componentSize">
        <xs:union>
            <xs:simpleType>
                <xs:restriction base="xs:string"/>
            </xs:simpleType>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="AUTO"/>
                    <xs:enumeration value="100%"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>

    <xs:simpleType name="dialogSize">
        <xs:union>
            <xs:simpleType>
                <xs:restriction base="xs:string"/>
            </xs:simpleType>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="AUTO"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>

    <xs:simpleType name="resourceString">
        <xs:union>
            <xs:simpleType>
                <xs:restriction base="xs:string"/>
            </xs:simpleType>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="msg://"/>
                    <xs:enumeration value="mainMsg://"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>

    <xs:simpleType name="orientation">
        <xs:restriction base="xs:string">
            <xs:enumeration value="horizontal"/>
            <xs:enumeration value="vertical"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="scrollBars">
        <xs:restriction base="xs:string">
            <xs:enumeration value="horizontal"/>
            <xs:enumeration value="vertical"/>
            <xs:enumeration value="both"/>
            <xs:enumeration value="none"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="align">
        <xs:restriction base="xs:string">
            <xs:enumeration value="TOP_RIGHT"/>
            <xs:enumeration value="TOP_LEFT"/>
            <xs:enumeration value="TOP_CENTER"/>
            <xs:enumeration value="MIDDLE_RIGHT"/>
            <xs:enumeration value="MIDDLE_LEFT"/>
            <xs:enumeration value="MIDDLE_CENTER"/>
            <xs:enumeration value="BOTTOM_RIGHT"/>
            <xs:enumeration value="BOTTOM_LEFT"/>
            <xs:enumeration value="BOTTOM_CENTER"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="rowHeaderMode">
        <xs:restriction base="xs:string">
            <xs:enumeration value="NONE"/>
            <xs:enumeration value="ICON"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="openType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="NEW_TAB"/>
            <xs:enumeration value="THIS_TAB"/>
            <xs:enumeration value="DIALOG"/>
            <xs:enumeration value="NEW_WINDOW"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="embeddedType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="IMAGE"/>
            <xs:enumeration value="OBJECT"/>
            <xs:enumeration value="BROWSER"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="sourceCodeEditorMode">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Java"/>
            <xs:enumeration value="HTML"/>
            <xs:enumeration value="XML"/>
            <xs:enumeration value="Groovy"/>
            <xs:enumeration value="SQL"/>
            <xs:enumeration value="JavaScript"/>
            <xs:enumeration value="Properties"/>
            <xs:enumeration value="Text"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="refreshMode">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ALWAYS"/>
            <xs:enumeration value="NEVER"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="borderMode">
        <xs:restriction base="xs:string">
            <xs:enumeration value="visible"/>
            <xs:enumeration value="hidden"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="fieldGroupCaptionAlignment">
        <xs:restriction base="xs:string">
            <xs:enumeration value="TOP"/>
            <xs:enumeration value="LEFT"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="maskedFieldValueMode">
        <xs:restriction base="xs:string">
            <xs:enumeration value="masked"/>
            <xs:enumeration value="clear"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="searchMode">
        <xs:restriction base="xs:string">
            <xs:enumeration value="CASE_SENSITIVE"/>
            <xs:enumeration value="LOWER_CASE"/>
            <xs:enumeration value="UPPER_CASE"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="operatorType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="EQUAL"/>
            <xs:enumeration value="IN"/>
            <xs:enumeration value="NOT_IN"/>
            <xs:enumeration value="NOT_EQUAL"/>
            <xs:enumeration value="GREATER"/>
            <xs:enumeration value="GREATER_OR_EQUAL"/>
            <xs:enumeration value="LESSER"/>
            <xs:enumeration value="LESSER_OR_EQUAL"/>
            <xs:enumeration value="CONTAINS"/>
            <xs:enumeration value="DOES_NOT_CONTAIN"/>
            <xs:enumeration value="EMPTY"/>
            <xs:enumeration value="NOT_EMPTY"/>
            <xs:enumeration value="STARTS_WITH"/>
            <xs:enumeration value="ENDS_WITH"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="linkTarget">
        <xs:union>
            <xs:simpleType>
                <xs:restriction base="xs:string"/>
            </xs:simpleType>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="_blank"/>
                    <xs:enumeration value="_self"/>
                    <xs:enumeration value="_parent"/>
                    <xs:enumeration value="_top"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>

    <xs:simpleType name="constraintOperationType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="create"/>
            <xs:enumeration value="read"/>
            <xs:enumeration value="update"/>
            <xs:enumeration value="delete"/>
            <xs:enumeration value="all"/>
            <xs:enumeration value="custom"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- Interfaces -->

    <xs:attributeGroup name="hasId">
        <xs:attribute name="id" type="xs:string"/>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="requiresId">
        <xs:attribute name="id" type="xs:string" use="required"/>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasSize">
        <xs:attribute name="width" type="componentSize"/>
        <xs:attribute name="height" type="componentSize"/>
        <xs:attribute name="colspan" type="xs:integer"/>
        <xs:attribute name="rowspan" type="xs:integer"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasIcon">
        <xs:attribute name="icon" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasGridConstraints">
        <xs:attribute name="colspan" type="xs:integer"/>
        <xs:attribute name="rowspan" type="xs:integer"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasWidthProp">
        <xs:attribute name="width" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasHeightProp">
        <xs:attribute name="height" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasVisibility">
        <xs:attribute name="visible" type="xs:boolean"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasAlign">
        <xs:attribute name="align" type="align"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasStyle">
        <xs:attribute name="stylename" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasResponsive">
        <xs:attribute name="responsive" type="xs:boolean"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasSpacingMargin">
        <xs:attribute name="spacing" type="xs:boolean"/>
        <xs:attribute name="margin" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasSpacing">
        <xs:attribute name="spacing" type="xs:boolean"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasExpand">
        <xs:attribute name="expand" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasEditState">
        <xs:attribute name="editable" type="xs:boolean"/>
        <xs:attribute name="enable" type="xs:boolean"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasEditable">
        <xs:attribute name="editable" type="xs:boolean"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasEnableProp">
        <xs:attribute name="enable" type="xs:boolean"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasDatasource">
        <xs:attribute name="datasource" type="xs:string"/>
        <xs:attribute name="property" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="requiresDatasource">
        <xs:attribute name="datasource" type="xs:string" use="required"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasDatasourceProp">
        <xs:attribute name="datasource" type="xs:string" use="required"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasValue">
        <xs:attribute name="value" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasCaption">
        <xs:attribute name="caption" type="resourceString"/>
        <xs:attribute name="description" type="resourceString"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasCaptionProp">
        <xs:attribute name="caption" type="resourceString"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasRequirements">
        <xs:attribute name="required" type="xs:boolean"/>
        <xs:attribute name="requiredMessage" type="resourceString"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasDatatype">
        <xs:attribute name="datatype" type="datatypeEnum"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasOptions">
        <xs:attribute name="optionsDatasource" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="hasCaptionSource">
        <xs:attribute name="captionProperty" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="isTableComponent">
        <xs:attributeGroup ref="hasId"/>

        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEditState"/>
        <xs:attributeGroup ref="hasAlign"/>

        <xs:attribute name="multiselect" type="xs:boolean"/>
        <xs:attribute name="sortable" type="xs:boolean"/>
        <xs:attribute name="reorderingAllowed" type="xs:boolean"/>
        <xs:attribute name="columnControlVisible" type="xs:boolean"/>
        <xs:attribute name="columnHeaderVisible" type="xs:boolean"/>
        <xs:attribute name="showSelection" type="xs:boolean"/>

        <xs:attribute name="aggregatable" type="xs:boolean"/>
        <xs:attribute name="aggregationStyle" type="aggregationStyle"/>
        <xs:attribute name="showTotalAggregation" type="xs:boolean"/>
        <xs:attribute name="presentations" type="xs:boolean"/>
        <xs:attribute name="contextMenuEnabled" type="xs:boolean"/>
        <xs:attribute name="multiLineCells" type="xs:boolean"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="isLayoutComponent">
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasSpacingMargin"/>

        <xs:attribute name="expand" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="isDatasource">
        <xs:attribute name="id" type="xs:string" use="required"/>
        <xs:attribute name="class" type="xs:string"/>
        <xs:attribute name="view" type="xs:string"/>
        <xs:attribute name="allowCommit" type="xs:boolean"/>
        <xs:attribute name="datasourceClass" type="xs:string"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="isCollectionDatasource">
        <xs:attributeGroup ref="isDatasource"/>
        <xs:attribute name="maxResults" type="xs:int"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="isNestedDatasource">
        <xs:attribute name="id" type="xs:string" use="required"/>
        <xs:attribute name="property" type="xs:string" use="required"/>
        <xs:attribute name="datasourceClass" type="xs:string"/>
        <xs:attribute name="allowCommit" type="xs:boolean"/>
    </xs:attributeGroup>

    <!-- Utils -->

    <xs:complexType name="formatterType">
        <xs:attribute name="class" type="xs:string"/>
        <xs:attribute name="format" type="xs:string"/>
        <xs:attribute name="type" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="validatorType" mixed="true">
        <xs:attribute name="class" type="xs:string"/>
        <xs:attribute name="message" type="xs:string"/>
        <xs:attribute name="script" type="xs:string"/>
        <xs:attribute name="onlyPositive" type="xs:boolean"/>
        <xs:attribute name="valueType" type="xs:string"/>
        <xs:attribute name="minValue" type="xs:string"/>
        <xs:attribute name="includeMinValue" type="xs:boolean"/>
        <xs:attribute name="maxValue" type="xs:string"/>
        <xs:attribute name="includeMaxValue" type="xs:boolean"/>
        <xs:attribute name="ignoreCase" type="xs:boolean"/>
        <xs:attribute name="pattern" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="tableRowsType">
        <xs:attribute name="datasource" type="xs:string" use="required"/>
        <xs:attribute name="rowHeaderMode" type="rowHeaderMode"/>
    </xs:complexType>

    <xs:complexType name="tableColumnsList">
        <xs:sequence>
            <xs:element name="column" minOccurs="1" maxOccurs="unbounded" type="tableColumnComponent"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="groupTableColumnsType">
        <xs:sequence>
            <xs:element name="group" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="column" minOccurs="1" maxOccurs="unbounded" type="tableColumnComponent"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="column" minOccurs="1" maxOccurs="unbounded" type="tableColumnComponent"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="accessControlAccessType" mixed="true">
        <xs:sequence>
            <xs:element name="param" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                    <xs:attribute name="name" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="script" type="xs:string"/>
        <xs:attribute name="property" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="companionType">
        <xs:attribute name="class" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="filterType">
        <xs:choice>
            <xs:element name="c" type="filterClauseType" minOccurs="0" maxOccurs="1"/>
            <xs:element name="and" type="filterLogicalType" minOccurs="0" maxOccurs="1"/>
            <xs:element name="or" type="filterLogicalType" minOccurs="0" maxOccurs="1"/>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="filterClauseType" mixed="true">
        <xs:attribute name="join" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="filterLogicalType">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="c" type="filterClauseType" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="and" type="filterLogicalType" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="or" type="filterLogicalType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="frameAction">
        <xs:attributeGroup ref="requiresId"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasIcon"/>

        <xs:attribute name="invoke" type="xs:string"/>
        <xs:attribute name="shortcut" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="componentAction">
        <xs:attributeGroup ref="requiresId"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasIcon"/>

        <xs:attribute name="openType" type="openType"/>
        <xs:attribute name="trackSelection" type="xs:boolean"/>
        <xs:attribute name="invoke" type="xs:string"/>
        <xs:attribute name="shortcut" type="xs:string"/>
        <xs:attribute name="constraintOperationType" type="constraintOperationType"/>
        <xs:attribute name="constraintCode" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="popupButtonAction">
        <xs:attributeGroup ref="requiresId"/>
        <xs:attributeGroup ref="hasCaptionProp"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attribute name="invoke" type="xs:string"/>
    </xs:complexType>

    <!-- Components -->

    <!-- Label -->
    <xs:complexType name="labelComponent">
        <xs:sequence>
            <xs:element name="formatter" minOccurs="0" maxOccurs="1" type="formatterType"/>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attribute name="description" type="resourceString"/>

        <xs:attributeGroup ref="hasDatasource"/>
        <xs:attribute name="value" type="resourceString"/>

        <xs:attribute name="htmlEnabled" type="xs:boolean"/>
    </xs:complexType>

    <!-- Link -->
    <xs:complexType name="linkComponent">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasIcon"/>

        <xs:attribute name="url" type="xs:anyURI"/>
        <xs:attribute name="target" type="linkTarget"/>
    </xs:complexType>

    <!-- CheckBox -->
    <xs:complexType name="checkBoxComponent">
        <xs:attributeGroup ref="hasId"/>

        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEditable"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasSize"/>

        <xs:attributeGroup ref="hasDatasource"/>
    </xs:complexType>

    <!-- BaseField -->
    <xs:complexType name="baseFieldComponent">
        <xs:attributeGroup ref="hasId"/>

        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasAlign"/>

        <xs:attributeGroup ref="hasEditState"/>
        <xs:attributeGroup ref="hasRequirements"/>

        <xs:attributeGroup ref="hasDatasource"/>
    </xs:complexType>

    <!-- BaseTextComponent -->
    <xs:complexType name="baseTextComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="unbounded" type="validatorType"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- TextField -->
    <xs:complexType name="textFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseTextComponent">
                <xs:sequence>
                    <xs:element name="formatter" minOccurs="0" maxOccurs="1" type="formatterType"/>
                </xs:sequence>

                <xs:attributeGroup ref="hasDatatype"/>

                <xs:attribute name="maxLength" type="xs:int"/>
                <xs:attribute name="trim" type="xs:boolean"/>
                <xs:attribute name="inputPrompt" type="resourceString"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- TextArea -->
    <xs:complexType name="textAreaComponent">
        <xs:complexContent>
            <xs:extension base="baseTextComponent">
                <xs:attribute name="cols" type="xs:int"/>
                <xs:attribute name="rows" type="xs:int"/>

                <xs:attribute name="maxLength" type="xs:int"/>
                <xs:attribute name="resizable" type="xs:boolean"/>
                <xs:attribute name="trim" type="xs:boolean"/>
                <xs:attribute name="inputPrompt" type="resourceString"/>
                <xs:attribute name="wordwrap" type="xs:boolean"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- TextArea -->
    <xs:complexType name="sourceCodeEditorComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:attribute name="mode" type="sourceCodeEditorMode"/>
                <xs:attribute name="printMargin" type="xs:boolean"/>
                <xs:attribute name="showGutter" type="xs:boolean"/>
                <xs:attribute name="highlightActiveLine" type="xs:boolean"/>
                <xs:attribute name="handleTabKey" type="xs:boolean"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- MaskedField -->
    <xs:complexType name="maskedFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseTextComponent">
                <xs:attribute name="mask" type="xs:string" use="required"/>
                <xs:attribute name="valueMode" type="maskedFieldValueMode"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="passwordFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseTextComponent">
                <xs:attribute name="maxLength" type="xs:int"/>
                <xs:attribute name="autocomplete" type="xs:boolean"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- RichTextArea -->
    <xs:complexType name="richTextAreaComponent">
        <xs:complexContent>
            <xs:extension base="baseTextComponent"/>
        </xs:complexContent>
    </xs:complexType>

    <!-- DateField -->
    <xs:complexType name="dateFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                </xs:sequence>
                <xs:attribute name="resolution" type="dateFieldResolution"/>
                <xs:attribute name="dateFormat" type="xs:string"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- TimeField -->
    <xs:complexType name="timeFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                </xs:sequence>
                <xs:attribute name="showSeconds" type="xs:boolean"/>
                <xs:attribute name="timeFormat" type="xs:string"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- Progress bar -->
    <xs:complexType name="progressBarComponent">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attribute name="indeterminate" type="xs:string"/>
    </xs:complexType>

    <!-- LookupField-->
    <xs:complexType name="lookupFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                </xs:sequence>
                <xs:attributeGroup ref="hasOptions"/>
                <xs:attributeGroup ref="hasCaptionSource"/>

                <xs:attribute name="filterMode" type="filterMode"/>
                <xs:attribute name="nullName" type="xs:string"/>
                <xs:attribute name="pageLength" type="xs:int"/>

                <xs:attribute name="newOptionAllowed" type="xs:boolean"/>
                <xs:attribute name="textInputAllowed" type="xs:boolean"/>
                <xs:attribute name="newOptionHandler" type="xs:string"/>
                <xs:attribute name="inputPrompt" type="resourceString"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- SearchField-->
    <xs:complexType name="searchFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                </xs:sequence>

                <xs:attributeGroup ref="hasOptions"/>
                <xs:attributeGroup ref="hasCaptionSource"/>

                <xs:attribute name="nullName" type="resourceString"/>
                <xs:attribute name="inputPrompt" type="resourceString"/>

                <xs:attribute name="minSearchStringLength" type="xs:integer"/>
                <xs:attribute name="mode" type="searchMode"/>
                <xs:attribute name="escapeValueForLike" type="xs:boolean"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- PickerField -->
    <xs:complexType name="pickerFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                    <xs:element name="actions" minOccurs="0" maxOccurs="1" type="componentActions"/>
                </xs:sequence>

                <xs:attributeGroup ref="hasCaptionSource"/>

                <xs:attribute name="metaClass" type="xs:string"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- LookupPickerField -->
    <xs:complexType name="lookupPickerFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                    <xs:element name="actions" minOccurs="0" maxOccurs="1" type="componentActions"/>
                </xs:sequence>

                <xs:attributeGroup ref="hasOptions"/>
                <xs:attributeGroup ref="hasCaptionSource"/>
                <xs:attribute name="refreshOptionsOnLookupClose" type="xs:boolean"/>
                <xs:attribute name="filterMode" type="filterMode"/>
                <xs:attribute name="nullName" type="resourceString"/>
                <xs:attribute name="metaClass" type="xs:string"/>
                <xs:attribute name="pageLength" type="xs:int"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- SearchPickerField -->
    <xs:complexType name="searchPickerFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                    <xs:element name="actions" minOccurs="0" maxOccurs="1" type="componentActions"/>
                </xs:sequence>

                <xs:attributeGroup ref="hasOptions"/>
                <xs:attributeGroup ref="hasCaptionSource"/>

                <xs:attribute name="metaClass" type="xs:string"/>

                <xs:attribute name="nullName" type="resourceString"/>
                <xs:attribute name="inputPrompt" type="resourceString"/>

                <xs:attribute name="minSearchStringLength" type="xs:integer"/>
                <xs:attribute name="mode" type="searchMode"/>
                <xs:attribute name="escapeValueForLike" type="xs:boolean"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    
    <xs:complexType name="optionsBaseFieldComponent">
        <xs:complexContent>
            <xs:extension base="baseFieldComponent">
                <xs:sequence>
                    <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
                </xs:sequence>
                <xs:attributeGroup ref="hasCaptionSource"/>
                <xs:attributeGroup ref="hasOptions"/>
                <xs:attribute name="multiselect" type="xs:boolean"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- OptionsGroup -->
    <xs:complexType name="optionsGroupComponent">
        <xs:complexContent>
            <xs:extension base="optionsBaseFieldComponent">
                <xs:attribute name="orientation" type="orientation"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- OptionsList -->
    <xs:complexType name="optionsListComponent">
        <xs:complexContent>
            <xs:extension base="optionsBaseFieldComponent">
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <!-- FileUploadField -->
    <xs:complexType name="uploadComponent">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attribute name="accept" type="xs:string"/>
        <xs:attribute name="permittedExtensions" type="xs:string"/>
        <xs:attribute name="fileSizeLimit" type="xs:long"/>
    </xs:complexType>

    <!-- FileMultiUploadField -->
    <xs:complexType name="multiuploadComponent">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attribute name="accept" type="xs:string"/>
        <xs:attribute name="permittedExtensions" type="xs:string"/>
        <xs:attribute name="fileSizeLimit" type="xs:long"/>
    </xs:complexType>

    <!-- Embedded -->
    <xs:complexType name="embeddedComponent">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attribute name="src" type="xs:string"/>
        <xs:attribute name="type" type="embeddedType"/>
    </xs:complexType>

    <!-- Tree -->
    <xs:complexType name="treeComponent">
        <xs:sequence>
            <xs:element name="actions" minOccurs="0" maxOccurs="1" type="componentActions"/>
            <xs:element name="buttonsPanel" minOccurs="0" maxOccurs="1" type="buttonsPanelComponent"/>
            <xs:element name="treechildren" minOccurs="1" maxOccurs="1">
                <xs:complexType>
                    <xs:attributeGroup ref="hasCaptionSource"/>
                    <xs:attribute name="datasource" type="xs:string" use="required"/>
                    <xs:attribute name="hierarchyProperty" type="xs:string"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attribute name="multiselect" type="xs:boolean"/>
    </xs:complexType>

    <!-- Button -->
    <xs:complexType name="buttonComponent">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasCaption"/>

        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasWidthProp"/>
        <xs:attributeGroup ref="hasHeightProp"/>
        <xs:attributeGroup ref="hasGridConstraints"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasIcon"/>

        <xs:attribute name="action" type="xs:string"/>

        <xs:attribute name="invoke" type="xs:string"/>

        <xs:attribute name="focusable" type="xs:boolean"/>
    </xs:complexType>

    <!-- PopupButton -->
    <xs:complexType name="popupButtonComponent">
        <xs:sequence>
            <xs:element name="actions" nillable="true" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:choice minOccurs="1" maxOccurs="unbounded">
                            <xs:element name="action" type="popupButtonAction"/>
                        </xs:choice>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasCaption"/>

        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasWidthProp"/>
        <xs:attributeGroup ref="hasGridConstraints"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasIcon"/>

        <xs:attribute name="showActionIcons" type="xs:boolean"/>

        <xs:attribute name="focusable" type="xs:boolean"/>
    </xs:complexType>

    <!-- ButtonsPanel -->
    <xs:complexType name="buttonsPanelComponent">
        <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="layoutOrComponent"/>
            </xs:choice>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>

        <xs:attributeGroup ref="hasWidthProp"/>
        <xs:attributeGroup ref="hasHeightProp"/>

        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasExpand"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>

        <xs:attributeGroup ref="hasGridConstraints"/>

        <xs:attribute name="providerClass" type="xs:string"/>
        <xs:attribute name="alwaysVisible" type="xs:boolean"/>
    </xs:complexType>

    <!-- Table.Column -->
    <xs:complexType name="tableColumnComponent">
        <xs:sequence>
            <xs:element name="formatter" minOccurs="0" maxOccurs="1" type="formatterType"/>
            <xs:element name="aggregation" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="formatter" minOccurs="0" maxOccurs="1" type="formatterType"/>
                    </xs:sequence>
                    <xs:attribute name="type" type="aggregation" use="optional"/>
                    <xs:attribute name="strategyClass" type="xs:string" use="optional"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="requiresId"/>
        <xs:attributeGroup ref="hasWidthProp"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasVisibility"/>

        <xs:attribute name="generator" type="xs:string"/>

        <xs:attribute name="collapsed" type="xs:boolean"/>
        <xs:attribute name="groupAllowed" type="xs:boolean"/>
        <xs:attribute name="sortable" type="xs:boolean"/>
        <xs:attribute name="maxTextLength" type="xs:integer"/>
        <xs:attribute name="calculatable" type="xs:boolean"/>
        <xs:attribute name="align" type="columnAlignment"/>

        <!-- Show entity reference as clickable link -->
        <xs:attribute name="link" type="xs:boolean"/>
        <xs:attribute name="linkScreen" type="xs:string"/>
        <xs:attribute name="linkInvoke" type="xs:string"/>
        <xs:attribute name="linkScreenOpenType" type="openType"/>

        <!-- Additional attributes, use only for editable table -->
        <xs:attributeGroup ref="hasOptions"/>
        <xs:attributeGroup ref="hasEditable"/>
        <xs:attributeGroup ref="hasRequirements"/>
        <xs:attributeGroup ref="hasCaptionSource"/>
        <xs:attribute name="resolution" type="dateFieldResolution"/>
        <xs:attribute name="dateFormat" type="xs:string"/>
    </xs:complexType>

    <!-- Table -->
    <xs:complexType name="tableComponent">
        <xs:all>
            <xs:element name="actions" minOccurs="0" maxOccurs="1" type="componentActions"/>
            <xs:element name="buttonsPanel" minOccurs="0" maxOccurs="1" type="buttonsPanelComponent"/>
            <xs:element name="rowsCount" minOccurs="0" maxOccurs="1">
                <xs:complexType/>
            </xs:element>
            <xs:element name="columns" minOccurs="1" maxOccurs="1" type="tableColumnsList"/>
            <xs:element name="rows" minOccurs="1" type="tableRowsType"/>
        </xs:all>

        <xs:attributeGroup ref="isTableComponent"/>
    </xs:complexType>

    <!-- GroupTable -->
    <xs:complexType name="groupTableComponent">
        <xs:all>
            <xs:element name="actions" minOccurs="0" maxOccurs="1" type="componentActions"/>
            <xs:element name="buttonsPanel" minOccurs="0" maxOccurs="1" type="buttonsPanelComponent"/>
            <xs:element name="rowsCount" minOccurs="0" maxOccurs="1">
                <xs:complexType/>
            </xs:element>
            <xs:element name="columns" minOccurs="1" maxOccurs="1" type="groupTableColumnsType"/>
            <xs:element name="rows" minOccurs="1" type="tableRowsType"/>
        </xs:all>

        <xs:attributeGroup ref="isTableComponent"/>

        <xs:attribute name="fixedGrouping" type="xs:boolean"/>
    </xs:complexType>

    <!-- Filter -->
    <xs:complexType name="filterComponent">
        <xs:sequence>
            <xs:element name="properties" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="include" type="xs:string" use="required"/>
                    <xs:attribute name="exclude" type="xs:string"/>
                    <xs:attribute name="excludeProperties" type="xs:string"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required"/>
                    <xs:attribute name="caption" type="resourceString"/>
                    <xs:attribute name="paramWhere" type="xs:string"/>
                    <xs:attribute name="paramView" type="xs:string"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="custom" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                    <xs:attribute name="name" type="xs:string" use="required"/>
                    <xs:attribute name="caption" type="resourceString"/>
                    <xs:attribute name="paramClass" type="xs:string"/>
                    <xs:attribute name="inExpr" type="xs:boolean"/>
                    <xs:attribute name="join" type="xs:string"/>
                    <xs:attribute name="paramWhere" type="xs:string"/>
                    <xs:attribute name="paramView" type="xs:string"/>
                    <xs:attribute name="operatorType" type="operatorType"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="requiresDatasource"/>

        <xs:attributeGroup ref="hasCaptionProp"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasWidthProp"/>

        <xs:attribute name="margin" type="xs:string"/>

        <xs:attribute name="applyTo" type="xs:string"/>
        <xs:attribute name="useMaxResults" type="xs:boolean"/>
        <xs:attribute name="textMaxResults" type="xs:boolean"/>
        <xs:attribute name="manualApplyRequired" type="xs:boolean"/>
        <xs:attribute name="editable" type="xs:boolean"/>
        <xs:attribute name="folderActionsEnabled" type="xs:boolean"/>
        <xs:attribute name="columnsQty" type="xs:int"/>
        <xs:attribute name="collapsable" type="xs:boolean"/>
        <xs:attribute name="collapsed" type="xs:boolean"/>
        <xs:attribute name="defaultMode">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="generic"/>
                    <xs:enumeration value="fts"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="modeSwitchVisible" type="xs:boolean"/>
    </xs:complexType>

    <!-- FieldGroup.FieldConfig -->
    <xs:complexType name="fieldGroupField">
        <xs:sequence>
            <xs:element name="formatter" minOccurs="0" maxOccurs="1" type="formatterType"/>
            <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
        </xs:sequence>

        <xs:attributeGroup ref="requiresId"/>

        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasEditState"/>
        <xs:attributeGroup ref="hasVisibility"/>

        <xs:attribute name="width" type="componentSize"/>

        <xs:attribute name="requiredMessage" type="resourceString"/>
        <xs:attribute name="custom" type="xs:boolean"/>

        <xs:attribute name="datasource" type="xs:string"/>

        <xs:attribute name="resolution" type="dateFieldResolution"/>
        <xs:attribute name="dateFormat" type="xs:string"/>
        <xs:attribute name="maxLength" type="xs:int"/>

        <xs:attribute name="cols" type="xs:int"/>
        <xs:attribute name="rows" type="xs:int"/>

        <xs:attribute name="stylename" type="xs:string"/>

        <xs:attribute name="optionsDatasource" type="xs:string"/>
        <xs:attribute name="captionProperty" type="xs:string"/>
        <xs:attribute name="descriptionProperty" type="xs:string"/>
        <xs:attribute name="field" type="xs:string"/>
        <xs:attribute name="showSeconds" type="xs:string"/>
        <xs:attribute name="required" type="xs:boolean"/>
        <xs:attribute name="mask" type="xs:string"/>
        <xs:attribute name="valueMode" type="maskedFieldValueMode"/>

        <!-- Show entity reference as clickable link -->
        <xs:attribute name="link" type="xs:boolean"/>
        <xs:attribute name="linkScreen" type="xs:string"/>
        <xs:attribute name="linkScreenOpenType" type="openType"/>
        <xs:attribute name="linkInvoke" type="xs:string"/>
    </xs:complexType>

    <!-- FieldGroup -->
    <xs:complexType name="fieldGroupComponent">
        <xs:choice maxOccurs="unbounded" minOccurs="0">
            <xs:element name="field" type="fieldGroupField"/>
            <xs:element name="column">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="field" minOccurs="1" maxOccurs="unbounded" type="fieldGroupField"/>
                    </xs:sequence>
                    <xs:attributeGroup ref="hasId"/>

                    <xs:attribute name="width" type="xs:string"/>
                    <xs:attribute name="flex" type="xs:string"/>
                    <xs:attribute name="fieldCaptionWidth" type="xs:string"/>
                </xs:complexType>
            </xs:element>
        </xs:choice>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasAlign"/>

        <xs:attributeGroup ref="hasCaptionProp"/>
        <xs:attributeGroup ref="hasEditState"/>

        <xs:attribute name="captionAlignment" type="fieldGroupCaptionAlignment"/>
        <xs:attribute name="fieldCaptionWidth" type="xs:string"/>

        <xs:attribute name="datasource" type="xs:string"/>
        <xs:attribute name="border" type="borderMode"/>
    </xs:complexType>

    <!-- TokenList -->
    <xs:complexType name="tokenListComponent">
        <xs:all>
            <xs:element name="lookup" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="optionsDatasource" type="xs:string"/>
                    <xs:attribute name="captionProperty" type="xs:string"/>
                    <xs:attribute name="lookupScreen" type="xs:string"/>
                    <xs:attribute name="lookup" type="xs:boolean"/>
                    <xs:attribute name="filterMode" type="filterMode"/>
                    <xs:attribute name="openType" type="openType"/>
                    <xs:attribute name="multiselect" type="xs:boolean"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="button" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="caption" type="resourceString"/>

                    <xs:attributeGroup ref="hasIcon"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="clearButton" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="caption" type="resourceString"/>

                    <xs:attributeGroup ref="hasIcon"/>
                </xs:complexType>
            </xs:element>
        </xs:all>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attributeGroup ref="hasStyle"/>

        <xs:attributeGroup ref="hasEditState"/>
        <xs:attributeGroup ref="hasVisibility"/>

        <xs:attributeGroup ref="hasCaptionSource"/>
        <xs:attributeGroup ref="hasDatasourceProp"/>

        <xs:attribute name="refreshOptionsOnLookupClose" type="xs:boolean"/>
        <xs:attribute name="position" type="tokenListPosition"/>
        <xs:attribute name="inline" type="xs:boolean"/>
        <xs:attribute name="simple" type="xs:boolean"/>
        <xs:attribute name="clearEnabled" type="xs:boolean"/>
    </xs:complexType>

    <!-- WidgetsTree -->
    <xs:complexType name="widgetsTreeComponent">
        <xs:sequence>
            <xs:element name="buttonsPanel" minOccurs="0" maxOccurs="1" type="buttonsPanelComponent"/>
            <xs:element name="items" minOccurs="1" maxOccurs="1">
                <xs:complexType>
                    <xs:attributeGroup ref="hasDatasourceProp"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
    </xs:complexType>

    <!-- TwinColumn -->
    <xs:complexType name="twinColumnComponent">
        <xs:sequence>
            <xs:element name="validator" minOccurs="0" maxOccurs="1" type="validatorType"/>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>

        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attributeGroup ref="hasEditState"/>
        <xs:attributeGroup ref="hasVisibility"/>

        <xs:attributeGroup ref="hasDatasource"/>
        <xs:attributeGroup ref="hasOptions"/>
        <xs:attributeGroup ref="hasCaptionSource"/>
        <xs:attributeGroup ref="hasRequirements"/>

        <xs:attribute name="columns" type="xs:string"/>
        <xs:attribute name="rows" type="xs:string"/>
        <xs:attribute name="addAllBtnEnabled" type="xs:boolean"/>
    </xs:complexType>

    <!-- Layouts && Containers -->

    <!-- HtmlBoxLayout -->
    <xs:complexType name="htmlBoxLayout">
        <xs:group ref="layoutOrComponent"/>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasStyle"/>

        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>

        <xs:attribute name="template" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- BoxLayout -->
    <xs:complexType name="boxLayout">
        <xs:group ref="layoutOrComponent"/>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="isLayoutComponent"/>
    </xs:complexType>

    <!-- FlowBoxLayout -->
    <xs:complexType name="flowBoxLayout">
        <xs:group ref="layoutOrComponent"/>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasSpacingMargin"/>
    </xs:complexType>

    <!-- CssLayout -->
    <xs:complexType name="cssLayout">
        <xs:group ref="layoutOrComponent"/>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasResponsive"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
    </xs:complexType>

    <!-- ScrollBoxLayout -->
    <xs:complexType name="scrollBoxLayout">
        <xs:group ref="layoutOrComponent"/>

        <xs:attributeGroup ref="hasId"/>

        <xs:attribute name="width" type="xs:string"/>
        <xs:attribute name="height" type="xs:string"/>

        <xs:attributeGroup ref="hasGridConstraints"/>

        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasSpacingMargin"/>
        <xs:attributeGroup ref="hasVisibility"/>

        <xs:attribute name="orientation" type="orientation"/>
        <xs:attribute name="scrollBars" type="scrollBars"/>
    </xs:complexType>

    <!-- SplitPanel -->
    <xs:complexType name="splitContainer">
        <xs:sequence minOccurs="2" maxOccurs="2">
            <xs:group ref="layoutOrComponent"/>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>

        <xs:attribute name="orientation" type="orientation"/>
        <xs:attribute name="pos" type="xs:string"/>
        <xs:attribute name="minSplitPosition" type="xs:string"/>
        <xs:attribute name="maxSplitPosition" type="xs:string"/>
        <xs:attribute name="reversePosition" type="xs:boolean"/>
        <xs:attribute name="locked" type="xs:boolean"/>
    </xs:complexType>

    <!-- Tabsheet -->
    <xs:complexType name="tabsheetContainer">
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="tab">
                <xs:complexType>
                    <xs:group ref="layoutOrComponent"/>

                    <xs:attributeGroup ref="requiresId"/>
                    <xs:attributeGroup ref="hasCaption"/>
                    <xs:attributeGroup ref="hasIcon"/>
                    <xs:attributeGroup ref="hasSpacingMargin"/>
                    <xs:attributeGroup ref="hasVisibility"/>
                    <xs:attributeGroup ref="hasEnableProp"/>
                    <xs:attributeGroup ref="hasStyle"/>

                    <xs:attribute name="lazy" type="xs:boolean"/>

                    <xs:attribute name="expand" type="xs:string"/>
                    <xs:attribute name="detachable" type="xs:boolean"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasStyle"/>
    </xs:complexType>

    <!-- Accordion -->
    <xs:complexType name="accordionContainer">
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="tab">
                <xs:complexType>
                    <xs:group ref="layoutOrComponent"/>

                    <xs:attributeGroup ref="requiresId"/>
                    <xs:attributeGroup ref="hasCaption"/>
                    <xs:attributeGroup ref="hasIcon"/>
                    <xs:attributeGroup ref="hasSpacingMargin"/>
                    <xs:attributeGroup ref="hasVisibility"/>
                    <xs:attributeGroup ref="hasEnableProp"/>
                    <xs:attributeGroup ref="hasStyle"/>

                    <xs:attribute name="lazy" type="xs:boolean"/>
                    <xs:attribute name="expand" type="xs:string"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasStyle"/>
    </xs:complexType>

    <!-- GridLayout -->
    <xs:complexType name="gridLayout">
        <xs:sequence>
            <xs:element name="columns" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="column" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                                <xs:attributeGroup ref="hasId"/>

                                <xs:attribute name="flex" type="xs:float"/>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="count" type="xs:int"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="rows" minOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="row" minOccurs="1" maxOccurs="unbounded">
                            <xs:complexType>
                                <xs:group ref="layoutOrComponent"/>

                                <xs:attributeGroup ref="hasId"/>

                                <xs:attribute name="flex" type="xs:float"/>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasSpacingMargin"/>
    </xs:complexType>

    <!-- GroupBox -->
    <xs:complexType name="groupBoxLayout">
        <xs:group ref="layoutOrComponent" minOccurs="0"/>

        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasCaptionProp"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasExpand"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasSpacing"/>

        <xs:attribute name="collapsable" type="xs:boolean"/>
        <xs:attribute name="collapsed" type="xs:boolean"/>
        <xs:attribute name="orientation" type="orientation"/>
    </xs:complexType>

    <!-- Frame -->
    <xs:complexType name="frameContainer">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasVisibility"/>

        <xs:attribute name="src" type="xs:string"/>
        <xs:attribute name="screen" type="xs:string"/>
    </xs:complexType>

    <!-- RuntimeProperty -->
    <xs:complexType name="runtimePropertiesContainer">
        <xs:attributeGroup ref="hasId"/>
        <xs:attributeGroup ref="hasSize"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasVisibility"/>

        <xs:attribute name="runtimeDs" type="xs:string" use="required"/>
        <xs:attribute name="categoriesDs" type="xs:string" use="required"/>
        <xs:attribute name="src" type="xs:string"/>
        <xs:attribute name="cols" type="xs:integer"/>
        <xs:attribute name="rows" type="xs:integer"/>
        <xs:attribute name="fieldWidth" type="xs:string"/>
    </xs:complexType>

    <!-- AccessControl -->
    <xs:complexType name="accessControlContainer">
        <xs:sequence>
            <xs:element name="visible" minOccurs="0" maxOccurs="1" type="accessControlAccessType"/>
            <xs:element name="editable" minOccurs="0" maxOccurs="1" type="accessControlAccessType"/>
            <xs:group ref="layoutOrComponent" minOccurs="0"/>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>

        <xs:attribute name="data" type="xs:string"/>
        <xs:attribute name="param" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="relatedComponent">
        <xs:sequence>
            <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required"/>
                    <xs:attribute name="screen" type="xs:string"/>
                    <xs:attribute name="caption" type="resourceString"/>
                    <xs:attribute name="filterCaption" type="resourceString"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>

        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasIcon"/>
        <xs:attributeGroup ref="hasWidthProp"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasGridConstraints"/>
        <xs:attributeGroup ref="hasAlign"/>

        <xs:attribute name="openType" type="openType"/>
        <xs:attribute name="for" type="xs:string" use="required"/>
        <xs:attribute name="exclude" type="xs:string"/>
        <xs:attribute name="focusable" type="xs:boolean"/>
    </xs:complexType>

    <xs:complexType name="bulkEditorComponent">
        <xs:sequence>
            <xs:element name="validator" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="field" type="xs:string"/>
                    <xs:attribute name="class" type="xs:string"/>
                    <xs:attribute name="script" type="xs:string"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attributeGroup ref="hasId"/>

        <xs:attributeGroup ref="hasCaption"/>
        <xs:attributeGroup ref="hasWidthProp"/>
        <xs:attributeGroup ref="hasEnableProp"/>
        <xs:attributeGroup ref="hasStyle"/>
        <xs:attributeGroup ref="hasVisibility"/>
        <xs:attributeGroup ref="hasWidthProp"/>
        <xs:attributeGroup ref="hasGridConstraints"/>
        <xs:attributeGroup ref="hasAlign"/>
        <xs:attributeGroup ref="hasIcon"/>

        <xs:attribute name="openType" type="openType"/>
        <xs:attribute name="for" type="xs:string" use="required"/>
        <xs:attribute name="exclude" type="xs:string"/>
        <xs:attribute name="focusable" type="xs:boolean"/>
    </xs:complexType>

    <!-- Datasources -->

    <!-- CollectionDatasource -->
    <xs:complexType name="collectionDatasourceType">
        <xs:sequence>
            <xs:element name="query" minOccurs="0" maxOccurs="1">
                <xs:complexType mixed="true">
                    <xs:sequence>
                        <xs:element name="filter" type="filterType" minOccurs="0" maxOccurs="1"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:group ref="nestedDatasources" minOccurs="0"/>
        </xs:sequence>

        <xs:attributeGroup ref="isCollectionDatasource"/>

        <xs:attribute name="query" type="xs:string"/>
        <xs:attribute name="refreshMode" type="refreshMode"/>
        <xs:attribute name="softDeletion" type="xs:boolean"/>
        <xs:attribute name="loadDynamicAttributes" type="xs:boolean" use="optional"/>
    </xs:complexType>

    <!-- HierarchicalDatasource -->
    <xs:complexType name="hierarchicalDatasourceType">
        <xs:sequence>
            <xs:element name="query" minOccurs="0" maxOccurs="1">
                <xs:complexType mixed="true">
                    <xs:sequence>
                        <xs:element name="filter" type="filterType" minOccurs="0" maxOccurs="1"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:group ref="nestedDatasources" minOccurs="0"/>
        </xs:sequence>

        <xs:attributeGroup ref="isCollectionDatasource"/>

        <xs:attribute name="query" type="xs:string"/>
        <xs:attribute name="hierarchyProperty" type="xs:string"/>
        <xs:attribute name="refreshMode" type="refreshMode"/>
        <xs:attribute name="softDeletion" type="xs:boolean"/>
        <xs:attribute name="loadDynamicAttributes" type="xs:boolean" use="optional"/>
    </xs:complexType>

    <!-- GroupDatasource -->
    <xs:complexType name="groupDatasourceType">
        <xs:sequence>
            <xs:element name="query" minOccurs="0" maxOccurs="1">
                <xs:complexType mixed="true">
                    <xs:sequence>
                        <xs:element name="filter" type="filterType" minOccurs="0"
                                    maxOccurs="1"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:group ref="nestedDatasources" minOccurs="0"/>
        </xs:sequence>

        <xs:attributeGroup ref="isCollectionDatasource"/>

        <xs:attribute name="query" type="xs:string"/>
        <xs:attribute name="refreshMode" type="refreshMode"/>
        <xs:attribute name="softDeletion" type="xs:boolean"/>
        <xs:attribute name="loadDynamicAttributes" type="xs:boolean" use="optional"/>
    </xs:complexType>

    <!-- RuntimePropsDatasource -->
    <xs:complexType name="runtimePropsDatasourceType">
        <xs:sequence>
            <xs:group ref="nestedDatasources"/>
        </xs:sequence>

        <xs:attributeGroup ref="requiresId"/>

        <xs:attribute name="mainDs" type="xs:string" use="required"/>
        <xs:attribute name="categorizedEntityClass" type="xs:string" use="optional"/>
    </xs:complexType>

    <!-- PropertyDatasource -->
    <xs:group name="nestedDatasources">
        <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="datasource" minOccurs="0" maxOccurs="unbounded" type="nestedDs"/>
                <xs:element name="collectionDatasource" minOccurs="0" maxOccurs="unbounded" type="nestedDs"/>
                <xs:element name="groupDatasource" minOccurs="0" maxOccurs="unbounded" type="nestedDs"/>
                <xs:element name="hierarchicalDatasource" minOccurs="0" maxOccurs="unbounded"
                            type="nestedHierarchicalDs"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>

    <!-- CollectionPropertyDatasource -->
    <xs:complexType name="nestedDs">
        <xs:sequence>
            <xs:group ref="nestedDatasources"/>
        </xs:sequence>
        <xs:attributeGroup ref="isNestedDatasource"/>
    </xs:complexType>

    <!-- HierarchicalPropertyDatasource -->
    <xs:complexType name="nestedHierarchicalDs">
        <xs:sequence>
            <xs:group ref="nestedDatasources"/>
        </xs:sequence>
        <xs:attributeGroup ref="isNestedDatasource"/>
        <xs:attribute name="hierarchyProperty" type="xs:string"/>
    </xs:complexType>

    <!-- Datasource -->
    <xs:complexType name="datasourceType">
        <xs:sequence>
            <xs:group ref="nestedDatasources"/>
        </xs:sequence>
        <xs:attributeGroup ref="isDatasource"/>
        <xs:attribute name="loadDynamicAttributes" type="xs:boolean" use="optional"/>
    </xs:complexType>

    <!-- Layout -->
    <xs:group name="layout">
        <xs:sequence>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
                <xs:element name="vbox" type="boxLayout"/>
                <xs:element name="hbox" type="boxLayout"/>
                <xs:element name="flowBox" type="flowBoxLayout"/>
                <xs:element name="cssLayout" type="cssLayout"/>

                <xs:element name="htmlBox" type="htmlBoxLayout"/>
                <xs:element name="scrollBox" type="scrollBoxLayout"/>
                <xs:element name="grid" type="gridLayout"/>
                <xs:element name="groupBox" type="groupBoxLayout"/>

                <xs:element name="split" type="splitContainer"/>
                <xs:element name="tabSheet" type="tabsheetContainer"/>
                <xs:element name="accordion" type="accordionContainer"/>
                <xs:element name="frame" type="frameContainer"/>

                <xs:element name="runtimeProperties" type="runtimePropertiesContainer"/>

                <xs:element name="accessControl" type="accessControlContainer"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>

    <!-- Component -->
    <xs:group name="component">
        <xs:sequence>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
                <xs:element name="button" type="buttonComponent"/>
                <xs:element name="linkButton" type="buttonComponent"/>
                <xs:element name="popupButton" type="popupButtonComponent"/>

                <xs:element name="label" type="labelComponent"/>
                <xs:element name="link" type="linkComponent"/>
                <xs:element name="checkBox" type="checkBoxComponent"/>

                <xs:element name="textArea" type="textAreaComponent"/>
                <xs:element name="textField" type="textFieldComponent"/>
                <xs:element name="passwordField" type="passwordFieldComponent"/>
                <xs:element name="richTextArea" type="richTextAreaComponent"/>
                <xs:element name="sourceCodeEditor" type="sourceCodeEditorComponent"/>
                <xs:element name="maskedField" type="maskedFieldComponent"/>

                <xs:element name="dateField" type="dateFieldComponent"/>
                <xs:element name="timeField" type="timeFieldComponent"/>

                <xs:element name="lookupField" type="lookupFieldComponent"/>
                <xs:element name="searchField" type="searchFieldComponent"/>
                <xs:element name="pickerField" type="pickerFieldComponent"/>
                <xs:element name="lookupPickerField" type="lookupPickerFieldComponent"/>
                <xs:element name="searchPickerField" type="searchPickerFieldComponent"/>

                <xs:element name="optionsGroup" type="optionsGroupComponent"/>
                <xs:element name="optionsList" type="optionsListComponent"/>
                <xs:element name="progressBar" type="progressBarComponent"/>

                <xs:element name="upload" type="uploadComponent"/>
                <xs:element name="multiUpload" type="multiuploadComponent"/>
                <xs:element name="embedded" type="embeddedComponent"/>

                <xs:element name="tree" type="treeComponent"/>
                <xs:element name="table" type="tableComponent"/>
                <xs:element name="treeTable" type="tableComponent"/>
                <xs:element name="groupTable" type="groupTableComponent"/>
                <xs:element name="buttonsPanel" type="buttonsPanelComponent"/>

                <xs:element name="filter" type="filterComponent"/>

                <xs:element name="fieldGroup" type="fieldGroupComponent"/>
                <xs:element name="tokenList" type="tokenListComponent"/>
                <xs:element name="widgetsTree" type="widgetsTreeComponent"/>
                <xs:element name="twinColumn" type="twinColumnComponent"/>
                <xs:element name="relatedEntities" type="relatedComponent"/>
                <xs:element name="bulkEditor" type="bulkEditorComponent"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>

    <!-- Inner element choice -->
    <xs:group name="layoutOrComponent">
        <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="component"/>
                <xs:group ref="layout"/>
                <xs:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>

    <!-- Window -->
    <xs:element name="window">
        <xs:complexType>
            <xs:sequence>

                <xs:element name="companions" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="web" type="companionType" minOccurs="0" maxOccurs="1"/>
                            <xs:element name="desktop" type="companionType" minOccurs="0" maxOccurs="1"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="metadataContext" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="deployViews" minOccurs="0" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:attribute name="name" type="xs:string"/>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="view" type="views:viewType" minOccurs="0" maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="dsContext" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:choice minOccurs="0" maxOccurs="unbounded">
                                <xs:element name="datasource" type="datasourceType"/>
                                <xs:element name="groupDatasource" type="groupDatasourceType"/>
                                <xs:element name="collectionDatasource" type="collectionDatasourceType"/>
                                <xs:element name="hierarchicalDatasource" type="hierarchicalDatasourceType"/>
                                <xs:element name="runtimePropsDatasource" type="runtimePropsDatasourceType"/>
                            </xs:choice>
                        </xs:sequence>
                        <xs:attribute name="class" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
                <xs:element name="timers" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:choice minOccurs="1" maxOccurs="unbounded">
                                <xs:element name="timer">
                                    <xs:complexType>
                                        <xs:attribute name="id" type="xs:string"/>
                                        <xs:attribute name="delay" type="xs:integer" use="required"/>
                                        <xs:attribute name="repeating" type="xs:boolean"/>
                                        <xs:attribute name="onTimer" type="xs:string"/>
                                        <xs:attribute name="autostart" type="xs:boolean"/>
                                    </xs:complexType>
                                </xs:element>
                            </xs:choice>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="actions" minOccurs="0" maxOccurs="1" type="frameActions"/>
                <xs:element name="assign" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:attribute name="name" use="required"/>
                        <xs:attribute name="value" use="required"/>
                    </xs:complexType>
                </xs:element>
                
                <xs:element name="dialogMode" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                        <xs:attribute name="width" type="dialogSize"/>
                        <xs:attribute name="height" type="dialogSize"/>

                        <xs:attribute name="closeable" type="xs:boolean"/>
                        <xs:attribute name="resizable" type="xs:boolean"/>
                        <xs:attribute name="modal" type="xs:boolean"/>

                        <xs:attribute name="forceDialog" type="xs:boolean"/>
                    </xs:complexType>
                </xs:element>
                
                <xs:element name="layout" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:group ref="layoutOrComponent"/>
                        <xs:attribute name="expand" type="xs:string"/>

                        <xs:attributeGroup ref="hasSize"/>
                        <xs:attributeGroup ref="hasStyle"/>
                        <xs:attributeGroup ref="hasSpacingMargin"/>
                    </xs:complexType>
                </xs:element>

            </xs:sequence>

            <xs:attribute name="extends" type="xs:string"/>
            <xs:attribute name="class" type="xs:string"/>
            <xs:attribute name="messagesPack" type="xs:string"/>
            <xs:attribute name="lookupComponent" type="xs:string"/>

            <xs:attribute name="datasource" type="xs:string"/>
            <xs:attribute name="dataSupplier" type="xs:string"/>
            <xs:attribute name="caption" type="resourceString"/>
            <xs:attribute name="focusComponent" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="frameActions">
        <xs:sequence>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
                <xs:element name="action" type="frameAction"/>
            </xs:choice>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="componentActions">
        <xs:sequence>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
                <xs:element name="action" type="componentAction"/>
            </xs:choice>
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="columnAlignment">
        <xs:restriction base="xs:string">
            <xs:enumeration value="LEFT"/>
            <xs:enumeration value="RIGHT"/>
            <xs:enumeration value="CENTER"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>