本文整理汇总了Java中org.eclipse.birt.report.engine.api.IReportRunnable.getDesignHandle方法的典型用法代码示例。如果您正苦于以下问题:Java IReportRunnable.getDesignHandle方法的具体用法?Java IReportRunnable.getDesignHandle怎么用?Java IReportRunnable.getDesignHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.birt.report.engine.api.IReportRunnable
的用法示例。
在下文中一共展示了IReportRunnable.getDesignHandle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
/**
* Initializes the pdfEmitter.
*
* @param services
* the emitter svervices object.
* @throws EngineException
*/
private void initialize( IEmitterServices services ) throws EngineException
{
this.services = services;
renderOption = (RenderOption)services.getRenderOption( );
// Gets the output file name from RenderOptionBase.OUTPUT_FILE_NAME.
// It has the top preference.
IReportRunnable reportRunnable = services.getReportRunnable( );
if ( reportRunnable != null )
{
reportDesign = (ReportDesignHandle) reportRunnable
.getDesignHandle( );
}
this.context = services.getReportContext( );
this.output = EmitterUtil.getOuputStream( services, "report.ps" );
}
示例2: testExtractionFromInstanceId
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
public void testExtractionFromInstanceId( ) throws Exception
{
// get the instance id
// open the document in the archive.
// create an RenderTask using the report document
Set<InstanceID> instanceIds = getAllInstanceIds( document );
for ( InstanceID iid : instanceIds )
{
long designId = iid.getComponentID( );
IReportRunnable runnable = document.getReportRunnable( );
ReportDesignHandle report = (ReportDesignHandle) runnable
.getDesignHandle( );
DesignElementHandle element = report.getElementByID( designId );
if ( element instanceof TableHandle )
{
// we get the report let
dataExTask.setInstanceID( iid );
ArrayList resultSetList = (ArrayList) dataExTask
.getResultSetList( );
assertEquals( 1, resultSetList.size( ) );
IExtractionResults results = dataExTask.extract( );
int rowCount = checkExtractionResults( results );
assertTrue( rowCount > 0 );
}
}
}
示例3: getReportDesign
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
public ReportDesignHandle getReportDesign( )
{
IReportRunnable reportRunnable = getReportRunnable( );
if ( reportRunnable != null )
{
return (ReportDesignHandle) reportRunnable.getDesignHandle( );
}
return null;
}
示例4: updateRtLFlag
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
protected void updateRtLFlag( ) throws EngineException
{
//get RtL flag from renderOptions
if ( renderOptions == null )
return;
IReportRunnable runnable = executionContext.getRunnable( );
if ( runnable == null )
return;
ReportDesignHandle handle = (ReportDesignHandle) runnable
.getDesignHandle( );
if ( handle != null )
{
Object bidiFlag = renderOptions.getOption( IRenderOption.RTL_FLAG );
if ( Boolean.TRUE.equals( bidiFlag ) )
{
if ( !handle.isDirectionRTL( ) )
{
updateBidiStyle( true );
}
}
else if ( Boolean.FALSE.equals( bidiFlag ) )
{
if ( handle.isDirectionRTL( ) )
{
updateBidiStyle( false );
}
}
}
}
示例5: doTestDocument
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
void doTestDocument( ) throws Exception
{
IReportRunnable report = engine.openReportDesign( REPORT_DESIGN );
reportHandle = (ReportDesignHandle) report.getDesignHandle( );
doRenderPages( );
doRenderAll( );
doRenderReportletWithInstanceID( );
doRenderReportletWithBookmark( );
doDataExtractionWithInstanceID( );
}
示例6: getTitleFromDesign
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
/**
* Returns report title from design
*
* @param reportDesignHandle
* @return
* @throws ReportServiceException
*/
public static String getTitleFromDesign(
IViewerReportDesignHandle reportDesignHandle )
throws ReportServiceException
{
String reportTitle = null;
if ( reportDesignHandle != null )
{
Object design = reportDesignHandle.getDesignObject( );
if ( design instanceof IReportRunnable )
{
IReportRunnable runnable = (IReportRunnable) design;
if ( runnable.getDesignHandle( ) != null )
{
ModuleHandle moduleHandle = runnable.getDesignHandle( )
.getModuleHandle( );
String key = moduleHandle.getStringProperty( ReportDesignHandle.TITLE_ID_PROP );
if ( key != null && moduleHandle.getMessage( key ) != null )
{
reportTitle = moduleHandle.getMessage( key );
}
else
{
reportTitle = (String) runnable.getProperty( IReportRunnable.TITLE );
}
}
else
reportTitle = (String) runnable.getProperty( IReportRunnable.TITLE );
}
}
return reportTitle;
}
示例7: handleDataSourceOverrides
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
private void handleDataSourceOverrides(IReportRunnable design)
{
ReportDesignHandle reportDH = (ReportDesignHandle) design.getDesignHandle();
List<?> birtDataSources = reportDH.getAllDataSources();
if (birtDataSources == null) return;
Iterator<?> iterator = birtDataSources.iterator();
while (iterator.hasNext())
{
Object dataSource = iterator.next();
if (dataSource instanceof OdaDataSourceHandle)
{
OdaDataSourceHandle dataSH = (OdaDataSourceHandle) dataSource;
try
{
ReportDataSource reportDataSource = dataSourceProvider
.getDataSource(dataSH.getName());
if (reportDataSource != null)
{
log.info("Overriding BIRT DataSource: " + dataSH.getName());
log.debug("Original connection properties for: " + dataSH.getName());
log.debug("URL: " + dataSH.getStringProperty("odaURL"));
log.debug("DRIVER: " + dataSH.getStringProperty("odaDriverClass"));
log.debug("USER: " + dataSH.getStringProperty("odaUser"));
try
{
dataSH.setStringProperty("odaURL", reportDataSource.getUrl());
dataSH.setStringProperty("odaDriverClass", reportDataSource.getDriverClassName());
dataSH.setStringProperty("odaUser", reportDataSource.getUsername());
dataSH.setStringProperty("odaPassword", reportDataSource.getPassword());
}
catch (SemanticException e)
{
log.error("SemanticException", e);
}
log.debug("New connection properties for: " + dataSH.getName());
log.debug("URL: " + dataSH.getStringProperty("odaURL"));
log.debug("DRIVER: " + dataSH.getStringProperty("odaDriverClass"));
log.debug("USER: " + dataSH.getStringProperty("odaUser"));
}
else
{
log.info("Unknown data source: " + dataSH.getName());
}
}
catch (ProviderException pe)
{
log.error("ProviderException", pe);
}
}
}
design.setDesignHandle(reportDH);
}
示例8: registerDesign
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
private void registerDesign( IReportRunnable runnable )
{
DesignElementHandle design = (ModuleHandle) runnable.getDesignHandle( );
element = SimpleElementFactory.getInstance( ).getElement( design );
}
示例9: testExtractionFromInstanceIdWithFilter
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
public void testExtractionFromInstanceIdWithFilter( ) throws Exception
{
// create an RenderTask using the report document
Set<InstanceID> instanceIds = getAllInstanceIds( document );
for ( InstanceID iid : instanceIds )
{
long designId = iid.getComponentID( );
IReportRunnable runnable = document.getReportRunnable( );
ReportDesignHandle report = (ReportDesignHandle) runnable
.getDesignHandle( );
DesignElementHandle element = report.getElementByID( designId );
if ( element instanceof TableHandle )
{
// it is a sub query
if ( iid.getComponentID( ) == 280 )
{
dataExTask.setInstanceID( iid );
ArrayList resultSetList = (ArrayList) dataExTask
.getResultSetList( );
assertEquals( 1, resultSetList.size( ) );
// creat filters
IFilterDefinition[] FilterExpression = new IFilterDefinition[1];
FilterExpression[0] = new FilterDefinition(
new ConditionalExpression(
"row[\"CUSTOMERNUMBER_1\"]", OP_EQ,
"\"SubQuery_Name: 128\"" ) );
// add filters to dataExtractionTask
dataExTask.setFilters( FilterExpression );
IExtractionResults results = dataExTask.extract( );
int rowCount = checkExtractionResults( results );
assertTrue( rowCount == 1 );
}
}
else if ( element instanceof ListHandle )
{
// it is the top most query.
if ( iid.getComponentID( ) == 277 )
{
dataExTask.setInstanceID( iid );
doTestExtractionTaskWithFilters( 1 );
}
}
}
}
示例10: doDataExtractionWithInstanceID
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
void doDataExtractionWithInstanceID( ) 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( );
renderTask.close( );
String content = out.toString( "UTF-8" );
Pattern iidPattern = Pattern.compile( "iid=\"([^\"]*)\"" );
Matcher matcher = iidPattern.matcher( content );
while ( matcher.find( ) )
{
String strIid = matcher.group( 1 );
InstanceID iid = InstanceID.parse( strIid );
long designId = iid.getComponentID( );
IReportRunnable runnable = renderTask.getReportRunnable( );
ReportDesignHandle report = (ReportDesignHandle) runnable
.getDesignHandle( );
DesignElementHandle element = report.getElementByID( designId );
if ( element instanceof TableHandle
|| element instanceof ListHandle )
{
IDataExtractionTask task = engine
.createDataExtractionTask( document );
task.setInstanceID( iid );
IExtractionResults results = task.extract( );
if ( element instanceof TableHandle )
{
assertEquals( 27, getFieldCount( results ) );
}
else
{
assertEquals( 6, getFieldCount( results ) );
}
task.close( );
}
}
document.close( );
}
示例11: doDataExtractionWithInstanceID
import org.eclipse.birt.report.engine.api.IReportRunnable; //导入方法依赖的package包/类
void doDataExtractionWithInstanceID( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
IRenderTask renderTask = engine.createRenderTask( document );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.render( );
renderTask.close( );
String content = out.toString( "UTF-8" );
Pattern iidPattern = Pattern.compile( "iid=\"([^\"]*)\"" );
Matcher matcher = iidPattern.matcher( content );
while ( matcher.find( ) )
{
String strIid = matcher.group( 1 );
InstanceID iid = InstanceID.parse( strIid );
long designId = iid.getComponentID( );
IReportRunnable runnable = renderTask.getReportRunnable( );
ReportDesignHandle report = (ReportDesignHandle) runnable
.getDesignHandle( );
DesignElementHandle element = report.getElementByID( designId );
if ( element instanceof TableHandle
|| element instanceof ListHandle )
{
IDataExtractionTask task = engine
.createDataExtractionTask( document );
task.setInstanceID( iid );
IExtractionResults results = task.extract( );
if ( element instanceof TableHandle )
{
assertEquals( 27, getFieldCount( results ) );
}
else
{
assertEquals( 6, getFieldCount( results ) );
}
task.close( );
}
}
document.close( );
}