
<?xml version="1.0" encoding="utf-8"?>
<Shell name="shell" descriptors="xworker.swt.widgets.Shell" text="表单赋值和取值示例" RESIZE="true" width="800" height="600" label="FormSetGetValueExample">
<FillLayout name="shellFillLayout"></FillLayout>
<Composite name="mainComposite" label="Form set and get values">
<GridLayout name="compositeGirdLayout" _xmeta_id_="shellGirdLayout" numColumns="2"></GridLayout>
<Group name="fromGroup1" text="表单1">
<GridData name="formGroup1GridData" style="FILL_BOTH"></GridData>
<DataObjectForm name="form1">
<dataObjects>
<AbstractDataObject name="formExampleDataObject" editCols="1" storeSortDir="ASC" autoInitAction="autoInit">
<attribute name="textField" label="文本框"></attribute>
<attribute name="checkBox" label="单选框" inputtype="truefalse"></attribute>
<attribute name="radioButton" label="多选框" default="1" inputtype="radio">
<value name="1" label="男" value="1"></value>
<value name="2" label="女" value="2"></value>
</attribute>
<attribute name="select" label="下拉选择框" default="2" inputtype="select">
<value name="1" label="男" value="1"></value>
<value name="2" label="女" value="2"></value>
</attribute>
<attribute name="selectMulti" label="下拉多选框" default="1,2" inputtype="multSelect">
<value name="1" label="男" value="1"></value>
<value name="2" label="女" value="2"></value>
</attribute>
<attribute name="datePick" label="日期选择器" inputtype="datePick"></attribute>
<attribute name="textArea" label="文本区" inputtype="textarea" colspan="2">
<default><![CDATA[//Form1拷贝到Form2的方法,使用FormSetValues模型
<?xml version="1.0" ?>
<FormSetValues name="FormSetValues"
//设置到Form2
formName="form2" partialValue="false"
//取Form1的值
valueVariable="form1.doAction("getValues", actionContext)"
descriptors="xworker.app.view.swt.widgets.form.DataObjectFormActions/@FormSetValues"
th_createIndex="false">
</FormSetValues>]]></default>
</attribute>
<attribute name="codeText" label="代码着色文本区" inputtype="codeEditor" colspan="2"
inputattrs="codeName=java codeType=java wrap=false fillBoth=true cols= rows="></attribute>
</AbstractDataObject>
</dataObjects>
</DataObjectForm>
<FillLayout name="formGroup1FillLayout"></FillLayout>
</Group>
<Group name="formGroup2" text="表单2">
<GridData name="formGroup2GridData" style="FILL_BOTH"></GridData>
<DataObjectForm name="form2"
dataObject="xworker.example.app.form.swt.FormSetGetValueExample/@mainComposite/@fromGroup1/@form1/@dataObjects/@formExampleDataObject"></DataObjectForm>
<FillLayout name="formGroup2FillLayout"></FillLayout>
</Group>
<Composite name="buttonComposite" _xmeta_id_="23921">
<GridData name="buttonCompositeGridData" _xmeta_id_="23922" style="FILL_HORIZONTAL" horizontalAlignment="END" horizontalSpan="2"></GridData>
<RowLayout name="buttonCompositeRowLayout" _xmeta_id_="23923"></RowLayout>
<Button name="copyForm1ToForm2" _xmeta_id_="23924" text="拷贝Form1到Form2">
<RowData _xmeta_id_="23925" width="180"></RowData>
<Listeners _xmeta_id_="23926">
<Listener name="copyForm1ToForm2Selection" _xmeta_id_="23927">
<FormSetValues descriptors="xworker.app.view.swt.widgets.form.DataObjectFormActions/@FormSetValues"
formName="form2" valueVariable="form1.doAction("getValues", actionContext)"></FormSetValues>
</Listener>
</Listeners>
</Button>
<Button name="copyFomr2ToForm1" _xmeta_id_="23928" text="拷贝Form2到Form1">
<RowData _xmeta_id_="23929" width="180"></RowData>
<Listeners _xmeta_id_="23930">
<Listener name="copyFomr2ToForm1Selection" _xmeta_id_="23931">
<GroovyAction>
<code><![CDATA[def form2Values = form2.doAction("getValues", actionContext);
form1.doAction("setValues", actionContext, ["values": form2Values]);]]></code>
</GroovyAction>
</Listener>
</Listeners>
</Button>
</Composite>
<StyledText name="descText" style="MULTI" WRAP="true">
<text><![CDATA[展示了两种从表单取值和赋值的方法
1. 从Form1拷贝到Form2,使用FormSetValues模型配置
2. 从Form2拷贝到Form1,使用Groovy脚本代码]]></text>
<GridData name="descTextGridData" style="FILL_HORIZONTAL" height="60" horizontalSpan="2"></GridData>
</StyledText>
</Composite>
</Shell>