本文整理汇总了Java中net.sf.jasperreports.engine.JRTemplate类的典型用法代码示例。如果您正苦于以下问题:Java JRTemplate类的具体用法?Java JRTemplate怎么用?Java JRTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRTemplate类属于net.sf.jasperreports.engine包,在下文中一共展示了JRTemplate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: collectTemplates
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
protected void collectTemplates() throws JRException
{
templates = new ArrayList<JRTemplate>();
if (reportTemplates != null)
{
for (JRFillReportTemplate reportTemplate : reportTemplates)
{
JRTemplate template = reportTemplate.evaluate();
if (template != null)
{
templates.add(template);
}
}
}
Collection<JRTemplate> paramTemplates = (Collection<JRTemplate>) mainDataset.getParameterValue(
JRParameter.REPORT_TEMPLATES, true);
if (paramTemplates != null)
{
templates.addAll(paramTemplates);
}
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:JRBaseFiller.java
示例2: collectStyles
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
protected void collectStyles(JRTemplate template, List<JRStyle> externalStyles,
Set<String> loadedLocations, Set<String> templateParentLocations) throws JRException
{
collectIncludedTemplates(template, externalStyles,
loadedLocations, templateParentLocations);
JRStyle[] templateStyles = template.getStyles();
if (templateStyles != null)
{
for (int i = 0; i < templateStyles.length; i++)
{
JRStyle style = templateStyles[i];
String styleName = style.getName();
if (styleName == null)
{
throw
new JRRuntimeException(
EXCEPTION_MESSAGE_KEY_EXTERNAL_STYLE_NAME_NOT_SET,
(Object[])null
);
}
externalStyles.add(style);
}
}
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:JRBaseFiller.java
示例3: JRFillContext
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
/**
* Constructs a fill context.
*/
public JRFillContext(BaseReportFiller masterFiller)
{
this.masterFiller = masterFiller;
this.jasperReportsContext = masterFiller.getJasperReportsContext();
this.styledTextUtil = JRStyledTextUtil.getInstance(jasperReportsContext);
loadedImageRenderers = new HashMap<Object,Renderable>();
renderersCache = new RenderersCache(jasperReportsContext);
loadedSubreports = new HashMap<Object,JasperReport>();
loadedTemplates = new HashMap<Object,JRTemplate>();
deduplicableRegistry = new DeduplicableRegistry();
FontUtil.getInstance(jasperReportsContext).resetThreadMissingFontsCache();
legacyElementStretchEnabled =
JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(
StretchTypeEnum.PROPERTY_LEGACY_ELEMENT_STRETCH_ENABLED
);
legacyBandEvaluationEnabled =
JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(
JRCalculator.PROPERTY_LEGACY_BAND_EVALUATION_ENABLED
);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:JRFillContext.java
示例4: prepareReportParameters
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的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
示例5: componentShowing
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
@Override
public void componentShowing() {
super.componentShowing();
JRTemplate template = ((JRTXEditorSupport)cloneableEditorSupport()).getCurrentModel();
if (template != null && ((JRTXEditorSupport)cloneableEditorSupport()).isModified())
{
// Update the content...
try {
String content = JRXmlTemplateWriter.writeTemplate(template,"UTF-8");
getEditorPane().setText(content);
getEditorPane().setCaretPosition(0);
((JRTXVisualView)((JRTXEditorSupport)cloneableEditorSupport()).descriptions[0]).setNeedModelRefresh(false);
} catch (Exception ex)
{
ex.printStackTrace();
}
}
((JRTXEditorSupport)cloneableEditorSupport()).setCurrentModel(null);
}
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:21,代码来源:JRTXSourceEditor.java
示例6: writeTemplate
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
/**
* Returns the XML representation of a template.
*
* @param jasperReportsContext
* @param template the template
* @param encoding the XML encoding to use
* @return the XML representation of the template
*/
public static String writeTemplate(JasperReportsContext jasperReportsContext,
JRTemplate template, String encoding)
{
StringWriter stringOut = new StringWriter();
try
{
writeTemplate(jasperReportsContext, template, stringOut, encoding);
}
catch (IOException e)
{
throw new JRRuntimeException(e);
}
return stringOut.toString();
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:JRXmlTemplateWriter.java
示例7: JRXmlTemplateWriter
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
/**
* Creates an XML template writer.
*
* @param jasperReportsContext
* @param template the template to write
* @param out the output writer
* @param encoding the XML encoding to use
*/
public JRXmlTemplateWriter(JasperReportsContext jasperReportsContext,
JRTemplate template, Writer out, String encoding)
{
this.template = template;
this.encoding = encoding;
String version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
useWriter(new JRXmlWriteHelper(out), version);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:JRXmlTemplateWriter.java
示例8: collectTemplateStyles
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
protected List<JRStyle> collectTemplateStyles() throws JRException
{
collectTemplates();
List<JRStyle> externalStyles = new ArrayList<JRStyle>();
HashSet<String> loadedLocations = new HashSet<String>();
for (JRTemplate template : templates)
{
collectStyles(template, externalStyles, loadedLocations);
}
return externalStyles;
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:13,代码来源:JRBaseFiller.java
示例9: collectIncludedTemplates
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
protected void collectIncludedTemplates(JRTemplate template, List<JRStyle> externalStyles,
Set<String> loadedLocations, Set<String> templateParentLocations) throws JRException
{
JRTemplateReference[] includedTemplates = template.getIncludedTemplates();
if (includedTemplates != null)
{
for (int i = 0; i < includedTemplates.length; i++)
{
JRTemplateReference reference = includedTemplates[i];
String location = reference.getLocation();
if (!templateParentLocations.add(location))
{
throw
new JRRuntimeException(
EXCEPTION_MESSAGE_KEY_CIRCULAR_DEPENDENCY_FOUND,
new Object[]{location}
);
}
if (loadedLocations.add(location))
{
//template not yet loaded
JRTemplate includedTemplate = JRFillReportTemplate.loadTemplate(
location, this);
collectStyles(includedTemplate, externalStyles,
loadedLocations, templateParentLocations);
}
}
}
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:33,代码来源:JRBaseFiller.java
示例10: xml2model
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的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
示例11: loadStyles
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
private static DRStyle[] loadStyles(JRTemplate template) {
Validate.notNull(template, "template must not be null");
JRStyle[] jrStyles = template.getStyles();
DRStyle[] styles = new DRStyle[jrStyles.length];
for (int i = 0; i < jrStyles.length; i++) {
JRStyle jrStyle = jrStyles[i];
styles[i] = convertStyle(jrStyle);
}
return styles;
}
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:11,代码来源:JasperTemplateStyleLoader.java
示例12: loadTemplateStyles
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的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
示例13: load
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
/**
* @see #loadTemplate(String)
*/
public static JRTemplate load(String location) throws JRException
{
return getDefaultInstance().loadTemplate(location);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:JRXmlTemplateLoader.java
示例14: loadTemplate
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的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
示例15: getTemplates
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
public List<JRTemplate> getTemplates()
{
return templates;
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:5,代码来源:JRBaseFiller.java
示例16: copyTemplatesParameter
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
protected void copyTemplatesParameter(Map<String, Object> parameterValues)
{
// copy the main report's templates
List<JRTemplate> templates = filler.getTemplates();
parameterValues.put(JRParameter.REPORT_TEMPLATES, templates);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:7,代码来源:FillTableSubreport.java
示例17: setPreviewStyle
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
public void setPreviewStyle(JRStyle style, JRTemplate template)
{
// Remove the styles...
STYLE_REPORT.setDefaultStyle(null);
STYLE_REPORT.getStylesList().clear();
STYLE_REPORT.getStylesMap().clear();
if (style == null)
{
jLabelStyleName.setText("No style selected");
jPanelGraphicElements.repaint();
jPanelTextElements.repaint();
setElementsStyle(null);
}
else
{
jLabelStyleName.setText(style.getName());
try {
JRStyle[] styles = template.getStyles();
for (int i=0; i<styles.length; ++i)
{
STYLE_REPORT.addStyle(styles[i]);
if (styles[i].isDefault()) {
STYLE_REPORT.setDefaultStyle(style);
}
}
// The current style has the precedence...
if (style.isDefault()) {
STYLE_REPORT.setDefaultStyle(style);
}
setElementsStyle(style);
jPanelGraphicElements.repaint();
jPanelTextElements.repaint();
} catch (JRException ex)
{
}
}
}
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:42,代码来源:JRTXPreviewPanel.java
示例18: writeTemplateToFile
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
/**
* Writes the XML representation of a template to a file.
* <p/>
* Uses {@link #DEFAULT_ENCODING the default encoding}.
*
* @param template the template
* @param outputFile the output file name
*/
public static void writeTemplateToFile(JRTemplate template, String outputFile)
{
writeTemplateToFile(template, outputFile, DEFAULT_ENCODING);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:13,代码来源:JRXmlTemplateWriter.java
示例19: loadTemplate
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
/**
* Parses a template XML found at a specified location into a {@link JRTemplate template object}.
*
* @param location the template XML location.
* Can be a URL, a file path or a classloader resource name.
* @return the template object
* @throws JRException when the location cannot be resolved or read
* @see RepositoryUtil#getBytesFromLocation(String)
*/
public JRTemplate loadTemplate(String location) throws JRException
{
byte[] data = RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(location);
return load(new ByteArrayInputStream(data));
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:15,代码来源:JRXmlTemplateLoader.java
示例20: getLoadedTemplate
import net.sf.jasperreports.engine.JRTemplate; //导入依赖的package包/类
/**
* Gets a cached template.
*
* @param source the source of the templage
* @return the cached templage
* @see #registerLoadedTemplate(Object, JRTemplate)
*/
public JRTemplate getLoadedTemplate(Object source)
{
return loadedTemplates.get(source);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:JRFillContext.java
注:本文中的net.sf.jasperreports.engine.JRTemplate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论