本文整理汇总了Java中fr.opensagres.xdocreport.template.formatter.NullImageBehaviour类的典型用法代码示例。如果您正苦于以下问题:Java NullImageBehaviour类的具体用法?Java NullImageBehaviour怎么用?Java NullImageBehaviour使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NullImageBehaviour类属于fr.opensagres.xdocreport.template.formatter包,在下文中一共展示了NullImageBehaviour类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNullLogo
import fr.opensagres.xdocreport.template.formatter.NullImageBehaviour; //导入依赖的package包/类
@FieldMetadata( images = {
@ImageMetadata( name = "imageNotExistsAndRemoveImageTemplate", behaviour = NullImageBehaviour.RemoveImageTemplate ),
@ImageMetadata( name = "imageNotExistsAndKeepImageTemplate", behaviour = NullImageBehaviour.KeepImageTemplate ) } )
public InputStream getNullLogo()
{
return null;
}
示例2: getNullLogoFile
import fr.opensagres.xdocreport.template.formatter.NullImageBehaviour; //导入依赖的package包/类
@FieldMetadata( images = {
@ImageMetadata( name = "fileImageNotExistsAndRemoveImageTemplate", behaviour = NullImageBehaviour.RemoveImageTemplate ),
@ImageMetadata( name = "fileImageNotExistsAndKeepImageTemplate", behaviour = NullImageBehaviour.KeepImageTemplate ) } )
public File getNullLogoFile()
{
return null;
}
示例3: generateLettre
import fr.opensagres.xdocreport.template.formatter.NullImageBehaviour; //导入依赖的package包/类
/**
* @param templateLettre
* @param data
* @param fichierSignature
* @return l'inputstram de la lettre
*/
public InputStream generateLettre(final String templateLettre, final ExportLettreCandidat data,
final InputStream fichierSignature) {
InputStream template = MethodUtils.getXDocReportTemplate(templateLettre, i18nController.getLangueCandidat(),
cacheController.getLangueDefault().getCodLangue());
if (template == null) {
return null;
}
ByteArrayInOutStream out = new ByteArrayInOutStream();
try {
/* Ajout date et heure */
data.setDateHeure(formatterDateTime.format(LocalDateTime.now()));
data.setDate(formatterDate.format(LocalDateTime.now()));
/* Generation du template */
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(template, TemplateEngineKind.Velocity);
/* Variables */
IContext context = report.createContext();
context.put("data", data);
/* Pour l'image */
FieldsMetadata metadata = new FieldsMetadata();
if (fichierSignature != null) {
metadata.addFieldAsImage("imageSignature");
IImageProvider originalSizeLogo = new ByteArrayImageProvider(fichierSignature, true);
context.put("imageSignature", originalSizeLogo);
} else {
/* Si pas de fichier, on supprime l'image */
metadata.addFieldAsImage("imageSignature", NullImageBehaviour.RemoveImageTemplate);
}
report.setFieldsMetadata(metadata);
/* On vérifie si on affiche le tableau de signataire */
if (data.getLibelleSignature().equals("") && fichierSignature == null) {
context.put("showSignataire", false);
} else {
context.put("showSignataire", true);
}
/* Transformation en pdf */
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
report.convert(context, options, out);
return signaturePdfManager.signPdf(out);
} catch (Exception e) {
// probleme de taille de signature XDocConverterException + StackOverflowError
if (e.getClass() != null && e instanceof XDocConverterException && e.getCause() != null
&& e.getCause() instanceof StackOverflowError) {
Notification.show(applicationContext.getMessage("candidature.lettre.download.sign.error", null,
UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
} else {
Notification.show(applicationContext.getMessage("candidature.lettre.download.error", null,
UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
logger.error("erreur a la création de la lettre", e);
}
return null;
} finally {
// fermeture des fichiers
MethodUtils.closeRessource(fichierSignature);
MethodUtils.closeRessource(template);
MethodUtils.closeRessource(out);
}
}