本文整理汇总了Java中org.eclipse.birt.report.engine.api.HTMLServerImageHandler类的典型用法代码示例。如果您正苦于以下问题:Java HTMLServerImageHandler类的具体用法?Java HTMLServerImageHandler怎么用?Java HTMLServerImageHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTMLServerImageHandler类属于org.eclipse.birt.report.engine.api包,在下文中一共展示了HTMLServerImageHandler类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: renderPDFReport
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
@Override
public void renderPDFReport(String reportName,
Map<String, Object> parameters, OutputStream out)
throws BirtReportException {
try {
IRunAndRenderTask runAndRenderTask = createRunAndRenderTask(
reportName);
injectParameters(parameters, runAndRenderTask);
PDFRenderOption pdfOptions = new PDFRenderOption();
pdfOptions.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);
pdfOptions.setOutputStream(out);
pdfOptions.setEmbededFont(true); // TODO idueppe - should be
// configurable from cockpit
pdfOptions.setImageHandler(new HTMLServerImageHandler());
runAndRenderTask(runAndRenderTask, pdfOptions);
} catch (EngineException | IOException e) {
throw new RenderReportException("pdf", reportName, e);
}
}
开发者ID:interseroh,项目名称:report-cockpit-birt-web,代码行数:24,代码来源:BirtReportServiceBean.java
示例2: renderExcelReport
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
@Override
public void renderExcelReport(String reportName,
Map<String, Object> parameters, OutputStream out)
throws BirtReportException {
try {
IRunAndRenderTask runAndRenderTask = createRunAndRenderTask(
reportName);
injectParameters(parameters, runAndRenderTask);
EXCELRenderOption excelRenderOptions = new EXCELRenderOption();
excelRenderOptions.setOutputFormat("xlsx");
excelRenderOptions.setOutputStream(out);
excelRenderOptions.setEnableMultipleSheet(true);
// TODO idueppe - should be configurable from cockpit
excelRenderOptions.setHideGridlines(true);
// TODO idueppe - should be configurable from cockpit
// excelRenderOptions.setOfficeVersion();
// TODO idueppe - should be configurable from cockpit
excelRenderOptions.setImageHandler(new HTMLServerImageHandler());
runAndRenderTask(runAndRenderTask, excelRenderOptions);
} catch (EngineException | IOException e) {
throw new RenderReportException("excel", reportName, e);
}
}
开发者ID:interseroh,项目名称:report-cockpit-birt-web,代码行数:26,代码来源:BirtReportServiceBean.java
示例3: startBirtEngine
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static synchronized void startBirtEngine(IPlatformContext context)
{
log.info("Starting BIRT Engine and OSGI Platform using: " + context.getClass().getName());
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
HTMLRenderOption emitterConfig = new HTMLRenderOption();
emitterConfig.setActionHandler(new HTMLActionHandler());
emitterConfig.setImageHandler(imageHandler);
EngineConfig config = new EngineConfig();
config.setEngineHome("");
config.setPlatformContext(context);
config.setLogConfig(null, Level.ALL);
config.getEmitterConfigs().put("html", emitterConfig);
try
{
Platform.startup(config);
}
catch (BirtException e)
{
log.error("BirtException", e);
}
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
birtEngine = factory.createReportEngine(config);
log.info("BIRT Engine Started");
birtEngine.changeLogLevel(Level.SEVERE);
}
开发者ID:mtpettyp,项目名称:openreports,代码行数:36,代码来源:BirtProvider.java
示例4: testOnURLImage
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
/**
* Test onURLImage() method
*/
public void testOnURLImage( )
{
String url = "http://image";
Image image = new Image( url );
RenderOptionBase option = new RenderOptionBase( );
image.setRenderOption( option );
HTMLRenderContext context = new HTMLRenderContext( );
HTMLServerImageHandler handler = new HTMLServerImageHandler( );
String urlGet = handler.onURLImage( image, context );
assertEquals( "OnURLImage() fail", url, urlGet );
}
开发者ID:eclipse,项目名称:birt,代码行数:15,代码来源:HTMLServerImageHandlerTest.java
示例5: testOnDocImage
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
/**
* Test onDocImage() method Not implemented at 1.0.1,so return null.
*/
public void testOnDocImage( )
{
String url = "http://image";
Image image = new Image( url );
RenderOptionBase option = new RenderOptionBase( );
image.setRenderOption( option );
HTMLRenderContext context = new HTMLRenderContext( );
HTMLServerImageHandler handler = new HTMLServerImageHandler( );
String urlGet = handler.onDocImage( image, context );
assertNull( "OnDocImage() fail", urlGet );
}
开发者ID:eclipse,项目名称:birt,代码行数:15,代码来源:HTMLServerImageHandlerTest.java
示例6: getReportEngine
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private synchronized IReportEngine getReportEngine()
{
try
{
Level logLevel = LOGGER.isDebugEnabled() ? Level.FINE : Level.SEVERE;
if( reportEngine == null )
{
LOGGER.info("Loading Birt engine");
EngineConfig engineConfig = new EngineConfig();
if( configService.isDebuggingMode() )
{
engineConfig.setOSGiConfig(ImmutableMap.of("osgi.dev", "true"));
}
URL resource = pluginService.getClassLoader("org.eclipse.birt.osgi").getResource("birt/");
String birtHome = IoUtil.url2file(resource).getAbsolutePath();
engineConfig.setBIRTHome(birtHome);
HTMLRenderOption emitterConfig = new HTMLRenderOption();
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
emitterConfig.setImageHandler(imageHandler);
engineConfig.getEmitterConfigs().put("html", emitterConfig);
// get log info from LOG4J
java.util.logging.Logger birtLogger = java.util.logging.Logger.getLogger("org.eclipse.birt");
if( birtLogger != null )
{
birtLogger.addHandler(new Log4JHandler());
}
// It was either use these extended classes or modify birt.
Platform.startup(engineConfig);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
if( factory == null )
{
throw new BirtException("Could not get report engine factory");
}
reportEngine = factory.createReportEngine(engineConfig);
reportEngine.changeLogLevel(logLevel);
}
return reportEngine;
}
catch( BirtException e )
{
Platform.shutdown();
LOGGER.error("Error with Birt", e);
throw new RuntimeApplicationException("Error loading reporting engine", e);
}
}
开发者ID:equella,项目名称:Equella,代码行数:54,代码来源:ReportingServiceImpl.java
示例7: renderHtmlReport
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
@Override
public void renderHtmlReport(String reportName,
Map<String, Object> parameters, OutputStream out, long pageNumber,
boolean overwrite) throws BirtReportException {
try {
String reportFileName = absolutePathOf(reportFileName(reportName));
String documentFileName = absoluteTempPath(
documentFileName(reportName));
recreateReportDocument(reportName, parameters, overwrite,
reportFileName, documentFileName);
IReportDocument reportDocument = reportEngine
.openReportDocument(documentFileName);
HTMLRenderOption htmlOptions = new HTMLRenderOption();
htmlOptions.setOutputFormat(IRenderOption.OUTPUT_FORMAT_HTML);
htmlOptions.setOutputStream(out);
htmlOptions.setImageHandler(new HTMLServerImageHandler());
htmlOptions.setEmbeddable(true);
htmlOptions.setBaseImageURL(baseImageURL);
htmlOptions.setImageDirectory(imageDirectory);
htmlOptions.setHtmlPagination(true);
htmlOptions.setMasterPageContent(false);
htmlOptions.setPageFooterFloatFlag(true);
IRenderTask renderTask = reportEngine
.createRenderTask(reportDocument,
reportDocument.getReportRunnable());
renderTask.setRenderOption(htmlOptions);
renderTask.setPageNumber(pageNumber);
injectLocale(renderTask);
renderTask.render();
renderTask.close();
} catch (EngineException | IOException e) {
throw new BirtReportException(e);
}
}
开发者ID:interseroh,项目名称:report-cockpit-birt-web,代码行数:44,代码来源:BirtReportServiceBean.java
示例8: renderHtmlReport
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的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
示例9: testOnDesignImage
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
/**
* Test OnDesignImage() method
*/
public void testOnDesignImage( )
{
try
{
// Get embedded image byte array
/*
* String plug_path=EngineCase.PLUGIN_PATH; String
* file_path=EngineCase.RESOURCE_BUNDLE.getString("CASE_INPUT")
* +System.getProperty("file.separator")+"EmbedImage.txt"; String
* path=plug_path+System.getProperty("file.separator")+file_path;
*/
String path = this.getFullQualifiedClassName( ) + "/"
+ INPUT_FOLDER + "/" + INPUT;
byte[] imageBytes = readImageFile(path);
assertNotNull( imageBytes );
// Test onDesignImage()
HTMLRenderContext context = new HTMLRenderContext( );
context.setBaseImageURL( "." );
context.setImageDirectory( "." );
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler( );
Image image = new Image( imageBytes, "image1" );
RenderOptionBase option = new RenderOptionBase( );
image.setRenderOption( option );
File f = null;
int count = 0;
String fPath = System.getProperty( "user.dir" );
do
{
count++;
String fp = fPath + System.getProperty( "file.separator" )
+ "design" + String.valueOf( count );
f = new File( fp ); //$NON-NLS-1$
if ( f.exists( ) )
{
f.delete( );
continue;
}
else
{
break;
}
} while ( true );
String str = imageHandler.onDesignImage( image, context );
String strGet = "./design1";
assertEquals( "", str, strGet );
removeFile( str );
}
catch ( Exception e )
{
e.printStackTrace( );
}
}
开发者ID:eclipse,项目名称:birt,代码行数:60,代码来源:HTMLServerImageHandlerTest.java
示例10: testOnCustomImage
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; //导入依赖的package包/类
/**
* Test onCustomeImage() method
*/
public void testOnCustomImage( )
{
try
{
// Get embedded image byte array
/*
* String plug_path=EngineCase.PLUGIN_PATH; String
* file_path=EngineCase.RESOURCE_BUNDLE.getString("CASE_INPUT")
* +System.getProperty("file.separator")+"EmbedImage.txt"; String
* path=plug_path+System.getProperty("file.separator")+file_path;
*/
String path = getClassFolder( )
+ System.getProperty( "file.separator" ) + INPUT_FOLDER
+ System.getProperty( "file.separator" ) + "EmbedImage.txt";
byte[] imageBytes = readImageFile(path);
// Test onDesignImage()
HTMLRenderContext context = new HTMLRenderContext( );
context.setBaseImageURL( "." );
context.setImageDirectory( "." );
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler( );
Image image = new Image( imageBytes, "image1" );
RenderOptionBase option = new RenderOptionBase( );
image.setRenderOption( option );
File f = null;
int count = 1;
String fPath = System.getProperty( "user.dir" );
do
{
count++;
String fp = fPath + System.getProperty( "file.separator" )
+ "custom" + String.valueOf( count );
f = new File( fp ); //$NON-NLS-1$
if ( f.exists( ) )
{
f.delete( );
continue;
}
else
{
break;
}
} while ( true );
String str = imageHandler.onCustomImage( image, context );
byte[] actualBytes = readImageFile(str);
// Here, we want to verify actual contents of image from text above
int length = imageBytes.length;
assertEquals( length, actualBytes.length );
for ( int index = 0; index < length; index++)
{
assertEquals(imageBytes[index], actualBytes[index]);
}
removeFile( str );
}
catch ( Exception e )
{
e.printStackTrace( );
}
}
开发者ID:eclipse,项目名称:birt,代码行数:66,代码来源:HTMLServerImageHandlerTest.java
注:本文中的org.eclipse.birt.report.engine.api.HTMLServerImageHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论