本文整理汇总了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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}