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


Java IRunAndRenderTask.setRenderOption方法代码示例

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


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

示例1: setRunAndRenderOption

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
public void setRunAndRenderOption( String inputFile, String inputName,
		String boolVar1, String boolVar2 ) throws Exception
{
	copyResource_INPUT( inputName + ".rptdesign", inputName + ".rptdesign" );
	IReportRunnable runnable = engine
			.openReportDesign( new FileInputStream( new File( inputFile ) ) );
	IRunAndRenderTask task = engine.createRunAndRenderTask( runnable );
	IPDFRenderOption option = new PDFRenderOption( );
	option.setOutputFileName( outputPath + inputName + "_" + boolVar1 + "_"
			+ boolVar2 + ".pdf" );
	option.setOutputFormat( "pdf" );
	option.setOption( option.FIT_TO_PAGE, new Boolean( boolVar1 ) );
	option.setOption( option.PAGEBREAK_PAGINATION_ONLY, new Boolean(
			boolVar2 ) );
	task.setRenderOption( option );
	task.run( );
	task.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:19,代码来源:PDFRenderOptionTest.java

示例2: 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

示例3: runAndRender

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
/**
 * Run and render the report, and return the render result.
 * 
 * @param designFile
 * @return render result.
 * @throws EngineException
 * @throws IOException
 */
protected String runAndRender( String designFile ) throws EngineException,
		IOException
{
	IRunAndRenderTask runAndRenderTask = createRunAndRenderTask( designFile );
	HTMLRenderOption options = new HTMLRenderOption( );
	ByteArrayOutputStream out = new ByteArrayOutputStream( );
	options.setOutputStream( out );
	options.setOutputFormat( "html" );
	options.setHtmlPagination( true );
	runAndRenderTask.setRenderOption( options );
	runAndRenderTask.run( );
	runAndRenderTask.close( );
	String result = new String( out.toByteArray( ) );
	out.close( );
	return result;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:25,代码来源:EngineCase.java

示例4: testHyphenation

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
/**
 * Test case for bugzilla bug <a
 * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=181578">181578</a> :
 * Exception is thrown when preview attached report in PDF[1102]
 * 
 * @throws EngineException
 */
public void testHyphenation() throws EngineException
{
	String designFile = "org/eclipse/birt/report/engine/layout/pdf/181578.xml";
	try
	{
		IReportRunnable report = openReportDesign( designFile );
		List pageAreas = new ArrayList();
		IEmitterMonitor monitor = new PageMonitor(pageAreas);
		IRunAndRenderTask runAndRenderTask = new TestRunAndRenderTask( engine,
				report, monitor );
		runAndRenderTask.setLocale( Locale.CHINA );
		runAndRenderTask.setRenderOption( createRenderOption() );
		runAndRenderTask.run( );
		runAndRenderTask.close( );
	}
	catch(Throwable t)
	{
		System.out.println(t);
		assertTrue(false);
	}
	assertTrue(true);
}
 
开发者ID:eclipse,项目名称:birt,代码行数:30,代码来源:PDFTextLMTest.java

示例5: renderMergedOutputModel

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
    InputStream reportPath = null;
    try {
        reportPath = getServletContext()
                .getResourceAsStream(getUrl());
        if (reportPath == null) {
            reportPath = new ClassPathResource(getUrl()).getInputStream();
        }
        IReportRunnable report = reportEngine.openReportDesign(getUrl(), reportPath);
        IRunAndRenderTask task = reportEngine.createRunAndRenderTask(report);

        task.setLocale(request.getLocale());
        for (Map.Entry<String, Object> e : model.entrySet()) {
            task.setParameterValue(e.getKey(), e.getValue());
        }
        RenderOption opts = buildRenderOptions(request, response);
        response.setContentType(getContentType());
        response.setCharacterEncoding(StandardCharsets.UTF_8.name());
        task.setRenderOption(opts);

        task.run();
        task.close();
    } finally {
        if (reportPath != null) {
            reportPath.close();
        }
    }

}
 
开发者ID:kewne,项目名称:spring-birt,代码行数:31,代码来源:AbstractBirtReportView.java

示例6: 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

示例7: testRunAndRenderTask

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
/**
 * Test methods in RunAndRenderTask class
 */
public void testRunAndRenderTask( ) throws EngineException
{

	String input = this.genInputFile( "report_engine.rptdesign" );

	try
	{
		IReportRunnable runnable = engine
				.openReportDesign( new FileInputStream( new File( input ) ) );
		IRunAndRenderTask task = engine.createRunAndRenderTask( runnable );
		// validateParameters
		assertTrue( task.validateParameters( ) );
		// set/getRenderOption
		RenderOptionBase option = new RenderOptionBase( ), optionGet;
		task.setRenderOption( option );
		optionGet = (RenderOptionBase) task.getRenderOption( );
		assertEquals( "set/getRenderOption fail", option, optionGet );

		// parameters
		HashMap hm = new HashMap( ), hmGet;
		task.setParameterValues( hm );
		hmGet = task.getParameterValues( );
		assertEquals( "set/getParameterValues(hashmap) fail", hm, hmGet );

		task.setParameterValue( "p1", "p1value" );
		assertEquals( "Set/getParameterValues fail", task
				.getParameterValues( )
				.get( "p1" ), "p1value" );
	}
	catch ( FileNotFoundException e )
	{
		e.printStackTrace( );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:38,代码来源:RunAndRenderTaskTest.java

示例8: 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

示例9: runAndRender

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
public void runAndRender( String design, IRenderOption options )
		throws EngineException
{
	IReportRunnable reportRunnable = engine.openReportDesign( design );
	IRunAndRenderTask runAndRenderTask = engine
			.createRunAndRenderTask( reportRunnable );
	runAndRenderTask.setRenderOption( options );
	runAndRenderTask.run( );
	runAndRenderTask.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:11,代码来源:HTMLReportEmitterTestCase.java

示例10: testRenderReport

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
/**
 * Test if text with underline, line-through or overline, uri
 * images(bmp,gif,jpg,png,tif),url images(gif), embeded
 * images(bmp,gif,jpg,png,tif), and report design with page breaks can be
 * correctly rendered. <br>
 * <br>
 * The result PS files have same names as the respective report design, and
 * are put in folder named "testresult" under current working folder. For
 * Eclipse, the current working folder is normally the folder where Eclipse
 * is installed. <br>
 * <b>To check the results, every result files should be checked manually.</b>
 * @throws Exception 
 */
public void testRenderReport( ) throws Exception
{
	if ( isOnWindows( ) )
	{
		String thePackage = "org/eclipse/birt/report/engine/emitter/postscript/";
		String[] designs = new String[]{"underline", "uriImages",
				"urlImages", "pageBreak", "embededImages", "svgImages",
				"pageBackgroundColor", "lableWithBorder",
				"pageBackgroundImage", "gridBackgroundImage",
				"pageBackgroundImageNoRepeat",
				"pageBackgroundImageRepeatX", "pageBackgroundImageRepeatY"};
		String suffix = ".rptdesign";
		HTMLRenderOption options = new HTMLRenderOption( );
		options.setOutputFormat( "postscript" );
		String resultFolder = "testresult/";
		for ( int i = 0; i < designs.length; i++ )
		{
			options.setOutputFileName( resultFolder + designs[i] + ".ps" );
			String design = thePackage + designs[i] + suffix;
			IRunAndRenderTask runAndRenderTask = createRunAndRenderTask( design );
			runAndRenderTask.setRenderOption( options );
			runAndRenderTask.run( );
			runAndRenderTask.close( );
		}
		System.out.println( "please check result manually in folder : "
				+ new File( resultFolder ).getAbsolutePath( ) );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:42,代码来源:PostScriptRenderTest.java

示例11: getPageAreas

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
protected List getPageAreas(IReportRunnable runnable ) throws EngineException
{
	List pageAreas = new ArrayList();
	IEmitterMonitor monitor = new PageMonitor(pageAreas);
	IRunAndRenderTask runAndRenderTask = new TestRunAndRenderTask( engine,
			runnable, monitor );
	
	runAndRenderTask.setRenderOption( createRenderOption() );
	runAndRenderTask.run( );
	runAndRenderTask.close( );
	return pageAreas;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:13,代码来源:PDFLayoutTest.java

示例12: getPages

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
private List getPages( PDFRenderOption options ) throws EngineException
{
	String designFile = "org/eclipse/birt/report/engine/layout/pdf/fitToPage.xml";
	IReportRunnable report = openReportDesign( designFile );
	List pageAreas = new ArrayList();
	IEmitterMonitor monitor = new PageMonitor(pageAreas);
	IRunAndRenderTask runAndRenderTask = new TestRunAndRenderTask( engine,
			report, monitor );
	runAndRenderTask.setRenderOption( options );
	runAndRenderTask.run( );
	runAndRenderTask.close( );
	return pageAreas;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:14,代码来源:PDFPageLMTest.java

示例13: run

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
void run(IReportRunnable reportRunnable, String format, TimeZone timeZone, String htmlType, String targetFile, JsonObject values)
        throws EngineException {

    ReportParametersInspector inspector = new ReportParametersInspector(reportEngine);
    List<IParameterDefnBase> parameters = inspector.getParameters(reportRunnable);

    Map<String, String> map = new HashMap<String, String>(parameters.size());
    flattenParameters(inspector, parameters, map);

    IRunAndRenderTask task = reportEngine.createRunAndRenderTask(reportRunnable);
    for(IParameterDefnBase param: parameters){
        String name = param.getName();
        if(values.containsKey(name)){
            setParameter(task, name, map.get(name), values.get(name));
        }
    }

    // set report render options
    IRenderOption options = new RenderOption();

    options.setOutputFormat(format);

    // setup the output file
    options.setOutputFileName(targetFile);

    // setup the application context
    if (format.equalsIgnoreCase("html")) {
        HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
        if ("ReportletNoCSS".equals(htmlType)) {
            htmlOptions.setEmbeddable(true);
        }
        // setup the output encoding
        htmlOptions.setUrlEncoding(encoding);
        htmlOptions.setHtmlPagination(true);
        htmlOptions.setImageDirectory("image"); //$NON-NLS-1$
    }

    // set the render options
    task.setRenderOption(options);

    // setup the locale
    task.setLocale(getLocale(locale));
    task.setTimeZone(timeZone);
    task.run();
    task.close();
}
 
开发者ID:phuihock,项目名称:birtconn,代码行数:47,代码来源:ReportGenerator.java

示例14: renderHtmlReport

import org.eclipse.birt.report.engine.api.IRunAndRenderTask; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void renderHtmlReport(String outputFile, String reportName)
		throws EngineException, FileNotFoundException {
	String file = this.getClass().getResource(reportName).getPath();
	IReportRunnable iReportRunnable = reportEngine.openReportDesign(file);

	IGetParameterDefinitionTask parameterDefinitionTask = reportEngine
			.createGetParameterDefinitionTask(iReportRunnable);
	IRunAndRenderTask runAndRenderTask = reportEngine
			.createRunAndRenderTask(iReportRunnable);
	Collection<IParameterDefnBase> parameterDefns = parameterDefinitionTask
			.getParameterDefns(true);
	for (IParameterDefnBase parameterDefn : parameterDefns) {
		System.out
				.println("Displayname: " + parameterDefn.getDisplayName());
		logger.info("Helptext: " + parameterDefn.getHelpText());
		logger.info("Name: " + parameterDefn.getName());
		logger.info("Typename: " + parameterDefn.getTypeName());
		logger.info("ParameterType: "
				+ BirtParameterType.valueOf(parameterDefn
						.getParameterType()));
		logger.info("PromptText: " + parameterDefn.getPromptText());
		logger.info("DefaultValue: "
				+ parameterDefinitionTask.getDefaultValue(parameterDefn));
		logger.info("Required: " + parameterDefn.getHandle());

		runAndRenderTask.setParameterValue(parameterDefn.getName(), 10101);
	}

	IRenderOption options = new RenderOption();

	HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
	htmlOptions.setOutputFormat("html");
	htmlOptions.setOutputStream(new FileOutputStream(outputFile));
	htmlOptions.setImageHandler(new HTMLServerImageHandler());
	htmlOptions.setBaseImageURL("images");
	htmlOptions.setImageDirectory("target/images");
	runAndRenderTask.setRenderOption(htmlOptions);
	runAndRenderTask.run();
	runAndRenderTask.close();
}
 
开发者ID:interseroh,项目名称:report-cockpit-birt-web,代码行数:42,代码来源:BirtReportGenerateTest.java

示例15: 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.setRenderOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。