sample-minimal.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- FIXED: Simple UI Layout Definition Example v1.3 -->
  3. <ui-layout-def xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="ui-layout-definition ui-layout-def.xsd"
  5. version="1.3"
  6. schema-version="1.3"
  7. target-platform="basic"
  8. accessibility-compliance="wcag-aa">
  9. <!-- Simple validation rules -->
  10. <validation-rules>
  11. <custom-validator name="RequiredFieldValidator" version="1.0" category="basic">
  12. <description>Validates that required fields have content</description>
  13. <implementation>
  14. <rule-expression expression="string-length(@text) > 0 or @required != 'true'" language="xpath" />
  15. </implementation>
  16. <test-case name="required-field-with-content">
  17. <input><TextBox text="Hello World" required="true" /></input>
  18. <expected-result>pass</expected-result>
  19. </test-case>
  20. <test-case name="required-field-empty">
  21. <input><TextBox text="" required="true" /></input>
  22. <expected-result>fail</expected-result>
  23. <expected-message>This field is required</expected-message>
  24. </test-case>
  25. </custom-validator>
  26. </validation-rules>
  27. <!-- Basic control patterns -->
  28. <patterns>
  29. <!-- Define basic controls used in windows -->
  30. <control name="Label" type="display" category="basic">
  31. <description>Simple text display control</description>
  32. <attributes>
  33. <attribute name="text" type="string" default="" />
  34. <attribute name="font" type="font" default="Default" />
  35. <attribute name="color" type="color" default="Black" />
  36. </attributes>
  37. <behavior>
  38. <event name="click" />
  39. </behavior>
  40. </control>
  41. <control name="TextBox" type="input" category="basic">
  42. <description>Text input control</description>
  43. <attributes>
  44. <attribute name="text" type="string" default="" />
  45. <attribute name="placeholder" type="string" default="" />
  46. <attribute name="required" type="bool" default="false" />
  47. <attribute name="maxlength" type="int" default="255" />
  48. </attributes>
  49. <behavior>
  50. <event name="textchanged" />
  51. <event name="focus" />
  52. <event name="blur" />
  53. </behavior>
  54. <validation>
  55. <rule name="required-validation" type="required" message="This field is required" severity="error" />
  56. </validation>
  57. </control>
  58. <control name="Button" type="button" category="basic">
  59. <description>Clickable button control</description>
  60. <attributes>
  61. <attribute name="text" type="string" default="Button" />
  62. <attribute name="enabled" type="bool" default="true" />
  63. </attributes>
  64. <behavior>
  65. <event name="click" />
  66. </behavior>
  67. </control>
  68. <control name="Panel" type="container" category="basic">
  69. <description>Container for other controls</description>
  70. <attributes>
  71. <attribute name="width" type="int" default="200" />
  72. <attribute name="height" type="int" default="100" />
  73. <attribute name="background" type="color" default="Transparent" />
  74. </attributes>
  75. <behavior>
  76. <event name="resize" />
  77. </behavior>
  78. </control>
  79. <!-- Simple layout structure -->
  80. <structure name="SimpleForm" type="layout" category="layout">
  81. <description>Basic form layout with label and input pairs</description>
  82. <attributes>
  83. <attribute name="title" type="string" default="Form" />
  84. <attribute name="width" type="int" default="300" />
  85. <attribute name="height" type="int" default="200" />
  86. </attributes>
  87. <template>
  88. <Panel name="formContainer" width="{width}" height="{height}" background="White">
  89. <Label name="titleLabel" text="{title}" font="Bold,14" />
  90. <!-- Content will be inserted here -->
  91. </Panel>
  92. </template>
  93. </structure>
  94. </patterns>
  95. <!-- Simple window definition -->
  96. <window name="SimpleContactForm">
  97. <attributes>
  98. <attribute name="title" value="Contact Information" />
  99. <attribute name="width" value="400" />
  100. <attribute name="height" value="300" />
  101. <attribute name="resizable" value="true" />
  102. </attributes>
  103. <template>
  104. <Panel name="mainPanel" width="380" height="260" background="LightGray">
  105. <!-- Header -->
  106. <Label name="headerLabel" text="Please enter your contact information"
  107. font="Bold,12" color="DarkBlue" />
  108. <!-- Name field -->
  109. <Label name="nameLabel" text="Full Name:" />
  110. <TextBox name="nameTextBox" placeholder="Enter your full name"
  111. required="true" maxlength="100" />
  112. <!-- Email field -->
  113. <Label name="emailLabel" text="Email Address:" />
  114. <TextBox name="emailTextBox" placeholder="Enter your email"
  115. required="true" maxlength="255" />
  116. <!-- Phone field -->
  117. <Label name="phoneLabel" text="Phone Number:" />
  118. <TextBox name="phoneTextBox" placeholder="Enter your phone number"
  119. maxlength="20" />
  120. <!-- Buttons -->
  121. <Panel name="buttonPanel" width="350" height="40" background="Transparent">
  122. <Button name="submitButton" text="Submit" enabled="true" />
  123. <Button name="cancelButton" text="Cancel" enabled="true" />
  124. <Button name="clearButton" text="Clear" enabled="true" />
  125. </Panel>
  126. </Panel>
  127. </template>
  128. </window>
  129. <!-- Inherited window example -->
  130. <window name="BusinessContactForm" inherits="SimpleContactForm">
  131. <attributes>
  132. <attribute name="title" value="Business Contact Information" override="true" />
  133. <attribute name="height" value="350" override="true" />
  134. </attributes>
  135. <template>
  136. <Panel name="mainPanel" width="380" height="310" background="LightGray">
  137. <!-- Header -->
  138. <Label name="headerLabel" text="Please enter your business contact information"
  139. font="Bold,12" color="DarkBlue" />
  140. <!-- Name field -->
  141. <Label name="nameLabel" text="Full Name:" />
  142. <TextBox name="nameTextBox" placeholder="Enter your full name"
  143. required="true" maxlength="100" />
  144. <!-- Company field (new) -->
  145. <Label name="companyLabel" text="Company:" />
  146. <TextBox name="companyTextBox" placeholder="Enter your company name"
  147. required="true" maxlength="100" />
  148. <!-- Email field -->
  149. <Label name="emailLabel" text="Business Email:" />
  150. <TextBox name="emailTextBox" placeholder="Enter your business email"
  151. required="true" maxlength="255" />
  152. <!-- Phone field -->
  153. <Label name="phoneLabel" text="Business Phone:" />
  154. <TextBox name="phoneTextBox" placeholder="Enter your business phone"
  155. required="true" maxlength="20" />
  156. <!-- Buttons -->
  157. <Panel name="buttonPanel" width="350" height="40" background="Transparent">
  158. <Button name="submitButton" text="Submit" enabled="true" />
  159. <Button name="cancelButton" text="Cancel" enabled="true" />
  160. <Button name="clearButton" text="Clear" enabled="true" />
  161. </Panel>
  162. </Panel>
  163. </template>
  164. </window>
  165. </ui-layout-def>