当前位置: 首页>>代码示例>>Java>>正文


Java IRunAndRenderTask.setAppContext方法代码示例

本文整理汇总了Java中org.eclipse.birt.report.engine.api.IRunAndRenderTask.setAppContext方法的典型用法代码示例。如果您正苦于以下问题:Java IRunAndRenderTask.setAppContext方法的具体用法?Java IRunAndRenderTask.setAppContext怎么用?Java IRunAndRenderTask.setAppContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.birt.report.engine.api.IRunAndRenderTask的用法示例。


在下文中一共展示了IRunAndRenderTask.setAppContext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runandrender_emitter

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
/**
 * @param format
 *            render format
 * @param pagination
 *            For html output only, decide whether generate report with page
 *            break or not.
 * @throws EngineException
 */
protected ArrayList runandrender_emitter( String format, boolean pagination )
		throws EngineException
{
	IReportRunnable reportRunnable = engine.openReportDesign( inPath
			+ getReportName( ) );
	IRunAndRenderTask task = engine.createRunAndRenderTask( reportRunnable );
	RenderOption options = new HTMLRenderOption( );
	options.setOutputFormat( format );
	if ( format.equals( EMITTER_HTML ) )
	{
		( (HTMLRenderOption) options ).setHtmlPagination( pagination );
	}
	HashMap appContext = new HashMap( );
	appContext.put( "emitter_class", this );
	task.setAppContext( appContext );
	task.setRenderOption( options );
	task.run( );
	ArrayList errors = (ArrayList) task.getErrors( );
	task.close( );
	return errors;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:30,代码来源:BaseEmitter.java

示例2: testIEmitterServices

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
/**
 * Test IEmitterServices methods.
 * 
 * @throws BirtException
 */
public void testIEmitterServices( ) throws BirtException
{
	EngineConfig config = new EngineConfig( );
	emitterConfig = new HTMLEmitterConfig( );
	config.setEmitterConfiguration( EMITTER_HTML, emitterConfig );
	emitterConfig = config.getEmitterConfigs( ).get( EMITTER_HTML );
	Platform.startup( config );
	IReportEngineFactory factory = (IReportEngineFactory) Platform
			.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
	IReportEngine reportEngine = factory.createReportEngine( config );
	IReportRunnable reportRunnable = engine.openReportDesign( this
			.genInputFile( report ) );

	IRenderOption options = new HTMLRenderOption( );
	options.setOutputFormat( EMITTER_HTML );
	options.setOutputFileName( this.genOutputFile( "myService.html" ) );
	HTMLRenderContext renderContext = new HTMLRenderContext( );
	renderContext.setImageDirectory( "myImage" ); //$NON-NLS-1$
	HashMap appContext = new HashMap( );
	appContext.put(
			EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
			renderContext );
	appContext.put( "emitter_class", this );

	IRunAndRenderTask rrTask = reportEngine
			.createRunAndRenderTask( reportRunnable );
	rrTask.setRenderOption( options );
	rrTask.setAppContext( appContext );
	rrTask.run( );
	rrTask.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:37,代码来源:IEmitterServicesTest.java

示例3: runAndRender_WithPagination

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
private List runAndRender_WithPagination( String inputFile, String outputFile )
		throws EngineException
{
	IReportRunnable runnable = engine.openReportDesign( inputFile );
	IRunAndRenderTask task = engine.createRunAndRenderTask( runnable );

	task.setLocale( Locale.ENGLISH );

	IRenderOption options = new HTMLRenderOption( );
	options.setOutputFileName( outputFile );
	( (HTMLRenderOption) options ).setHtmlPagination( true );
	HTMLRenderContext renderContext = new HTMLRenderContext( );
	renderContext.setImageDirectory( "image" ); //$NON-NLS-1$
	HashMap appContext = new HashMap( );
	appContext.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
			renderContext );
	task.setAppContext( appContext );

	options.setOutputFormat( "html" ); //$NON-NLS-1$
	options.getOutputSetting( )
			.put( HTMLRenderOption.URL_ENCODING, "UTF-8" ); //$NON-NLS-1$

	task.setRenderOption( options );
	task.run( );
	List errors = task.getErrors( );
	task.close( );

	return errors;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:30,代码来源:BaseSmokeTest.java

示例4: testCancelRunAndRenderTask

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
public void testCancelRunAndRenderTask( )
{
	// this report sleeps for 2 seconds after creation,
	// which allows separate test threads to cancel it
	String input = this.genInputFile( "pages9.rptdesign" );

	try
	{
		IReportRunnable runnable = engine
				.openReportDesign( new FileInputStream( new File( input ) ) );

		IRunAndRenderTask task = engine.createRunAndRenderTask( runnable );
		HTMLRenderOption option = new HTMLRenderOption( );

		option.setOutputFormat( "html" );
		for ( int i = 0; i < 3; i++ )
		{
			task = engine.createRunAndRenderTask( runnable );
			task.setRenderOption( option );
			task.setAppContext( new HashMap( ) );
			task.run( );
			task.close( );
			assertEquals(task.STATUS_SUCCEEDED, task.getStatus());
			assertEquals(0, task.getErrors().size());
		}

		task = engine.createRunAndRenderTask( runnable );
		task.setRenderOption( option );
		task.setAppContext( new HashMap( ) );
		engine.getConfig( ).getAppContext( ).put( "taskToCancel", task );
		engine.getConfig( ).getAppContext( ).put( "taskToCancelWithSignal", null );
		CancelTask cancelThread = new CancelTask( "cancelThread", task );
		cancelThread.start( );
		task.run( );
		assertEquals(task.STATUS_CANCELLED, task.getStatus());
		assertEquals(0, task.getErrors().size());
		task.close( );

		task = engine.createRunAndRenderTask( runnable );
		engine.getConfig( ).getAppContext( ).put( "taskToCancel", null );
		engine.getConfig( ).getAppContext( ).put( "taskToCancelWithSignal", task );
		task.setRenderOption( option );
		CancelWithFlagTask cancelWithFlagTask = new CancelWithFlagTask( "cancelWithFlagTask", task );
		cancelWithFlagTask.start( );
		task.run( );
		assertEquals(task.STATUS_CANCELLED, task.getStatus());
		assertEquals(1, task.getErrors().size());
		assertEquals(((EngineException)task.getErrors().get(0)).getMessage(), cancelMessage);
		task.close( );

		task = engine.createRunAndRenderTask( runnable );
		engine.getConfig( ).getAppContext( ).put( "taskToCancel", null );
		engine.getConfig( ).getAppContext( ).put( "taskToCancelWithSignal", null );
		task.setRenderOption( option );
		task.run( );
		assertEquals(task.STATUS_SUCCEEDED, task.getStatus());
		assertEquals(0, task.getErrors().size());
		task.close( );
	}
	catch ( Exception e )
	{
		e.printStackTrace( );
		fail( "RunAndRenderTask.cancel() failed!" );
	}

}
 
开发者ID:eclipse,项目名称:birt,代码行数:67,代码来源:RunAndRenderTaskTest.java


注:本文中的org.eclipse.birt.report.engine.api.IRunAndRenderTask.setAppContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。