顧客データ (顧客コード、名前) を表示するレポートを設計したいと考えており、ヘッダー リンクは並べ替え可能にする必要があります。スクリプト データ ソースを使用しています。以下のような 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 ファイルをここに添付します。表の「顧客コード」または「名前」ヘッダー リンクをクリックすると、次のエラーが表示されます。
Error.ScriptClassCastError (8 回) 詳細: org.eclipse.birt.report.engine.api.EngineException: クラス com.mindfire.birt.handler.CustomerHandler は org.eclipse.birt.report.engine を実装していません。 api.script.eventhandler.IScriptedDataSetEventHandler インターフェイス。(要素ID:71)
私のハンドラ クラスは、「ScriptedDataSetEventAdapter」を拡張します。このエラーは、私の Web アプリケーションでのみ発生します。Eclipse でデザインをプレビューすると、ヘッダー リンクが機能します。
私が何をしているのか教えてください。
ありがとう - プラナフ