本文整理汇总了Java中net.sf.jasperreports.engine.xml.JRXmlTemplateLoader类的典型用法代码示例。如果您正苦于以下问题:Java JRXmlTemplateLoader类的具体用法?Java JRXmlTemplateLoader怎么用?Java JRXmlTemplateLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRXmlTemplateLoader类属于net.sf.jasperreports.engine.xml包,在下文中一共展示了JRXmlTemplateLoader类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: prepareReportParameters
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
private Map<String, Object> prepareReportParameters(ReportType reportType, OperationResult parentResult) {
Map<String, Object> params = new HashMap<String, Object>();
if (reportType.getTemplateStyle() != null) {
byte[] reportTemplateStyleBase64 = reportType.getTemplateStyle();
byte[] reportTemplateStyle = Base64.decodeBase64(reportTemplateStyleBase64);
try {
LOGGER.trace("Style template string {}", new String(reportTemplateStyle));
InputStream inputStreamJRTX = new ByteArrayInputStream(reportTemplateStyle);
JRTemplate templateStyle = JRXmlTemplateLoader.load(inputStreamJRTX);
params.put(PARAMETER_TEMPLATE_STYLES, templateStyle);
LOGGER.trace("Style template parameter {}", templateStyle);
} catch (Exception ex) {
LOGGER.error("Error create style template parameter {}", ex.getMessage());
throw new SystemException(ex);
}
}
// for our special datasource
params.put(PARAMETER_REPORT_OID, reportType.getOid());
params.put(PARAMETER_OPERATION_RESULT, parentResult);
params.put(ReportService.PARAMETER_REPORT_SERVICE, reportService);
return params;
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:27,代码来源:ReportCreateTaskHandler.java
示例2: publish
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
public File publish(JasperDesign jd, JRReportTemplate img, MReportUnit mrunit, IProgressMonitor monitor, Set<String> fileset, IFile file) throws Exception {
AFileResource fres = findFile(mrunit, monitor, jd, fileset, getExpression(img), file);
if (fres != null) {
JRSimpleTemplate jrt = (JRSimpleTemplate) JRXmlTemplateLoader.load(fres.getFile());
for (JRTemplateReference r : jrt.getIncludedTemplatesList()) {
IFile[] fs = root.findFilesForLocationURI(fres.getFile().toURI());
if (fs != null && fs.length > 0) {
File ftr = findFile(file, r.getLocation());
if (ftr != null && ftr.exists()) {
fileset.add(ftr.getAbsolutePath());
addResource(monitor, mrunit, fileset, ftr, new PublishOptions());
}
}
}
return fres.getFile();
}
return null;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:ImpStyleTemplate.java
示例3: getStylesReference
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
public static void getStylesReference(IFile file, String location, List<JRStyle> list, Set<File> files) {
if (location == null)
return;
File fileToBeOpened = getFile(location, file);
if (files.contains(fileToBeOpened))
return;
if (fileToBeOpened != null && fileToBeOpened.exists() && fileToBeOpened.isFile()) {
files.add(fileToBeOpened);
JRSimpleTemplate jrst = (JRSimpleTemplate) JRXmlTemplateLoader.load(fileToBeOpened);
list.addAll(jrst.getStylesList());
List<JRTemplateReference> tlist = jrst.getIncludedTemplatesList();
if (tlist != null && !tlist.isEmpty()) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile[] fs = root.findFilesForLocationURI(fileToBeOpened.toURI());
if (fs != null && fs[0] != null)
for (JRTemplateReference tr : tlist)
getStylesReference(fs[0], tr.getLocation(), list, files);
}
}
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:21,代码来源:StyleTemplateFactory.java
示例4: createTemplateReference
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
public static void createTemplateReference(ANode parent, String location, int newIndex, Set<String> set,
boolean editable, IFile file) {
if (file == null)
return;
File fileToBeOpened = getFile(location, file);
if (fileToBeOpened != null && fileToBeOpened.exists() && fileToBeOpened.isFile()) {
JRSimpleTemplate jrst = (JRSimpleTemplate) JRXmlTemplateLoader.load(fileToBeOpened);
createTemplate(parent, set, editable, file, fileToBeOpened, jrst);
}
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:StyleTemplateFactory.java
示例5: createObject
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
private void createObject() {
if (jrTemplate == null) {
FilteredResourcesSelectionDialog fd = new FilteredHelpDialog(Display.getCurrent().getActiveShell(),false, ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
fd.setInitialPattern("*.jrtx");//$NON-NLS-1$
if (fd.open() == Dialog.OK) {
IFile file = (IFile) fd.getFirstResult();
File fileToBeOpened = file.getRawLocation().makeAbsolute().toFile();
boolean showErrorMessage = false;
//Check if the file is a valid template before add it to the model
if (fileToBeOpened != null && fileToBeOpened.exists() && fileToBeOpened.isFile()) {
try{
//Try to load the file to see if it is a valid template
JRXmlTemplateLoader.load(fileToBeOpened);
this.jrTemplate = MStyleTemplate.createJRTemplate();
JRDesignExpression jre = new JRDesignExpression();
jre.setText("\"" + getStylePath(file) + "\"");//$NON-NLS-1$ //$NON-NLS-2$
((JRDesignReportTemplate) jrTemplate).setSourceExpression(jre);
} catch(Exception ex){
showErrorMessage = true;
}
} else {
showErrorMessage = true;
}
if (showErrorMessage){
MessageDialog.open(MessageDialog.ERROR, Display.getCurrent().getActiveShell(), Messages.UIUtils_ExceptionTitle, Messages.CreateStyleTemplateCommand_loadStyleError, SWT.NONE);
}
}
}
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:30,代码来源:CreateStyleTemplateCommand.java
示例6: xml2model
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
protected void xml2model(InputStream in) {
JRTemplate jd = JRXmlTemplateLoader.load(in);
ANode m = new MRoot(null, new JasperDesign());
IFile file = ((IFileEditorInput) getEditorInput()).getFile();
MStylesTemplate ms = new MStylesTemplate(m, file);
ms.setValue(jd);
ms.setJasperConfiguration(jrContext);
StyleTemplateFactory.createTemplate(ms, new HashSet<String>(), true, file, file.getLocation().toFile(),
(JRSimpleTemplate) jd);
setModel(m);
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:12,代码来源:JRtxEditor.java
示例7: getStyleInTemplate
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
List getStyleInTemplate(JRReportTemplate template)
{
List styleNames = new ArrayList();
if (template != null)
{
String fileNameExp = Misc.getExpressionText(template.getSourceExpression());
if (fileNameExp != null && fileNameExp.length() > 0)
{
ExpressionFileResolver resolver = new ExpressionFileResolver(
(JRDesignExpression)template.getSourceExpression(),jasperDesign.getMainDesignDataset(), jasperDesign);
File f = resolver.resolveFile(null);
if (f!=null && f.exists())
{
try {
// try to load this jrtx template...
JRSimpleTemplate template2 = (JRSimpleTemplate) JRXmlTemplateLoader.load(new FileInputStream(f));
JRStyle[] styles = template2.getStyles();
for (int i=0; i<styles.length; ++i)
{
styleNames.add(new Tag(styles[i].getName(),I18n.getString("property.styleNameReference", styles[i].getName())));
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
return styleNames;
}
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:32,代码来源:AbstractStyleProperty.java
示例8: loadStyles
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
public static DRStyle[] loadStyles(String fileName) throws DRException {
Validate.notNull(fileName, "fileName must not be null");
try {
return loadStyles(JRXmlTemplateLoader.load(fileName));
} catch (JRException e) {
throw new DRException(e);
}
}
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:9,代码来源:JasperTemplateStyleLoader.java
示例9: loadTemplateStyles
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
protected void loadTemplateStyles(String location, Set<String> loadedLocations, Set<String> parentLocations)
{
if (!parentLocations.add(location))
{
throw
new JRRuntimeException(
EXCEPTION_MESSAGE_KEY_CIRCULAR_DEPENDENCY_FOUND,
new Object[]{location}
);
}
if (!loadedLocations.add(location))
{
//already loaded
return;
}
JRTemplate template;
try
{
template = JRXmlTemplateLoader.getInstance(getJasperReportsContext()).loadTemplate(location);
}
catch (Exception e)
{
log.warn("Could not load template from location " + location
+ "; some styles might remain unresolved.");
return;
}
JRTemplateReference[] includedTemplates = template.getIncludedTemplates();
if (includedTemplates != null)
{
for (int i = 0; i < includedTemplates.length; i++)
{
JRTemplateReference reference = includedTemplates[i];
loadTemplateStyles(reference.getLocation(), loadedLocations, parentLocations);
}
}
collectStyles(template.getStyles());
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:42,代码来源:ReportConverter.java
示例10: loadTemplate
import net.sf.jasperreports.engine.xml.JRXmlTemplateLoader; //导入依赖的package包/类
protected static JRTemplate loadTemplate(Object source, JRBaseFiller filler) throws JRException
{
JRTemplate template;
if (filler.fillContext.hasLoadedTemplate(source))
{
template = filler.fillContext.getLoadedTemplate(source);
}
else
{
if (log.isDebugEnabled())
{
log.debug("Loading styles template from " + source);
}
if (source instanceof String)
{
template = JRXmlTemplateLoader.getInstance(filler.getJasperReportsContext()).loadTemplate((String) source);
}
else if (source instanceof File)
{
template = JRXmlTemplateLoader.getInstance(filler.getJasperReportsContext()).loadTemplate((File) source);
}
else if (source instanceof URL)
{
template = JRXmlTemplateLoader.getInstance(filler.getJasperReportsContext()).loadTemplate((URL) source);
}
else if (source instanceof InputStream)
{
template = JRXmlTemplateLoader.getInstance(filler.getJasperReportsContext()).loadTemplate((InputStream) source);
}
else
{
throw
new JRRuntimeException(
EXCEPTION_MESSAGE_KEY_UNKNOWN_TEMPLATE_SOURCE,
new Object[]{source.getClass().getName()}
);
}
filler.fillContext.registerLoadedTemplate(source, template);
}
return template;
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:44,代码来源:JRFillReportTemplate.java
注:本文中的net.sf.jasperreports.engine.xml.JRXmlTemplateLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论