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


Java IContext.put方法代码示例

本文整理汇总了Java中fr.opensagres.xdocreport.template.IContext.put方法的典型用法代码示例。如果您正苦于以下问题:Java IContext.put方法的具体用法?Java IContext.put怎么用?Java IContext.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fr.opensagres.xdocreport.template.IContext的用法示例。


在下文中一共展示了IContext.put方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
public void populateContext( IContext context, IXDocReport report, HttpServletRequest request )
{
    String name = request.getParameter( "name" );
    Project project = new Project( name );
    context.put( "project", project );

    int nbDevelopers = 0;
    try
    {
        nbDevelopers = Integer.parseInt( request.getParameter( "nbDevelopers" ) );
    }
    catch ( Throwable e )
    {

    }
    List<Developer> developers = new ArrayList<Developer>( nbDevelopers );
    for ( int i = 0; i < nbDevelopers; i++ )
    {
        developers.add( new Developer( "Name" + i, "LastName" + i, "Mail" + i ) );
    }
    context.put( "developers", developers );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:23,代码来源:ODTProjectWithVelocityListController.java

示例2: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
@Override
protected void populateContext( IContext context, String reportId, HttpServletRequest req )
    throws XDocReportException
{
    String project = req.getParameter( "project" );
    context.put( "project", project );
    String url = req.getParameter( "url" );
    context.put( "url", url );

    String comments_html = req.getParameter( "comments_html" );
    context.put( "comments_html", comments_html );
    String comments_gwiki = req.getParameter( "comments_gwiki" );
    context.put( "comments_gwiki", comments_gwiki );
    String comments_mediawiki = req.getParameter( "comments_mediawiki" );
    context.put( "comments_mediawiki", comments_mediawiki );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:17,代码来源:TextStylingReportServlet.java

示例3: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
@Override
protected void populateContext( IContext context, String reportId, HttpServletRequest request )
    throws XDocReportException
{
    if ( ODT_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) || DOCX_PROJECT_WITH_VELOCITY_LIST.equals( reportId ) )
    {
        String name = request.getParameter( "name" );
        Project project = new Project( name );
        context.put( "project", project );

        int nbDevelopers = 0;
        try
        {
            nbDevelopers = Integer.parseInt( request.getParameter( "nbDevelopers" ) );
        }
        catch ( Throwable e )
        {

        }
        List<Developer> developers = new ArrayList<Developer>( nbDevelopers );
        for ( int i = 0; i < nbDevelopers; i++ )
        {
            developers.add( new Developer( "Name" + i, "LastName" + i, "Mail" + i ) );
        }
        context.put( "developers", developers );
    }
    else
    {
        throw new XDocReportNotFoundException( reportId );
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:32,代码来源:MyReportServlet.java

示例4: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
@Override
protected void populateContext( IContext context, String reportId, HttpServletRequest req )
    throws XDocReportException
{
    if ( reportId.equals( ODT_HELLO_WORD_WITH_VELOCITY ) )
    {
        // reportId = ODTHelloWorldWithVelocity, prepare context with name
        String name = req.getParameter( "name" );
        context.put( "name", name );
    }
    else
    {
        throw new XDocReportNotFoundException( reportId );
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:16,代码来源:HelloWorldReportServlet.java

示例5: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
@Override
public void populateContext( IContext context, HttpServletRequest request )
{

    List<DynamicBean> dataModelList = new ArrayList<DynamicBean>();
    for ( MetaDataModelSimpleField field : fields )
    {
        String name = field.getName();
        String[] values = request.getParameterValues( name );
        if ( values != null )
        {
            for ( int i = 0; i < values.length; i++ )
            {
                DynamicBean bean = null;
                if ( dataModelList.size() >= i + 1 )
                {
                    bean = dataModelList.get( i );
                }
                else
                {
                    bean = new DynamicBean();
                    dataModelList.add( bean );
                }
                String value = values[i];
                String key = name.substring( super.getName().length() + 1, name.length() );
                bean.setValue( key.split( "[.]" ), value, 0 );
            }
        }
    }
    context.put( super.getName(), dataModelList );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:32,代码来源:MetaDataModelListField.java

示例6: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
public void populateContext( IContext context, HttpServletRequest request )
{
    String value = request.getParameter( super.getName() );
    if ( value != null )
    {
        context.put( super.getName(), value );
    }
}
 
开发者ID:DistX,项目名称:Learning,代码行数:9,代码来源:MetaDataModelSimpleField.java

示例7: generateDocumentFromTemplate

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
private static void generateDocumentFromTemplate(
		TemplateModel templateModel, OutputStream out)
		throws XDocReportException, IOException {
	InputStream in = null;
	try {
		in = templateModel.getTemplateFile().getInputStream();

		IXDocReport report = null;
		if (TemplateType.VELOCITY.equals(templateModel.getTemplateType())) {
			report = XDocReportRegistry.getRegistry().loadReport(in,
					TemplateEngineKind.Velocity);
		} else {
			report = XDocReportRegistry.getRegistry().loadReport(in,
					TemplateEngineKind.Freemarker);
		}

		IContext context = report.createContext();
		context.put(templateModel.getInTemplateDesignation(), templateModel);

		if (templateModel.getPostProcessor() != null) {
			ByteArrayOutputStream tempOutputStream = new ByteArrayOutputStream();
			report.process(context, tempOutputStream);
			InputStream tempInputStream = new ByteArrayInputStream(
					tempOutputStream.toByteArray());
			ODSProcessor.transformODS(tempInputStream, out,
					templateModel.getPostProcessor());
		} else {
			report.process(context, out);
		}
	} finally {
		IOUtils.closeQuietly(in);
	}
}
 
开发者ID:Altrusoft,项目名称:docserv,代码行数:34,代码来源:Application.java

示例8: generateLettre

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的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);
	}
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:73,代码来源:CandidatureController.java

示例9: populateContext

import fr.opensagres.xdocreport.template.IContext; //导入方法依赖的package包/类
public void populateContext( IContext context, IXDocReport report, HttpServletRequest request )
{
    String name = request.getParameter( "name" );
    context.put( "name", name );
}
 
开发者ID:DistX,项目名称:Learning,代码行数:6,代码来源:HelloWorldController.java


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