步驟一:
編寫聯(lián)查實現(xiàn)類 ReportTraceDataOperator.java
注意事項:
實現(xiàn)接口:ItraceDataOperator,TraceDataInterface
說明:聯(lián)查操作接口嗜价,也就是如何進行聯(lián)查,目前定義了三個操作崩侠,主要需要實現(xiàn)前兩個:
方法1:執(zhí)行數(shù)據(jù)追蹤 各業(yè)務(wù)模塊根據(jù)需求執(zhí)行追蹤操作
public void traceData(Container container, TraceDataParam
param);
方法2:業(yè)務(wù)聯(lián)查的菜單
public IMenuActionInfo getMenuItemInfo();
代碼如下:
package nc.ui.bd.defdoc.freereport;
import java.awt.Container;
import javax.swing.Action;
import nc.funcnode.ui.FuncletInitData;
import nc.funcnode.ui.FuncletWindowLauncher;
import nc.pub.smart.data.IRowData;
import nc.pub.smart.tracedata.ITraceDataOperator;
import nc.pub.smart.tracedata.TraceDataInterface;
import nc.pub.smart.tracedata.TraceDataParam;
import nc.ui.pub.linkoperate.ILinkQueryData;
import nc.ui.pub.linkoperate.ILinkType;
import nc.ui.sm.power.FuncRegisterCacheAccessor;
import nc.vo.sm.funcreg.FuncRegisterVO;
import nc.vo.train.entity.QuotationHVO;
import com.ufida.report.free.userdef.DefaultMenu;
import com.ufida.report.free.userdef.IMenuActionInfo;
/**
* 聯(lián)查單據(jù)的實現(xiàn)
*
* @author: zjb
*/
public class ReportTraceDataOperator implements ITraceDataOperator,
TraceDataInterface {
public final static String DEST_FUNC_CODE = "TR1001";
public final static String PK_HEAD = QuotationHVO.PK_SALEQUOTATION;
@Override
public Action[] ctreateExtensionActions() {
return null; // new Action[]{new MyAction()};
}
@Override
public ITraceDataOperator[] provideTraceDataOperator() {
return new ITraceDataOperator[] { new ReportTraceDataOperator() };
}
@Override
public void traceData(Container container, TraceDataParam param) {
// 獲得選中表體行的PK
final IRowData rowData = param.getRowData();
String selItem0 = (String) rowData.getData(PK_HEAD);
final String selItem = (selItem0 == null) ? "" : selItem0;
// JOptionPane.showMessageDialog(container, "單據(jù)PK:" + selItem);
// 構(gòu)造傳遞數(shù)據(jù)參數(shù)
FuncletInitData fid = new FuncletInitData();
fid.setInitType(ILinkType.LINK_TYPE_QUERY);
ILinkQueryData data = new ILinkQueryData() {
public String getBillID() {
return selItem;
}
public String getBillType() {
return null;
}
public String getPkOrg() {
return null;
}
public Object getUserObject() {
return rowData;
}
};
fid.setInitData(data);
// 獲得功能VO參數(shù)
FuncRegisterVO vo = FuncRegisterCacheAccessor.getInstance()
.getFuncRegisterVOByFunCode(DEST_FUNC_CODE);
// 彈出目標單據(jù)
FuncletWindowLauncher.openFuncNodeInTabbedPane(container, vo, fid,
null, false);
}
@Override
public IMenuActionInfo getMenuItemInfo() {
return new DefaultMenu("Linkquery", "聯(lián)查單據(jù)");
}
}
步驟二:
編寫聯(lián)查節(jié)點畫面顯示類:DemoFuncNodeInitDataListener.java
注意事項:
1.需要添加節(jié)點畫面的xml配置惊奇,這個監(jiān)聽類要有原來監(jiān)聽類的功能,例子如下:
<!--
<bean id="InitDataListener"
class="nc.ui.bd.defdoc.DefdocFuncNodeInitDataListener">
<property name="datamanager" ref="modelDataManager" />
</bean>
-->
<!-- -->
<bean id="InitDataListener"
class="nc.ui.bd.defdoc.freereport.DemoFuncNodeInitDataListener">
<!-- 原來注冊的 -->
<property name="datamanager" ref="modelDataManager" />
<!-- 必須添加 -->
<property name="model" ref="HAppModel"></property>
<property name="context" ref="context" />
<!-- VO的類名 -->
<property name="voClassName" value="nc.vo.bd.defdoc.DefdocVO"/>
<!-- 非必須 用來顯示畫面結(jié)果-->
<property name="ui" ref="billFormEditor" />
<property name="autoShowUpComponent" ref="billFormEditor"/>
</bean>
代碼如下 其中畫面顯示的問題要自己寫:
package nc.icd.test.freereport;
import nc.funcnode.ui.FuncletInitData;
import nc.pub.smart.data.IRowData;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillScrollPane.BillTable;
import nc.ui.pub.linkoperate.ILinkQueryData;
import nc.ui.pub.linkoperate.ILinkType;
import nc.ui.pubapp.uif2app.model.DefaultFuncNodeInitDataListener;
import nc.ui.pubapp.uif2app.view.ShowUpableBillForm;
import nc.vo.train.entity.QuotationBVO;
/**
* 業(yè)務(wù)聯(lián)查打開單據(jù)的監(jiān)聽,類名需要配置到_config.xml
*
* @author: zjb
*/
public class DemoFuncNodeInitDataListener extends
DefaultFuncNodeInitDataListener {
public final static String PK_BODY = QuotationBVO.PK_SALEQUOTATION_B;
private ShowUpableBillForm ui;
public ShowUpableBillForm getUi() {
return ui;
}
public void setUi(ShowUpableBillForm ui) {
this.ui = ui;
}
@Override
public void initData(FuncletInitData data) {
super.initData(data);
// 聯(lián)查處理
if (data != null && data.getInitType() == ILinkType.LINK_TYPE_QUERY) {
// 獲得表體行PK
ILinkQueryData linkData = (ILinkQueryData) data.getInitData();
Object obj = linkData.getUserObject();
if (obj instanceof IRowData) {
IRowData rowData = (IRowData) obj;
String pkDetail = (String) rowData.getData(PK_BODY);
// 獲得表體面板
BillCardPanel panel = ui.getBillCardPanel();
// 選中表體行
BillTable table = panel.getBodyPanel().getTable();
int iRowCount = table.getRowCount();
int iColCount = table.getColumnCount();
for (int i = 0; i < iRowCount; i++) {
String rowPkDetail = (String) panel.getBodyValueAt(i,
PK_BODY);
if (rowPkDetail != null
&& rowPkDetail.equalsIgnoreCase(pkDetail)) {
table.setRowSelectionInterval(i, i);
table.setColumnSelectionInterval(0, iColCount - 1);
break;
}
}
}
}
}
}
步驟三:
聯(lián)查信息的注冊
首先將接口TraceDataInterface
的實現(xiàn)類注冊到iufo_tracedataregister
表中唆貌。
insert into iufo_tracedataregister
(CLASSNAME, CREATIONTIME, CREATOR, DR, MODIFIEDTIME, MODIFIER, MODULENAME, PK_GROUP, PK_ORG, PK_TRACEDATA, RESDIR, RESID, TRACEDATANAME, TS)
values ('nc.ui.bd.defdoc.freereport.ReportTraceDataOperator', '', 'fenggf ', 0, '', '', 'riamm', '', '', 'TRACEDATA10000000011', '', '', 'ReportTraceDataOperator', '2011-07-04 15:22:32');
需要填寫的有四個地方谣蠢,從左到右依次為:
CLASSNAME
: 聯(lián)查的實現(xiàn)類StoreReqLinkQuery
MODULENAME
: 模塊名【pu】(可大寫小寫)
PK_TRACEDATA
: 這條 聯(lián)查記錄對應(yīng)的pk粟耻,必須寫,位數(shù)跟我的保持一致即可眉踱,內(nèi)容可以隨便寫
TRACEDATANAME
:聯(lián)查記錄對應(yīng)的顯示名挤忙,在語義模型那設(shè)置業(yè)務(wù)擴展聯(lián)查時的顯示名
步驟四:
語預(yù)模型中工具 =》 業(yè)務(wù)擴展 中添加聯(lián)查實現(xiàn)類
自由報表添加隱藏字段:
然后報表聯(lián)查節(jié)點就完成了,過程中的錯誤就需要自己調(diào)試谈喳。