
<?xml version="1.0" encoding="utf-8"?>
<Shell name="FormValidateExample" descriptors="xworker.swt.widgets.Shell" text="表单校验示例" width="400" height="300">
<Composite name="composite" label="Validate">
<GridLayout name="compositeGridLayout" _xmeta_id_="shellGridLayout"></GridLayout>
<DataObjectForm name="form">
<dataObjects>
<AbstractDataObject name="ExampleDataObject" editCols="1" storeSortDir="ASC" autoInitAction="autoInit">
<attribute name="notBlank" label="不为空校验" validateAllowBlank="false" blankText="输入不能为空!"></attribute>
<attribute name="lengthValidate" label="长度校验" invalidText="长度应为3-6个字节。" maxLength="6" minLength="3"></attribute>
<attribute name="number" label="数字校验" type="int" invalidText="请输入1-99之间的数字。" allowDecimals="false" allowNegative="false" maxValue="99" minValue="1"></attribute>
<attribute name="regex" label="正则表达式" regex="^abc.*" regexText="请输入以abc开头的字符串。"></attribute>
<attribute name="desc" label="说明" default="通过设置属性的validate相关的属性值实现表单校验。" inputtype="textarea" inputattrs="codeName= codeType= wrap=true fillBoth=true cols= rows="></attribute>
</AbstractDataObject>
</dataObjects>
<GridData name="formGridData" style="FILL_BOTH"></GridData>
</DataObjectForm>
<Composite name="buttonComposite" _xmeta_id_="32198">
<GridData name="buttonCompositeGridData" _xmeta_id_="32199" style="FILL_HORIZONTAL" horizontalAlignment="END"></GridData>
<RowLayout name="buttonCompositeRowLayout" _xmeta_id_="32200"></RowLayout>
<Button name="validateButton" _xmeta_id_="32201" text="校验表单">
<RowData _xmeta_id_="32202" width="80"></RowData>
<Listeners _xmeta_id_="32203">
<Listener name="validateButtonSelection" _xmeta_id_="32204">
<GroovyAction code="form.doAction("validate", actionContext);"></GroovyAction>
</Listener>
</Listeners>
</Button>
</Composite>
</Composite>
<FillLayout name="shellFillLayout"></FillLayout>
</Shell>