当前位置: 首页>>代码示例>>Java>>正文


Java JRResourcesUtil类代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.util.JRResourcesUtil的典型用法代码示例。如果您正苦于以下问题:Java JRResourcesUtil类的具体用法?Java JRResourcesUtil怎么用?Java JRResourcesUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JRResourcesUtil类属于net.sf.jasperreports.engine.util包,在下文中一共展示了JRResourcesUtil类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: revertResourcesFillContext

import net.sf.jasperreports.engine.util.JRResourcesUtil; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static void revertResourcesFillContext(ResourcesFillContext context)
{
	if (context.getClassLoader() != null)
	{
		JRResourcesUtil.resetClassLoader();
	}
	
	if (context.getUrlHandlerFactory() != null)
	{
		JRResourcesUtil.resetThreadURLHandlerFactory();
	}
	
	if (context.getFileResolver() != null)
	{
		JRResourcesUtil.resetThreadFileResolver();
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:JRResourcesFillUtil.java

示例2: getResourceBundle

import net.sf.jasperreports.engine.util.JRResourcesUtil; //导入依赖的package包/类
/**
 * Returns the {@link ResourceBundle} associated to the specified dataset.
 * As fallback solution we look in the main dataset.
 * 
 * @param dataset the dataset to look into
 * @param jconfig the {@link JasperReportsContext} instance
 * @return the {@link ResourceBundle} if any, <code>null</code> otherwise
 */
public static ResourceBundle getResourceBundle(JRDataset dataset, JasperReportsConfiguration jconfig) {
	String baseName = dataset.getResourceBundle();
	ResourceBundle loadedBundle = null;
	if(baseName==null) {
		baseName = jconfig.getJasperDesign().getMainDataset().getResourceBundle();
	}
	if(!Misc.isNullOrEmpty(baseName)) {
		Locale locale = Locale.getDefault();
		Object obj = jconfig.getJRParameters().get(JRParameter.REPORT_LOCALE);
		if (obj instanceof Locale) {
			locale = (Locale) obj;
		}
		try {
			loadedBundle = JRResourcesUtil.loadResourceBundle(baseName, locale, jconfig.getClassLoader());
		}
		catch (MissingResourceException e) {
			JaspersoftStudioPlugin.getInstance().logError(
					NLS.bind("Unable to get the resource bundle with base name {0}.",baseName), e);
		}
	}
	return loadedBundle;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:31,代码来源:ExpressionContextUtils.java

示例3: loadResourceBundle

import net.sf.jasperreports.engine.util.JRResourcesUtil; //导入依赖的package包/类
/**
 * Loads the resource bundle corresponding to the resource bundle base name and locale.
 */
protected ResourceBundle loadResourceBundle()
{
	ResourceBundle loadedBundle;
	if (resourceBundleBaseName == null)
	{
		loadedBundle = null;
	}
	else
	{
		loadedBundle = JRResourcesUtil.loadResourceBundle(getJasperReportsContext(), resourceBundleBaseName, locale);
	}
	return loadedBundle;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:JRFillDataset.java

示例4: setResourcesFillContext

import net.sf.jasperreports.engine.util.JRResourcesUtil; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static ResourcesFillContext setResourcesFillContext(Map<String,Object> parameterValues)
{
	ResourcesFillContext context = new ResourcesFillContext();
	
	ClassLoader classLoader = (ClassLoader) parameterValues.get(
			JRParameter.REPORT_CLASS_LOADER);
	if (classLoader != null)
	{
		JRResourcesUtil.setThreadClassLoader(classLoader);
		context.setClassLoader(classLoader);
	}
	
	URLStreamHandlerFactory urlHandlerFactory = (URLStreamHandlerFactory) 
			parameterValues.get(JRParameter.REPORT_URL_HANDLER_FACTORY);
	if (urlHandlerFactory != null)
	{
		JRResourcesUtil.setThreadURLHandlerFactory(urlHandlerFactory);
		context.setUrlHandlerFactory(urlHandlerFactory);
	}
	
	FileResolver fileResolver = (FileResolver) parameterValues.get(
			JRParameter.REPORT_FILE_RESOLVER);
	if (fileResolver != null)
	{
		JRResourcesUtil.setThreadFileResolver(fileResolver);
		context.setFileResolver(fileResolver);
	}
	
	return context;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:32,代码来源:JRResourcesFillUtil.java

示例5: getInputStream

import net.sf.jasperreports.engine.util.JRResourcesUtil; //导入依赖的package包/类
@Override
public InputStream getInputStream(String uri)
{
	try
	{
		URL url = JRResourcesUtil.createURL(uri, urlHandlerFactory);
		if (url != null)
		{
			return JRLoader.getInputStream(url);
		}

		File file = JRResourcesUtil.resolveFile(uri, fileResolver);
		if (file != null)
		{
			return JRLoader.getInputStream(file);
		}

		url = JRResourcesUtil.findClassLoaderResource(uri, classLoader);
		if (url != null)
		{
			return JRLoader.getInputStream(url);
		}
	}
	catch (JRException e)
	{
		throw new JRRuntimeException(e);
	}
	
	return null;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:31,代码来源:DefaultRepositoryService.java

示例6: getResourceBundle

import net.sf.jasperreports.engine.util.JRResourcesUtil; //导入依赖的package包/类
protected ResourceBundle getResourceBundle() {
	if (rb == null)
		rb = JRResourcesUtil.loadResourceBundle(getBundleName(), getLocale(), jConfig.getClassLoader());
	return rb;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:6,代码来源:AInterpreter.java


注:本文中的net.sf.jasperreports.engine.util.JRResourcesUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。