本文整理汇总了Java中org.eclipse.birt.report.model.api.ModuleHandle.findResource方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleHandle.findResource方法的具体用法?Java ModuleHandle.findResource怎么用?Java ModuleHandle.findResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.birt.report.model.api.ModuleHandle
的用法示例。
在下文中一共展示了ModuleHandle.findResource方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processBackgroundImage
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的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( ) );
}
}
}
示例2: generateURL
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的package包/类
public URL generateURL( ModuleHandle designHandle, String uri )
throws MalformedURLException
{
try
{
return new URL( uri );
}
catch ( MalformedURLException e )
{
String path = URIUtil.getLocalPath( uri );
if ( designHandle == null )
{
designHandle = SessionHandleAdapter.getInstance( )
.getReportDesignHandle( );
}
if ( path != null && designHandle != null )
{
// add by gao for lib
return designHandle.findResource( path, IResourceLocator.IMAGE );
}
return URI.create( uri ).toURL( );
}
}
示例3: getNodeTooltip
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的package包/类
public String getNodeTooltip( Object model )
{
if ( model instanceof CssStyleSheetHandle )
{
CssStyleSheetHandle cssStyleSheetHandle = (CssStyleSheetHandle) model;
ModuleHandle moudleHandle = cssStyleSheetHandle.getModule( )
.getModuleHandle( );
URL url = moudleHandle.findResource( cssStyleSheetHandle.getFileName( ),
IResourceLocator.CASCADING_STYLE_SHEET );
if ( url != null && url.getFile( ) != null )
{
return url.getFile( );
}
}
return super.getNodeTooltip( model );
}
示例4: buildHyperlink
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的package包/类
/**
* Build URI
*
* @param action
* @param context
* @return
*/
private String buildHyperlink( IAction action, IReportContext context )
{
IReportRunnable runnable = context.getReportRunnable( );
String actionURL = action.getActionString( );
if ( runnable != null )
{
ModuleHandle moduleHandle = runnable.getDesignHandle( )
.getModuleHandle( );
URL url = moduleHandle.findResource( actionURL, -1 );
if ( url != null )
actionURL = url.toString( );
}
return actionURL;
}
示例5: findResource
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的package包/类
/**
*
* @param fileName
* @param fileType
* @param appContext
* @return
*/
public byte[] findResource( ModuleHandle design, String fileName,
int fileType, Map appContext )
{
URL url = design.findResource( fileName, fileType, appContext );
if ( url == null )
{
logger.log( Level.WARNING,
MessageConstants.RESOURCE_NOT_ACCESSIBLE, fileName );
return DUMMY_BYTES;
}
return findResource( url );
}
示例6: loadResourceFolderScriptLibs
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的package包/类
private static void loadResourceFolderScriptLibs( ModuleHandle handle,
List<URL> urls )
{
Iterator it = handle.scriptLibsIterator( );
while ( it.hasNext( ) )
{
ScriptLibHandle libHandle = (ScriptLibHandle) it.next( );
URL url = handle.findResource( libHandle.getName( ),
IResourceLocator.LIBRARY );
if ( url != null )
urls.add( url );
}
}
示例7: createDesignClassLoader
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的package包/类
/**
* create the class loader used by the design.
*
* the method should be synchronized as the class loader of a document may
* be used by multiple tasks.
*/
protected synchronized void createDesignClassLoader( )
{
if (designClassLoader != null)
{
return;
}
ArrayList<URL> urls = new ArrayList<URL>( );
if ( runnable != null )
{
ModuleHandle module = (ModuleHandle) runnable.getDesignHandle( );
Iterator iter = module.scriptLibsIterator( );
while ( iter.hasNext( ) )
{
ScriptLibHandle lib = (ScriptLibHandle) iter.next( );
String libPath = lib.getName( );
if ( libPath == null )
{
continue;
}
URL url = module.findResource( libPath,
IResourceLocator.LIBRARY, appContext );
if ( url != null )
{
urls.add( url );
}
else
{
logger.log( Level.SEVERE,
"Can not find specified jar: " + libPath ); //$NON-NLS-1$
}
}
}
final URL[] jarUrls = urls.toArray( new URL[]{} );
if ( engine != null )
{
designClassLoader = AccessController.doPrivileged( new PrivilegedAction<URLClassLoader>( ) {
@Override
public URLClassLoader run( )
{
return new URLClassLoader( jarUrls,
engine.getEngineClassLoader( ) );
}
} );
}
else
{
designClassLoader = AccessController.doPrivileged( new PrivilegedAction<URLClassLoader>( ) {
@Override
public URLClassLoader run( )
{
return new URLClassLoader( jarUrls );
}
} );
}
}
示例8: getSelectedFiles
import org.eclipse.birt.report.model.api.ModuleHandle; //导入方法依赖的package包/类
/**
* Returns the current selected file.
*
* @return the current selected file.
* @throws IOException
* if an I/O error occurs.
*/
protected Collection<File> getSelectedFiles( ) throws IOException
{
Collection<?> currentResource = getSelectedResources( );
Collection<File> files = new HashSet<File>( );
if ( currentResource == null )
{
return files;
}
for ( Object resource : currentResource )
{
File file = null;
if ( resource instanceof LibraryHandle )
{
file = new File( ( (LibraryHandle) resource ).getFileName( ) );
}
else if ( resource instanceof CssStyleSheetHandle )
{
CssStyleSheetHandle node = (CssStyleSheetHandle) resource;
ModuleHandle module = SessionHandleAdapter.getInstance( )
.getReportDesignHandle( );
URL url = module.findResource( node.getFileName( ),
IResourceLocator.CASCADING_STYLE_SHEET );
file = convertToFile( url );
}
else if ( resource instanceof ResourceEntry )
{
file = convertToFile( ( (ResourceEntry) resource ).getURL( ) );
}
if ( file != null && file.exists( ) )
{
files.add( file );
}
}
return files;
}