对于下拉列表、下拉多选框、单选框和多选框等,它们需要选择项列表。用于提供选择项列表的称为数据源,数据源设置一般有下面几种方法。
如:
<?xml version='1.0' encoding='utf-8'?>
<attribute name="sex" descriptors="xworker.lang.MetaDescriptor3/@attribute" inputtype="select">
<value name="male" value="male"/>
<value name="female" value="female"/>
</attribute>
如:
<?xml version='1.0' encoding='utf-8'?>
<attribute name="job" descriptors="xworker.lang.MetaDescriptor3/@attribute" inputtype="select">
<actions>
<GroovyAction name="getValues" descriptors="xworker.groovy.GroovyAction">
<code><![CDATA[import org.xmeta.Thing;
def values = [];
def male = new Thing();
male.put("name", "Male");
male.put("value", "male");
values.add(male);
def female = new Thing();
female.put("name", "Female");
female.put("value", "female");
values.add(female);
return values;]]></code>
</GroovyAction>
</actions>
</attribute>
数据对象是一个二维表格数据的框架,是存储和界面的桥梁。通过数据对象可以实现数据的CURD操作,也可以很容易的映射到界面上。
如:
<?xml version='1.0' encoding='utf-8'?>
<attribute name="fontName" descriptors="xworker.lang.MetaDescriptor3/@attribute" inputtype="select"
relationDataObject="xworker.things.p2018.p02.p22.FontNames" relationValueField="name"
relationLabelField="name"/>、

如:
<?xml version='1.0' encoding='utf-8'?>
<attribute name="fontName" descriptors="xworker.lang.MetaDescriptor3/@attribute" inputtype="select"
dataStore="xworker.things.p2018.p02.p22.FontNameStore"/>

Copyright © 2007-2019 XWorker.org 版权所有 沪ICP备08000575号