我想设计一个报告来显示客户数据(客户代码,名称),标题链接应该是可排序的。 我正在使用Scripted数据源。 我实现了一个CustomerHandler类,如下所示:
CustomerHandler类:
public class CustomerHandler extends ScriptedDataSetEventAdapter {
List<CustomerBean> customerList;
Iterator itr = null;
int i = 0;
CustomerBean bean;
@Override
public void beforeOpen(IDataSetInstance dataSet,
IReportContext reportContext) throws ScriptException {
// TODO Auto-generated method stub
super.beforeOpen(dataSet, reportContext);
customerList = new ArrayList<CustomerBean>();
customerList.add(new CustomerBean("DIVERS","Diversified Ridder"));
customerList.add(new CustomerBean("Pranav","Pranav Kumar"));
customerList.add(new CustomerBean("Jyoti","jyoi kar"));
}
@Override
public void open(IDataSetInstance dataSet) throws ScriptException {
// TODO Auto-generated method stub
super.open(dataSet);
if(customerList != null && customerList.size() > 0)
bean = customerList.get(i);
}
@Override
public boolean fetch(IDataSetInstance dataSet, IUpdatableDataSetRow row)
throws ScriptException {
if(i == customerList.size()) {
//System.out.println("Last:::"+bean.getCustCode());
//row.setColumnValue("CUST_CODE", bean.getCustCode());
return false;
}
row.setColumnValue("CUST_CODE", bean.getCustCode());
row.setColumnValue("NAME", bean.getName());
//System.out.println(bean.getCustCode());
i++;
if(i < customerList.size()) bean = customerList.get(i);
return true; // to indicate that more rows to follow
}
}
此外,我在这里附上了我的customer.rptdesign文件。当我单击表中的“Cust code”或“Name”标题链接时,它显示错误:
Error.ScriptClassCastError(8次)详情: org.eclipse.birt.report.engine.api.EngineException:Class com.mindfire.birt.handler.CustomerHandler没有实现 org.eclipse.birt.report.engine.api.script.eventhandler.IScriptedDataSetEventHandler 接口。 (元素ID:71)
我的处理程序类扩展了“ScriptedDataSetEventAdapter”。此错误仅发生在我的Web应用程序中。当我在eclipse中预览我的设计时,标题链接会起作用。
请让我知道我在做什么。
由于 - Pranav