| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- FIXED: Simple UI Layout Definition Example v1.3 -->
- <ui-layout-def xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="ui-layout-definition ui-layout-def.xsd"
- version="1.3"
- schema-version="1.3"
- target-platform="basic"
- accessibility-compliance="wcag-aa">
-
- <!-- Simple validation rules -->
- <validation-rules>
- <custom-validator name="RequiredFieldValidator" version="1.0" category="basic">
- <description>Validates that required fields have content</description>
- <implementation>
- <rule-expression expression="string-length(@text) > 0 or @required != 'true'" language="xpath" />
- </implementation>
- <test-case name="required-field-with-content">
- <input><TextBox text="Hello World" required="true" /></input>
- <expected-result>pass</expected-result>
- </test-case>
- <test-case name="required-field-empty">
- <input><TextBox text="" required="true" /></input>
- <expected-result>fail</expected-result>
- <expected-message>This field is required</expected-message>
- </test-case>
- </custom-validator>
- </validation-rules>
-
- <!-- Basic control patterns -->
- <patterns>
- <!-- Define basic controls used in windows -->
- <control name="Label" type="display" category="basic">
- <description>Simple text display control</description>
- <attributes>
- <attribute name="text" type="string" default="" />
- <attribute name="font" type="font" default="Default" />
- <attribute name="color" type="color" default="Black" />
- </attributes>
- <behavior>
- <event name="click" />
- </behavior>
- </control>
-
- <control name="TextBox" type="input" category="basic">
- <description>Text input control</description>
- <attributes>
- <attribute name="text" type="string" default="" />
- <attribute name="placeholder" type="string" default="" />
- <attribute name="required" type="bool" default="false" />
- <attribute name="maxlength" type="int" default="255" />
- </attributes>
- <behavior>
- <event name="textchanged" />
- <event name="focus" />
- <event name="blur" />
- </behavior>
- <validation>
- <rule name="required-validation" type="required" message="This field is required" severity="error" />
- </validation>
- </control>
-
- <control name="Button" type="button" category="basic">
- <description>Clickable button control</description>
- <attributes>
- <attribute name="text" type="string" default="Button" />
- <attribute name="enabled" type="bool" default="true" />
- </attributes>
- <behavior>
- <event name="click" />
- </behavior>
- </control>
-
- <control name="Panel" type="container" category="basic">
- <description>Container for other controls</description>
- <attributes>
- <attribute name="width" type="int" default="200" />
- <attribute name="height" type="int" default="100" />
- <attribute name="background" type="color" default="Transparent" />
- </attributes>
- <behavior>
- <event name="resize" />
- </behavior>
- </control>
-
- <!-- Simple layout structure -->
- <structure name="SimpleForm" type="layout" category="layout">
- <description>Basic form layout with label and input pairs</description>
- <attributes>
- <attribute name="title" type="string" default="Form" />
- <attribute name="width" type="int" default="300" />
- <attribute name="height" type="int" default="200" />
- </attributes>
- <template>
- <Panel name="formContainer" width="{width}" height="{height}" background="White">
- <Label name="titleLabel" text="{title}" font="Bold,14" />
- <!-- Content will be inserted here -->
- </Panel>
- </template>
- </structure>
- </patterns>
-
- <!-- Simple window definition -->
- <window name="SimpleContactForm">
- <attributes>
- <attribute name="title" value="Contact Information" />
- <attribute name="width" value="400" />
- <attribute name="height" value="300" />
- <attribute name="resizable" value="true" />
- </attributes>
-
- <template>
- <Panel name="mainPanel" width="380" height="260" background="LightGray">
-
- <!-- Header -->
- <Label name="headerLabel" text="Please enter your contact information"
- font="Bold,12" color="DarkBlue" />
-
- <!-- Name field -->
- <Label name="nameLabel" text="Full Name:" />
- <TextBox name="nameTextBox" placeholder="Enter your full name"
- required="true" maxlength="100" />
-
- <!-- Email field -->
- <Label name="emailLabel" text="Email Address:" />
- <TextBox name="emailTextBox" placeholder="Enter your email"
- required="true" maxlength="255" />
-
- <!-- Phone field -->
- <Label name="phoneLabel" text="Phone Number:" />
- <TextBox name="phoneTextBox" placeholder="Enter your phone number"
- maxlength="20" />
-
- <!-- Buttons -->
- <Panel name="buttonPanel" width="350" height="40" background="Transparent">
- <Button name="submitButton" text="Submit" enabled="true" />
- <Button name="cancelButton" text="Cancel" enabled="true" />
- <Button name="clearButton" text="Clear" enabled="true" />
- </Panel>
- </Panel>
- </template>
- </window>
-
- <!-- Inherited window example -->
- <window name="BusinessContactForm" inherits="SimpleContactForm">
- <attributes>
- <attribute name="title" value="Business Contact Information" override="true" />
- <attribute name="height" value="350" override="true" />
- </attributes>
-
- <template>
- <Panel name="mainPanel" width="380" height="310" background="LightGray">
-
- <!-- Header -->
- <Label name="headerLabel" text="Please enter your business contact information"
- font="Bold,12" color="DarkBlue" />
-
- <!-- Name field -->
- <Label name="nameLabel" text="Full Name:" />
- <TextBox name="nameTextBox" placeholder="Enter your full name"
- required="true" maxlength="100" />
-
- <!-- Company field (new) -->
- <Label name="companyLabel" text="Company:" />
- <TextBox name="companyTextBox" placeholder="Enter your company name"
- required="true" maxlength="100" />
-
- <!-- Email field -->
- <Label name="emailLabel" text="Business Email:" />
- <TextBox name="emailTextBox" placeholder="Enter your business email"
- required="true" maxlength="255" />
-
- <!-- Phone field -->
- <Label name="phoneLabel" text="Business Phone:" />
- <TextBox name="phoneTextBox" placeholder="Enter your business phone"
- required="true" maxlength="20" />
-
- <!-- Buttons -->
- <Panel name="buttonPanel" width="350" height="40" background="Transparent">
- <Button name="submitButton" text="Submit" enabled="true" />
- <Button name="cancelButton" text="Cancel" enabled="true" />
- <Button name="clearButton" text="Clear" enabled="true" />
- </Panel>
- </Panel>
- </template>
- </window>
-
- </ui-layout-def>
|