
<?xml version="1.0" encoding="utf-8"?>
<Shell name="TreeModelSelfDefineExample" descriptors="xworker.swt.widgets.Shell" text="自定义树模型示例" RESIZE="true" width="400" height="300">
<Composite name="composite">
<GridLayout name="compositeGridLayout" _xmeta_id_="shellGridLayout"></GridLayout>
<Tree name="tree" FULL_SELECTION="false" HIDE_SELECTION="false" lineVisible="false" multipleColumns="false" headerVisible="false" sortIndicator="false" moveableColumns="false">
<GridData name="treGridData" style="FILL_BOTH"></GridData>
<TreeModels>
<TreeModel name="departmentModel" label="部门树模型" bindToParent="true">
<actions>
<GroovyAction name="getRoot" code="return ["text": "部门", "id":"1"];"></GroovyAction>
<GroovyAction name="getChilds">
<code><![CDATA[if(id == "1"){
return [["text": "商务部", "id":"2"],
["text": "工程部", "id":"3"]];
}else if(id == "2"){
return [["text": "商务部业务部", "id":"4"],
["text": "商务部服务部", "id":"5"]];
}else if(id == "3"){
return [["text": "工程部业务部", "id":"6"],
["text": "工程部服务部", "id":"7"]];
}]]></code>
</GroovyAction>
</actions>
</TreeModel>
</TreeModels>
</Tree>
<StyledText name="text" style="MULTI" WRAP="true" text="通过重载getRoot和getChilds方法实现自定义的树模型。">
<GridData name="textGridData" style="FILL_HORIZONTAL" height="100"></GridData>
</StyledText>
</Composite>
<FillLayout name="shellFillLayout"></FillLayout>
</Shell>