<?xml version="1.0" encoding="gb2312"?>

<!-- RSS generated by oioj.net on 4/16/2004 ; 感谢LeXRus提供 RSS 2.0 文档; 此文件可自由使用，但请保留此行信息 --> 
<!-- Source download URL: http://blogger.org.cn/blog/rss2.asp       -->
<rss version="2.0">

<channel>
<title>KENWOOD</title>
<link>http://blogger.org.cn/blog/blog.asp?name=kenwoodtriger</link>
<description>Triger的博客</description>
<copyright>blogger.org.cn</copyright>
<generator>W3CHINA Blog</generator>
<webMaster>webmaster@blogger.org.cn</webMaster>
<item>
<title><![CDATA[今天是星期一]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17254</link>
<author>kenwoodtriger</author>
<pubDate>2006/8/7 10:12:41</pubDate>
<description><![CDATA[我的心提不起精神,
今天我怎么啦.我的人生到底何时才有安全感啊!]]></description>
</item><item>
<title><![CDATA[心花怒放]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17171</link>
<author>kenwoodtriger</author>
<pubDate>2006/8/4 9:43:19</pubDate>
<description><![CDATA[今天天气唔错，中山的暴风雨将炎热、烦闷赶得一干二净，心情好多了。
唯一令我担心的是，这星期会不会同PL吵架呢。
 上帝，保佑我！

        阿门！]]></description>
</item><item>
<title><![CDATA[心情随风飞]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17162</link>
<author>kenwoodtriger</author>
<pubDate>2006/8/3 17:10:04</pubDate>
<description><![CDATA[今天有暴风雨，天气凉爽，
心情唔错，好好睡一觉，
明天冲锋芒....]]></description>
</item><item>
<title><![CDATA[如何在BIRT中定义SCRIPT数据集并用JAVA调用它]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17161</link>
<author>kenwoodtriger</author>
<pubDate>2006/8/3 17:07:38</pubDate>
<description><![CDATA[第一步：定义一下JAVA,class
第二步:定义一个LIST
第三步：在BIRT报表的DATASET事件中(open)中输入
count = 0;
cf = new Packages.user.ContactListFactory();
c = cf.createContactList();
第五步：在BIRT报表的DATASET事件中(CLOSE)中输入
cf=null;
c=null;
第五步：在BIRT报表的DATASET事件中(FETCH)中输入

if (count &lt;= c.length-1){
	row[&quot;columnFirstName&quot;]  = c[count].getFname();
	row[&quot;columnLastName&quot;]   = c[count].getLname();
	row[&quot;columnPhoneNumber&quot;]= c[count].getPhone();
	count ++;
	return true;		
}
return false;

------------------------------------------------第一二步的两个JAV类
代码发下：

A：package user;

public class Contact {
    String fname;
    String lname;
    String phone;
    public Contact(String fname, String lname, String phone){
        this.fname = fname;
        this.lname = lname;
        this.phone = phone;
    }
    /**
     * @return Returns the fname.
     */
    public String getFname() {
        return fname;
    }
    /**
     * @param fname The fname to set.
     */
    public void setFname(String fname) {
        this.fname = fname;
    }
    /**
     * @return Returns the lname.
     */
    public String getLname() {
        return lname;
    }
    /**
     * @param lname The lname to set.
     */
    public void setLname(String lname) {
        this.lname = lname;
    }
    /**
     * @return Returns the phone.
     */
    public String getPhone() {
        return phone;
    }
    /**
     * @param phone The phone to set.
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
}

B：package user;

public class ContactListFactory {
    public Contact[] createContactList(){
        Contact[] c = new Contact[5];
        c[0] = new Contact(&quot;stavros&quot;, &quot;kounis&quot;, &quot;2310886269&quot;);
        c[1] = new Contact(&quot;dimitris&quot;, &quot;kounis&quot;, &quot;2310888270&quot;);
        c[2] = new Contact(&quot;dimitris&quot;, &quot;adamos&quot;, &quot;2310998417&quot;);
        c[3] = new Contact(&quot;nikos&quot;, &quot;koufotolis&quot;, &quot;2321013770&quot;);
        c[4] = new Contact(&quot;yan&quot;, &quot;liang&quot;, &quot;13824745919&quot;);
        return c;
    }

}

注：发布后将两个JAVA类产生的CLASS 放在
C:\eclipse\plugins\org.eclipse.birt.report.viewer_2.1.0.N20060628-1351\birt\WEB-INF\classes\user 目录下，USER是开发时的包

经过发上步骤，再写一个JAVA PROJECT 调用上述报表
代码如下

package user;
import javax.swing.JOptionPane;
import user.ExecuteReport;
public class Reporttest {
	public static void main(String args[]) {
		try
		 {
		   ExecuteReport mreport = new ExecuteReport();
		   mreport.executeReport();
		 }
		 catch ( Exception e )
		 {
		  e.printStackTrace();
		 }
		/*System.out.println(&quot;中国人民解&quot;);
	    JOptionPane.showMessageDialog(null,&quot;中国人民解&quot;);
	    System.exit(0);*/
	}
}


主代码JAVA：
package user;
import java.util.Collection;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.text.html.HTMLDocument.Iterator;

import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLActionHandler;
import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
import org.eclipse.birt.report.engine.api.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
import org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask;
import org.eclipse.birt.report.engine.api.IParameterDefnBase;
import org.eclipse.birt.report.engine.api.IParameterGroupDefn;
import org.eclipse.birt.report.engine.api.IParameterSelectionChoice;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.IScalarParameterDefn;

public class ExecuteReport {
	

    static void executeReport() throws EngineException{
        IReportEngine engine=null;
        EngineConfig config = null;
        try{  
        	  //Configure the Engine and start the Platform
        	  config = new EngineConfig( );
        	  config.setEngineHome( &quot;C:/eclipse/workspace/ReportDrive/birt-runtime-2_1_0/ReportEngine&quot; );
        	  config.setLogConfig(null, Level.FINE);
        	  
        	  Platform.startup( config );
        	  IReportEngineFactory factory = (IReportEngineFactory) Platform
        	    .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
        	  engine = factory.createReportEngine( config );
        	  engine.changeLogLevel( Level.WARNING );
        	  
        	 }catch( Exception ex){
        	  ex.printStackTrace();
        	 }
     	    IReportRunnable design = null;
        	 
        	 //Open the report design
        	 design = engine.openReportDesign(&quot;C:/eclipse/workspace/html/kenScripDataset.rptdesign&quot;);
        	  
        	 IRunAndRenderTask task = engine.createRunAndRenderTask(design); 
        	 //Set rendering options - such as file or stream output, 
        	 //output format, whether it is embeddable, etc
        	 HTMLRenderOption options = new HTMLRenderOption();
             
        	 /////////////////////////////////////梁
       	     HashMap parameters = new HashMap();
    	     String name = &quot;myreportname&quot;;
    	     String pvalue =&quot;客户产品工序表&quot;;
    	     parameters.put(name,pvalue);
        	 task.setParameterValues(parameters);
        	 task.validateParameters();
        	 //////////////////////////////////////梁
        	 options.setOutputFileName(&quot;C:/eclipse/workspace/html/kenScripDataset.pdf&quot;);
        	 
        	 //Set output format
        	 options.setOutputFormat(&quot;pdf&quot;);
        	 task.setRenderOption(options);
        	 
        	 //run the report and destroy the engine
        	 //Note - If the program stays resident do not shutdown the Platform or the Engine
        	 task.run();
        	 task.close();
        	 engine.shutdown();
        	 Platform.shutdown();
        	 System.out.println(&quot;Finished&quot;);
        	 System.exit(0);        	 
       
    }
   
    
}

----------------------------------------
在eclispe 3.2的PATH BUILD中加入

 BIRT 的com.ibm.icu_3.4.4.1 .JAR

 BIRT 的engineapi.JAR

 BIRT 的coreapi.JAR


 BIRT 的JS.JAR]]></description>
</item><item>
<title><![CDATA[如何在BIRT报表中的SCRIPT中调用报表的参数]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17160</link>
<author>kenwoodtriger</author>
<pubDate>2006/8/3 16:50:04</pubDate>
<description><![CDATA[1>>在BIRT报表的对象脚本中（ONCREATE）
  中写入This.params.参数名

 2》在JAVA或JSP中传入参数
    如JAVA：
    
        	 /////////////////////////////////////梁
       	     HashMap parameters = new HashMap();
    	     String name = "myreportname";
    	     String pvalue ="客户产品工序表";
    	     parameters.put(name,pvalue);
        	 task.setParameterValues(parameters);
        	 task.validateParameters();
        	 //////////////////////////////////////梁]]></description>
</item><item>
<title><![CDATA[生活是这样的吗？]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17117</link>
<author>kenwoodtriger</author>
<pubDate>2006/8/2 9:02:57</pubDate>
<description><![CDATA[昨天晚上同PL吵架，
好烦啊，]]></description>
</item><item>
<title><![CDATA[JAVA 恶梦的开始]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17079</link>
<author>kenwoodtriger</author>
<pubDate>2006/8/1 8:34:12</pubDate>
<description><![CDATA[如何在Eclispe中用JAVA设用BIRT报表：---好东西共享（参考BIRT API 官方网站）
1：如下是全部代码
2：如果生成PDF,请将
  
        	 options.setOutputFormat("html");
   改成

        	 options.setOutputFormat("PDF");
  文件扩展名也要改为相应的PDF

3:加入com.ibm.icu_3.4.4.1.Jar \js.jar\coreapi.jar\engineapi.jar到
  BUILD   PATH 中
4：PDF记录有中文时出现乱码，请将itext-1.3放在
  INSTALLDIR\birt-runtime-2_1_0 
  \ReportEngine\plugins\com.lowagie.itext\lib

5:本人用的是Eclispe 3.2,JDK1.4,BIRT2.1
             
package user;
import java.util.HashMap;
import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLActionHandler;
import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
import org.eclipse.birt.report.engine.api.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;

public class ExecuteReport {
	

    static void executeReport() throws EngineException{
        IReportEngine engine=null;
        EngineConfig config = null;
        try{
        	  //Configure the Engine and start the Platform
        	  config = new EngineConfig( );
        	  config.setEngineHome( "C:/eclipse/workspace/ReportDrive/birt-runtime-2_1_0/ReportEngine" );
        	  config.setLogConfig(null, Level.FINE);
        	  
        	  Platform.startup( config );
        	  IReportEngineFactory factory = (IReportEngineFactory) Platform
        	    .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
        	  engine = factory.createReportEngine( config );
        	  engine.changeLogLevel( Level.WARNING );
        	  
        	 }catch( Exception ex){
        	  ex.printStackTrace();
        	 }
     	    IReportRunnable design = null;
        	 
        	 //Open the report design
        	 design = engine.openReportDesign("C:/eclipse/workspace/html/ken.rptdesign"); 

        	 IRunAndRenderTask task = engine.createRunAndRenderTask(design); 
        	 
        	 //Set rendering options - such as file or stream output, 
        	 //output format, whether it is embeddable, etc
        	 HTMLRenderOption options = new HTMLRenderOption();

        	 options.setOutputFileName("C:/eclipse/workspace/html/ken.htm");
        	 
        	 //Set output format
        	 options.setOutputFormat("html");
        	 task.setRenderOption(options);
        	 
        	 //run the report and destroy the engine
        	 //Note - If the program stays resident do not shutdown the Platform or the Engine
        	 task.run();
        	 task.close();
        	 engine.shutdown();
        	 Platform.shutdown();
        	 System.out.println("Finished");
        	 System.exit(0);        	 
       
    }
    
    public static void main(String[] args) {
    	 try
    	 {
    	  executeReport( );
    	 }
    	 catch ( Exception e )
    	 {
    	  e.printStackTrace();
    	 }
    	}
}

]]></description>
</item><item>
<title><![CDATA[我的打工生活]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=kenwoodtriger&amp;id=17062</link>
<author>kenwoodtriger</author>
<pubDate>2006/7/31 13:55:48</pubDate>
<description><![CDATA[今天的天气不好，广东中山热到晕浪，如果渡过这个复天，真是一个问题。
但更难渡过的是老板叫我用Eclispe+ORACLE+BIRT+Hibernate,写相当于C/S模式的大型ERP系统，真的不知如何下手。因为本人不是用Eclispe的，就本人的见解，JAVA是用设计WEB，写后台的还可以,用来写复杂的中国式报表，真他妈的难啊。
  各位救救小弟，如果用JAVA中设用BIRT报表，本人调成功了，便XML数据源出错，如下是出错信息。

  2006-7-31 13:06:21 org.eclipse.birt.data.engine.impl.DataEngineImpl &lt;init&gt;
信息: Data Engine starts up
2006-7-31 13:06:21 org.eclipse.birt.report.engine.data.dte.AbstractDataEngine prepare
严重: Missing extenion id in data source definition, DSOUR_XML
org.eclipse.birt.report.engine.api.EngineException: Missing extenion id in data source definition, DSOUR_XML
	at org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.newOdaDataSource(ModelDteApiAdapter.java:298)
	at org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.createDataSourceDesign(ModelDteApiAdapter.java:179)
	at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.prepare(AbstractDataEngine.java:152)
	at org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:101)
	at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportExecutor.execute(LocalizedReportExecutor.java:38)
	at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:68)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:187)
	at user.ExecuteReport.executeReport(ExecuteReport.java:54)
	at user.Reporttest.main(Reporttest.java:9)
2006-7-31 13:06:21 org.eclipse.birt.data.engine.impl.DataEngineImpl defineDataSet
警告: Data source {DSOUR_XML} is not defined
org.eclipse.birt.data.engine.core.DataException: Data source is not defined: DSOUR_XML
	at org.eclipse.birt.data.engine.impl.DataEngineImpl.defineDataSet(DataEngineImpl.java:250)
	at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.prepare(AbstractDataEngine.java:169)
	at org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:101)
	at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportExecutor.execute(LocalizedReportExecutor.java:38)
	at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:68)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:187)
	at user.ExecuteReport.executeReport(ExecuteReport.java:54)
	at user.Reporttest.main(Reporttest.java:9)
2006-7-31 13:06:21 org.eclipse.birt.report.engine.data.dte.AbstractDataEngine prepare
严重: Data source is not defined: DSOUR_XML
org.eclipse.birt.data.engine.core.DataException: Data source is not defined: DSOUR_XML
	at org.eclipse.birt.data.engine.impl.DataEngineImpl.defineDataSet(DataEngineImpl.java:250)
	at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.prepare(AbstractDataEngine.java:169)
	at org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:101)
	at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportExecutor.execute(LocalizedReportExecutor.java:38)
	at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:68)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:187)
	at user.ExecuteReport.executeReport(ExecuteReport.java:54)
	at user.Reporttest.main(Reporttest.java:9)
2006-7-31 13:06:22 org.eclipse.birt.report.engine.executor.ExecutionContext evaluate
严重: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: ReferenceError: &quot;dataSetRow&quot; is not defined.
 Script source: source, line: 0, text:
dataSetRow[&quot;ABBR_NAME&quot;]
org.mozilla.javascript.EvaluatorException: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: ReferenceError: &quot;dataSetRow&quot; is not defined.
 Script source: source, line: 0, text:
dataSetRow[&quot;ABBR_NAME&quot;]
	at org.eclipse.birt.report.engine.data.dte.NativeRowObject.get(NativeRowObject.java:94)
	at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1263)
	at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1301)
	at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1283)
	at org.mozilla.javascript.gen.c4._c0(&lt;inline&gt;:1)
	at org.mozilla.javascript.gen.c4.call(&lt;inline&gt;)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769)
	at org.mozilla.javascript.gen.c4.call(&lt;inline&gt;)
	at org.mozilla.javascript.gen.c4.exec(&lt;inline&gt;)
	at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:224)
	at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:565)
	at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:534)
	at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:90)
	at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:35)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:63)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:156)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:94)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutChildren(HTMLInlineStackingLM.java:138)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:156)
	at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout(HTMLRowLM.java:30)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:68)
	at org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.layoutChildren(HTMLTableBandLM.java:67)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:156)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:68)
	at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:74)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:156)
	at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layoutChildren(HTMLPageLM.java:139)
	at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:81)
	at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:80)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:187)
	at user.ExecuteReport.executeReport(ExecuteReport.java:54)
	at user.Reporttest.main(Reporttest.java:9)



 JAVA的优势是开源，但劣势也是开源，
将好端端的程序加入一写无联系的单元中去，程序比DELPHI写的慢到飞起。

 JAVA如果速度特别是C/S模式的速度提升不了，真她妈的就是垃圾。

 没有互联网，就没有JAVA。没有JAVA就没有互联网，对否。
]]></description>
</item>
</channel>
</rss>