
<?xml version="1.0" encoding="utf-8"?>
<Shell name="StatiticsQueryExample" descriptors="xworker.swt.widgets.Shell" text="统计查询演示" RESIZE="true" width="640" height="480">
<Composite name="composite">
<GridLayout name="dataObjectCompositeGridLayout" _xmeta_id_="614"></GridLayout>
<DataObjectForm name="queryForm" _xmeta_id_="615" formType="query">
<GridData name="queryFormGridData" _xmeta_id_="616" style="FILL_HORIZONTAL"></GridData>
<dataObjects>
<AbstractDataObject name="formExample" editCols="3" storeSortDir="ASC" autoInitAction="autoInit">
<attribute name="keyword" _xmeta_id_="key" label="关键字"></attribute>
<attribute name="aggregateColumns" label="统计" inputtype="multSelect">
<value name="count" label="条数" value="count"></value>
<value name="thingCount" label="事物数" value="thingCount"></value>
<value name="keywordCount" label="关键字个数" value="keywordCount"></value>
</attribute>
<attribute name="groupColumns" label="分组" inputtype="multSelect">
<value name="keyword" label="按关键字" value="keyword"></value>
</attribute>
</AbstractDataObject>
</dataObjects>
</DataObjectForm>
<Composite name="buttonComposite" _xmeta_id_="617">
<GridData name="buttonCompositeGridData" _xmeta_id_="618" style="FILL_HORIZONTAL" horizontalAlignment="END"></GridData>
<RowLayout name="buttonCompositeRowLayout" _xmeta_id_="619"></RowLayout>
<Button name="queryBtn" _xmeta_id_="620" text="查询">
<RowData _xmeta_id_="621" width="80"></RowData>
<Listeners _xmeta_id_="622">
<Listener name="queryBtnSelection" _xmeta_id_="623">
<DataStoreAction name="query" _xmeta_id_="624" descriptors="xworker.app.view.swt.data.DataStoreAction" storeName="dataStore" method="query" recordSource="DataObjectForm" recordName="queryForm"></DataStoreAction>
</Listener>
</Listeners>
</Button>
</Composite>
<Table name="dataTable" _xmeta_id_="625" BORDER="true">
<GridData name="dataTableGridData" _xmeta_id_="626" style="FILL_BOTH"></GridData>
<DataStore name="dataStore" _xmeta_id_="627" attachToParent="true" autoSave="true" storeSortDir="ASC">
<Listeners _xmeta_id_="628">
<Listener name="ButtonListener" _xmeta_id_="629">
<actions _xmeta_id_="630">
<Enabled name="onLoaded" _xmeta_id_="631" descriptors="xworker.swt.actions.ControlActions/@Enabled" method="disable" controlList="editBtn,deleteBtn,updateBatchBtn"></Enabled>
</actions>
</Listener>
</Listeners>
<dataObjects>
<DbQueryConfig name="QueryDataObject" tableName="tblThingKeywords" dataSource="xworker.ide.db.datasource.XWorkerDataSource" paging="true" pageSize="50" storeSortDir="ASC" autoInitAction="autoInit">
<attribute name="tid" label="标识" fieldName="tid" type="int" key="true" inputtype="label" editable="false"></attribute>
<attribute name="thingId" label="事物标识" fieldName="thingId" type="int"></attribute>
<attribute name="keyword" label="关键字" fieldName="keyword" gridWidth="200"></attribute>
<group name="keyword" _xmeta_id_="关键字" fieldName="keyword" label="按关键字"></group>
<aggregate name="count" fieldName="count(*)" label="条数"></aggregate>
<aggregate name="thingCount" fieldName="count(distinct thingId)" label="事物数" type="int"></aggregate>
<aggregate name="keywordCount" fieldName="count(distinct keyword)" label="关键字个数" type="int"></aggregate>
</DbQueryConfig>
</dataObjects>
<queryConfig descriptors="xworker.app.view.swt.data.DataStore/@Condition,xworker.app.view.swt.widgets.DataObjectEditCompoiste/@Condition" label="keyword" attributeName="keyword" dataName="keyword" operator="10"></queryConfig>
</DataStore>
<Listeners _xmeta_id_="632">
<Listener name="dataTableSelection" _xmeta_id_="633">
<Enabled name="enableButton" _xmeta_id_="634" descriptors="xworker.swt.actions.ControlActions/@Enabled" controlList="editBtn,deleteBtn,updateBatchBtn" varScope="Global"></Enabled>
</Listener>
</Listeners>
</Table>
<PagingToolbar name="pageingToolbar" _xmeta_id_="635" store="dataStore">
<GridData name="pagingToolbarGridData" _xmeta_id_="636" style="FILL_HORIZONTAL"></GridData>
</PagingToolbar>
<StyledText name="desc" style="MULTI" READ_ONLY="true" WRAP="true" BORDER="true">
<text><![CDATA[本示例是一个普通的查询统计示例,没有选择分组时是对一个数据库表的普通查询,当选择分组时是汇总统计查询。
1. 表单用于查询条件的录入,统计字段用于选择汇总统计的字段,分组用于选择分组的字段。
2. 使用DataStore的load方法查询,表单的数据作为参数传入。
3. 本示例使用了DataStoreAction执行查询操作,只要配置表单名和DataStore名就可以了。]]></text>
<GridData name="descGridData" style="FILL_HORIZONTAL" height="100"></GridData>
</StyledText>
</Composite>
<FillLayout name="shellFillLayout"></FillLayout>
</Shell>
Copyright © 2007-2014 XWorker.org 版权所有