本文整理汇总了Java中org.eclipse.birt.report.engine.api.HTMLRenderOption类的典型用法代码示例。如果您正苦于以下问题:Java HTMLRenderOption类的具体用法?Java HTMLRenderOption怎么用?Java HTMLRenderOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTMLRenderOption类属于org.eclipse.birt.report.engine.api包,在下文中一共展示了HTMLRenderOption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetRenderOption
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
/**
* Test setRenderOption(IRenderOption) method Test getRenderOption() method
*/
public void testGetRenderOption( )
{
RenderOptionBase rendop = new RenderOptionBase( );
rendop.setOutputFormat( "fo" );
rendop.setOutputFileName( "outputfile" );
HTMLRenderContext context = new HTMLRenderContext( );
context.setRenderOption( rendop );
RenderOptionBase ropb = (RenderOptionBase) ( context.getRenderOption( ) );
assertEquals( "fo", ropb.getOutputFormat( ) );
Map outsetting = new HashMap( );
outsetting = ropb.getOutputSetting( );
assertFalse( outsetting.isEmpty( ) );
assertEquals( 2, outsetting.size( ) );
ropb.getOutputSetting( ).put( HTMLRenderOption.URL_ENCODING, "UTF-8" );
assertEquals( 3, outsetting.size( ) );
}
示例2: runandrender_emitter
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的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;
}
示例3: runandthenrender_emitter
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
protected ArrayList runandthenrender_emitter( String format )
throws EngineException
{
ArrayList errors = new ArrayList( );
this.run( getReportName( ) + ".rptdesign", getReportName( )
+ ".rptdocument" );
IReportDocument document = engine.openReportDocument( outPath
+ getReportName( ) + ".rptdocument" );
IRenderTask task = engine.createRenderTask( document );
RenderOption options = new HTMLRenderOption( );
options.setOutputFormat( format );
HashMap appContext = new HashMap( );
appContext.put( "emitter_class", this );
task.setAppContext( appContext );
task.setRenderOption( options );
task.render( );
errors = (ArrayList) task.getErrors( );
task.close( );
return errors;
}
示例4: testVisionOptimize
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
public void testVisionOptimize( ) throws EngineException, IOException
{
HTMLRenderOption options = new HTMLRenderOption( );
options.setOutputMasterPageMargins( true );
options.setEmbeddable( false );
ByteArrayOutputStream output = new ByteArrayOutputStream( );
List instanceIDs = new ArrayList( );
options.setInstanceIDs( instanceIDs );
options.setOutputStream( output );
options.setEnableMetadata( true );
IRenderTask task = createRenderTask( designFile );
task.setRenderOption( options );
task.render( );
task.close( );
String content = new String( output.toByteArray( ) );
output.close( );
String regex = "<col style=\"width: 1.25in;\">";
Matcher matcher = Pattern.compile( regex ).matcher( content );
assertEquals( true, matcher.find( ) );
}
示例5: testInlineStyle
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
public void testInlineStyle( ) throws EngineException, IOException
{
HTMLRenderOption options = new HTMLRenderOption( );
options.setEmbeddable( true );
options.setEnableInlineStyle( true );
ByteArrayOutputStream output = new ByteArrayOutputStream( );
List instanceIDs = new ArrayList( );
options.setInstanceIDs( instanceIDs );
options.setOutputStream( output );
IRenderTask task = createRenderTask( designFile );
task.setRenderOption( options );
task.render( );
task.close( );
String content = new String( output.toByteArray( ) );
output.close( );
String regex = "<style type=\"text/css\">";
Matcher matcher = Pattern.compile( regex ).matcher( content );
assertEquals( false, matcher.find( ) );
regex = "<div[^<>]*style=\"[^<>]*color: rgb(255, 0, 0)[^<>]*>aaaa</div>";
matcher = Pattern.compile( regex ).matcher( content );
assertEquals( false, matcher.find( ) );
}
示例6: testTableColumnWidth
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
/**
*
* @throws EngineException
* @throws IOException
*/
public void testTableColumnWidth( ) throws EngineException, IOException
{
//the default cell to place the group icon is the first cell.
String designFile = "org/eclipse/birt/report/engine/emitter/html/TableColumnWidth.xml";
HTMLRenderOption options = new HTMLRenderOption( );
options.setLayoutPreference( "fixed" );
ByteArrayOutputStream output = new ByteArrayOutputStream( );
List instanceIDs = new ArrayList( );
options.setInstanceIDs( instanceIDs );
options.setOutputStream( output );
options.setEnableMetadata( true );
IRenderTask task = createRenderTask( designFile );
task.setRenderOption( options );
task.render( );
task.close( );
String content = new String( output.toByteArray( ) );
output.close( );
content = content.replaceAll( "\n", "\"\n\"+\\\\n" );
String regex = "table-layout:fixed";
Matcher matcher = Pattern.compile( regex ).matcher( content );
assertEquals( true, matcher.find( ) );
}
示例7: testDisplayGroupIconWithGroupKey
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
/**
* Test group icon will be displayed with group key even when the key is in a grid without query.
* @throws EngineException
* @throws IOException
*/
public void testDisplayGroupIconWithGroupKey( ) throws EngineException, IOException
{
String designFile = "org/eclipse/birt/report/engine/emitter/html/displayGroupIcon_Test1.xml";
//a. Test run and render task.
HTMLRenderOption options = new HTMLRenderOption( );
options.setDisplayGroupIcon( true );
String[] iconKeys = {"group key1 in data item",
"group key2 in grid without query", "group key3 in data item",
"group key4 with same expression"};
String content = getRenderResult( designFile, false, options ).content;
checkAllGroupIconDisplayed( options, content, iconKeys );
content = getRenderResult( designFile, true, options ).content;
checkAllGroupIconDisplayed( options, content, iconKeys );
}
示例8: testPerformanceOptimize
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
public void testPerformanceOptimize( ) throws EngineException, IOException
{
HTMLRenderOption options = new HTMLRenderOption( );
options.setEnableAgentStyleEngine( true );
options.setEmbeddable( true );
ByteArrayOutputStream output = new ByteArrayOutputStream( );
List instanceIDs = new ArrayList( );
options.setInstanceIDs( instanceIDs );
options.setOutputStream( output );
//options.setEnableMetadata( true );
IRenderTask task = createRenderTask( designFile );
task.setRenderOption( options );
task.render( );
task.close( );
String content = new String( output.toByteArray( ) );
output.close( );
String regex = "text-decoration: underline;";
Matcher matcher = Pattern.compile( regex ).matcher( content );
assertEquals( true, matcher.find( ) );
regex = "<div style=\" text-decoration: underline;\">";
matcher = Pattern.compile( regex ).matcher( content );
assertEquals( false, matcher.find( ) );
}
示例9: testVisionOptimize
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
public void testVisionOptimize( ) throws EngineException, IOException
{
HTMLRenderOption options = new HTMLRenderOption( );
options.setEnableAgentStyleEngine( false );
options.setEmbeddable( true );
ByteArrayOutputStream output = new ByteArrayOutputStream( );
List instanceIDs = new ArrayList( );
options.setInstanceIDs( instanceIDs );
options.setOutputStream( output );
//options.setEnableMetadata( true );
IRenderTask task = createRenderTask( designFile );
task.setRenderOption( options );
task.render( );
task.close( );
String content = new String( output.toByteArray( ) );
output.close( );
String regex = "<div style=\" text-decoration: underline;";
Matcher matcher = Pattern.compile( regex ).matcher( content );
assertEquals( true, matcher.find( ) );
}
示例10: getReportTitle
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
protected String getReportTitle( IReportContent report )
{
// write the title of the report in HTML.
String title = null;
if ( report != null )
{
title = report.getTitle( );
}
if ( title == null )
{
// set the default title
if ( renderOption != null )
{
HTMLRenderOption htmlOption = new HTMLRenderOption( renderOption );
title = htmlOption.getHtmlTitle( );
}
}
return title;
}
示例11: retrieveRtLFlag
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
/**
* Figures out the RTL rendering option.
*
* @param htmlOption
* @author bidi_hcg
*/
private void retrieveRtLFlag( )
{
// If htmlOption has RTL_FLAG option set (likely adopted from an URL
// parameter), honor this option, otherwise obtain direction from
// the report design.
HTMLRenderOption htmlOption = new HTMLRenderOption( renderOption );
Object bidiFlag = htmlOption.getOption( IRenderOption.RTL_FLAG );
if ( Boolean.TRUE.equals( bidiFlag ) )
{
htmlRtLFlag = true;
}
else if ( bidiFlag == null && report != null)
{
ReportDesignHandle handle = report.getDesign( ).getReportDesign( );
if ( handle != null )
{
htmlRtLFlag = handle.isDirectionRTL( );
htmlOption.setHtmlRtLFlag( htmlRtLFlag ); // not necessary though
}
}
}
示例12: runAndRender
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的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;
}
示例13: renderPage
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
protected String renderPage( IReportDocument doc, long pageNo )
throws Exception
{
ByteArrayOutputStream buffer = new ByteArrayOutputStream( );
assertTrue( pageNo <= doc.getPageCount( ) );
IRenderTask renderTask = engine.createRenderTask( doc );
try
{
HTMLRenderOption options = new HTMLRenderOption( );
options.setOutputFormat( "html" );
options.setOutputStream( buffer );
renderTask.setRenderOption( options );
renderTask.setPageNumber( (long) pageNo );
renderTask.render( );
List errors = renderTask.getErrors( );
assertEquals( 0, errors.size( ) );
}
finally
{
renderTask.close( );
}
return new String( buffer.toString( "UTF-8" ) );
}
示例14: run
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
public void run( ) throws Exception
{
// render the generated report document
IReportDocument doc = engine.openReportDocument( fileName );
long pageCount = doc.getPageCount( );
for ( int i = 1; i <= pageCount; i++ )
{
IRenderTask renderTask = engine.createRenderTask( doc );
HTMLRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( "html" );
option.setOutputStream( new ByteArrayOutputStream( ) );
renderTask.setRenderOption( option );
renderTask.setPageNumber( i );
renderTask.render( );
List errors = renderTask.getErrors( );
assertEquals( 0, errors.size( ) );
renderTask.close( );
}
doc.close( );
}
示例15: doRenderAll
import org.eclipse.birt.report.engine.api.HTMLRenderOption; //导入依赖的package包/类
void doRenderAll( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
IRenderTask renderTask = engine.createRenderTask( document );
renderTask.getReportRunnable( ).setDesignHandle( reportHandle );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.render( );
assertTrue( renderTask.getErrors( ).isEmpty( ) );
renderTask.close( );
String pageContent = out.toString( "UTF-8" );
assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
document.close( );
}