本文整理汇总了Java中org.eclipse.birt.report.engine.api.IRunAndRenderTask.setLocale方法的典型用法代码示例。如果您正苦于以下问题:Java IRunAndRenderTask.setLocale方法的具体用法?Java IRunAndRenderTask.setLocale怎么用?Java IRunAndRenderTask.setLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.birt.report.engine.api.IRunAndRenderTask
的用法示例。
在下文中一共展示了IRunAndRenderTask.setLocale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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();
}
}
}
示例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;
}
示例4: 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();
}