
<?xml version="1.0" encoding="utf-8"?>
<Shell name="TreeModelDynamicExample" 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" loadBackground="true">
<actions>
<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>
<Root name="rootItem" label="部门" tabId="1" id="1" text="部门"></Root>
</TreeModel>
</TreeModels>
</Tree>
<StyledText name="text" style="MULTI" WRAP="true" text="通过重载树模型的getChilds方法实现动态树模型,请参看示例。">
<GridData name="textGridData" style="FILL_HORIZONTAL" height="100"></GridData>
</StyledText>
</Composite>
<FillLayout name="shellFillLayout"></FillLayout>
</Shell>