<?xml version="1.0" encoding="utf-8"?> <Shell name="FormSetValuePartialExample" descriptors="xworker.swt.widgets.Shell" text="表单赋值和取值示例" RESIZE="true" width="800" height="700" label="表单部分赋值"> <Composite name="mainComposite" label="Pratial set values"> <GridLayout name="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> </AbstractDataObject> </dataObjects> </DataObjectForm> <FillLayout name="formGroup1FillLayout"></FillLayout> </Group> <Group name="formGroup2" text="表单2"> <GridData name="formGroup2GridData" style="FILL_BOTH"></GridData> <DataObjectForm name="form2"> <dataObjects> <AbstractDataObject name="formExampleDataObject" editCols="1" storeSortDir="ASC" autoInitAction="autoInit"> <attribute name="textArea" label="文本区" inputtype="textarea" colspan="2"></attribute> <attribute name="codeText" label="代码着色文本区" inputtype="codeEditor" colspan="2" inputattrs="codeName=java codeType=java wrap=false fillBoth=true cols= rows="> <default><![CDATA[//Form2拷贝到Form1 //取Form2的表单值 def form2Values = form2.doAction("getValues", actionContext); //赋值到Form1表单 form1.doAction("setValues", actionContext, ["values": form2Values]);]]></default> </attribute> </AbstractDataObject> </dataObjects> </DataObjectForm> <FillLayout name="formGroup2FillLayout"></FillLayout> </Group> <Group name="formGroup3" text="表单3"> <GridData name="formGroup3GridData" _xmeta_id_="formGroup2GridData" style="FILL_BOTH" horizontalSpan="2"></GridData> <DataObjectForm name="form3" _xmeta_id_="form2"> <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="多选框" inputtype="radio"> <value name="1" label="男" value="1"></value> <value name="2" label="女" value="2"></value> </attribute> <attribute name="select" label="下拉选择框" inputtype="select"> <value name="1" label="男" value="1"></value> <value name="2" label="女" value="2"></value> </attribute> <attribute name="selectMulti" label="下拉多选框" 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" rowspan="1"></attribute> <attribute name="codeText" label="代码着色文本区" inputtype="codeEditor" rowspan="3" inputattrs="codeName=java codeType=java wrap=false fillBoth=true cols= rows="></attribute> </AbstractDataObject> </dataObjects> </DataObjectForm> <FillLayout name="formGroup3FillLayout" _xmeta_id_="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="copyForm1ToForm3" _xmeta_id_="23924" text="拷贝Form1到Form3"> <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="form3" partialValue="true" valueVariable="form1.doAction("getValues", actionContext)"></FormSetValues> </Listener> </Listeners> </Button> <Button name="copyFomr2ToForm1" _xmeta_id_="23928" text="拷贝Form2到Form3"> <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); form3.doAction("setPartialValues", actionContext, ["values": form2Values]);]]></code> </GroovyAction> </Listener> </Listeners> </Button> </Composite> <StyledText name="descText" style="MULTI" WRAP="true"> <text><![CDATA[展示了两种对表单局部赋值的方法 1. 从Form1拷贝到Form3,使用FormSetValues模型配置 2. 从Form2拷贝到Form3,使用Groovy脚本代码]]></text> <GridData name="descTextGridData" style="FILL_HORIZONTAL" height="60" horizontalSpan="2"></GridData> </StyledText> </Composite> <FillLayout name="shellFillLayout"></FillLayout> </Shell>
Copyright © 2007-2014 XWorker.org 版权所有