本文整理汇总了Java中org.eclipse.birt.report.model.api.IResourceLocator类的典型用法代码示例。如果您正苦于以下问题:Java IResourceLocator类的具体用法?Java IResourceLocator怎么用?Java IResourceLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResourceLocator类属于org.eclipse.birt.report.model.api包,在下文中一共展示了IResourceLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAvailableResourceUrls
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
private URL[] getAvailableResourceUrls( )
{
List<URL> urls = new ArrayList<URL>( );
String[] baseNames = getBaseNames( );
if ( baseNames == null )
return urls.toArray( new URL[0] );
else
{
for ( int i = 0; i < baseNames.length; i++ )
{
URL url = SessionHandleAdapter.getInstance( )
.getReportDesignHandle( )
.findResource( baseNames[i],
IResourceLocator.MESSAGE_FILE );
if ( url != null )
urls.add( url );
}
return urls.toArray( new URL[0] );
}
}
示例2: getResourceURLs
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
private URL[] getResourceURLs( )
{
String[] baseNames = getBaseNames( );
if ( baseNames == null )
return null;
else
{
URL[] urls = new URL[baseNames.length];
for ( int i = 0; i < baseNames.length; i++ )
{
urls[i] = SessionHandleAdapter.getInstance( )
.getReportDesignHandle( )
.findResource( baseNames[i],
IResourceLocator.MESSAGE_FILE );
}
return urls;
}
}
示例3: getAvailableResourceUrls
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
private URL[] getAvailableResourceUrls( )
{
List<URL> urls = new ArrayList<URL>( );
String[] baseNames = getBaseNames( );
if ( baseNames == null )
return urls.toArray( new URL[0] );
else
{
for ( int i = 0; i < baseNames.length; i++ )
{
URL url = getModuleHandle( ).findResource( baseNames[i],
IResourceLocator.MESSAGE_FILE );
if ( url != null )
urls.add( url );
}
return urls.toArray( new URL[0] );
}
}
示例4: getResourceURLs
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
private URL[] getResourceURLs( )
{
String[] baseNames = getBaseNames( );
if ( baseNames == null )
return null;
else
{
URL[] urls = new URL[baseNames.length];
for ( int i = 0; i < baseNames.length; i++ )
{
urls[i] = getModuleHandle( ).findResource( baseNames[i],
IResourceLocator.MESSAGE_FILE );
}
return urls;
}
}
示例5: testResourceImage
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
public void testResourceImage( )
{
path = "file://" + this.genInputFolder( ) + separator + "resources"
+ separator;
// path="http://192.168.218.234:88/resource/";
IResourceLocator locator = new EngineResourceLocator( path );
try
{
renderReport( "resource_image", locator );
}
catch ( BirtException e )
{
e.printStackTrace( );
fail( "Failed to find image resource from custom resource locator" );
}
File f = new File( this.genOutputFile( "resource_image.html" ) );
assertTrue( "Failed render report from image resource", f.exists( ) );
}
示例6: testResourceProperties
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
public void testResourceProperties( )
{
path = "file://" + this.genInputFolder( ) + separator + "resources"
+ separator;
// path="http://192.168.218.234:88/resource/";
IResourceLocator locator = new EngineResourceLocator( path );
try
{
renderReport( "resource_properties", locator );
}
catch ( BirtException e )
{
e.printStackTrace( );
fail( "Failed to find library resource from custom resource locator" );
}
File f = new File( this.genOutputFile( "resource_properties.html" ) );
assertTrue( "Failed render report from properties resource", f.exists( ) );
}
示例7: testResourceLibrary
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
public void testResourceLibrary( )
{
path = "file://" + this.genInputFolder( ) + separator + "resources"
+ separator;
// path="http://192.168.218.234:88/resource/";
IResourceLocator locator = new EngineResourceLocator( path );
try
{
renderReport( "resource_library", locator );
}
catch ( BirtException e )
{
e.printStackTrace( );
fail( "Failed to find properties resource from custom resource locator" );
}
File f = new File( this.genOutputFile( "resource_library.html" ) );
assertTrue( "Failed render report from library", f.exists( ) );
}
示例8: testFindFile
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
/**
* Tests the 'findFile' method of DefaultSearchFileAlgorithm.
*
* @throws Exception
* if the test fails.
*/
public void testFindFile( ) throws Exception
{
URL url = algorithm.findResource( designHandle,
"1.xml", IResourceLocator.IMAGE ); //$NON-NLS-1$
assertNull( url );
url = algorithm.findResource( designHandle,
INPUT, IResourceLocator.IMAGE ); //$NON-NLS-1$
assertNotNull( url );
designHandle.setStringProperty( ReportDesign.BASE_PROP,
PLUGIN_PATH+ this.getFullQualifiedClassName( ) + GOLDEN_FOLDER );
url = algorithm.findResource( designHandle,
"1.xml", IResourceLocator.IMAGE ); //$NON-NLS-1$
assertNull( url );
}
示例9: test_regression_150687
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
/**
* @throws SemanticException
*/
public void test_regression_150687( ) throws SemanticException
{
DesignEngine engine = new DesignEngine( new DesignConfig( ) );
SessionHandle session = engine.newSessionHandle( ULocale.ENGLISH );
ReportDesignHandle designHandle = session.createDesign( );
ScriptLib lib1 = StructureFactory.createScriptLib( );
lib1.setName( "test.jar" ); //$NON-NLS-1$
designHandle.addScriptLib( lib1 );
session.setResourceFolder( getTempFolder() + "/" + INPUT_FOLDER );
URL url = session.getResourceLocator( ).findResource( designHandle,
"test.jar", IResourceLocator.JAR_FILE ); //$NON-NLS-1$
assertNotNull( url );
}
示例10: test_regression_146256
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
public void test_regression_146256( ) throws Exception
{
ResourceLocatorImpl rl = new ResourceLocatorImpl( );
//String resource = "jar:file:" + this.getFullQualifiedClassName( ) + "/" + INPUT_FOLDER + "/" + "testRead.jar!/test/testRead.rptdesign"; //$NON-NLS-1$
String resource = "jar:file:" + getTempFolder() + "/" + INPUT_FOLDER + "/" + "testRead.jar!/test/testRead.rptdesign"; //$NON-NLS-1$
URL url = rl.findResource( null, resource, IResourceLocator.IMAGE );
assertNotNull( url );
URLConnection jarConnection = url.openConnection( );
jarConnection.connect( );
InputStream inputStream = jarConnection.getInputStream( );
assertNotNull( inputStream );
}
示例11: test_regression_155509
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
/**
* @throws DesignFileException
*/
public void test_regression_155509( ) throws DesignFileException
{
openDesign( filename );
rl = new ResourceLocatorImpl( );
//sessionHandle.setResourceFolder( getClassFolder( ) );
sessionHandle.setResourceFolder( getTempFolder( ) +"/"+INPUT_FOLDER);
URL jarrsc = rl.findResource(
designHandle,
jarfile,
IResourceLocator.JAR_FILE );
assertNotNull( jarrsc );
//sessionHandle.setResourceFolder( this.getFullQualifiedClassName( ) + "/" + INPUT_FOLDER + "/" );
sessionHandle.setResourceFolder( getTempFolder( ) +"/"+INPUT_FOLDER );
URL messagersc = rl.findResource(
designHandle,
"Regression_155509",
IResourceLocator.MESSAGE_FILE );
assertNotNull( messagersc );
}
示例12: getDesignHandle
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
public ReportDesignHandle getDesignHandle( String name, InputStream in )
throws DesignFileException
{
// Create new design session
SessionHandle sessionHandle = new DesignEngine( new DesignConfig( ) )
.newSessionHandle( ULocale.getDefault( ) );
// get the resource locator form the options and set it to the session
// handle
IResourceLocator locator = (IResourceLocator) options
.get( ModuleOption.RESOURCE_LOCATOR_KEY );
if ( locator != null )
{
sessionHandle.setResourceLocator( locator );
}
// Obtain design handle
ReportDesignHandle designHandle = null;
ModuleOption modOptions = new ModuleOption( options );
if ( in != null )
designHandle = sessionHandle.openDesign( name, in, modOptions );
else
designHandle = sessionHandle.openDesign( name, modOptions );
return designHandle;
}
示例13: getImageUrl
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
protected String getImageUrl( String imageUri )
{
String imageUrl = imageUri;
ReportDesignHandle reportDesign = context.getReport( ).getDesign( )
.getReportDesign( );
if ( reportDesign != null )
{
URL url = reportDesign.findResource( imageUri,
IResourceLocator.IMAGE, context.getReport( )
.getReportContext( ) == null ? null : context
.getReport( ).getReportContext( ).getAppContext( ) );
if ( url != null )
{
imageUrl = url.toExternalForm( );
}
}
return imageUrl;
}
示例14: processBackgroundImage
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
/**
* Checks the background image property. If it is given as a relative path,
* gets its absolute path and sets it back to the style.
*
* @param style
* the style that defines background image related properties
*/
protected void processBackgroundImage( IStyle style )
{
if ( style == null )
return;
String image = style.getBackgroundImage( );
if ( image == null )
return;
ModuleHandle reportDesign = context.getDesign( );
if ( reportDesign != null )
{
URL url = reportDesign.findResource( image, IResourceLocator.IMAGE,
context.getAppContext( ) );
if ( url != null )
{
style.setBackgroundImage( url.toExternalForm( ) );
}
}
}
示例15: handleStyleImage
import org.eclipse.birt.report.model.api.IResourceLocator; //导入依赖的package包/类
public String handleStyleImage( String uri, Map appContext )
{
if ( uri != null )
{
if ( FileUtil.isLocalResource( uri ) )
{
URL url = handle.findResource( uri, IResourceLocator.IMAGE,
appContext );
if ( url != null )
{
uri = url.toString( );
}
}
imageSrc.add( uri );
}
return uri;
}