Java 类net.sf.jasperreports.engine.ParameterContributor 实例源码

项目:jasperreports    文件:DataAdapterParameterContributorFactory.java   
@Override
public List<ParameterContributor> getContributors(ParameterContributorContext context) throws JRException
{
    List<ParameterContributor> contributors = new ArrayList<ParameterContributor>();

    String dataAdapterUri = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getProperty(context.getDataset(), PROPERTY_DATA_ADAPTER_LOCATION); 
    if (dataAdapterUri != null)
    {
        DataAdapterResource dataAdapterResource = RepositoryUtil.getInstance(context.getJasperReportsContext()).getResourceFromLocation(dataAdapterUri, DataAdapterResource.class);
        ParameterContributor dataAdapterService = DataAdapterServiceUtil.getInstance(context).getService(dataAdapterResource.getDataAdapter());

        return Collections.singletonList(dataAdapterService);
    }

    return contributors;
}
项目:jasperreports    文件:JRFillDataset.java   
/**
 *
 */
private List<ParameterContributor> getParameterContributors(ParameterContributorContext context) throws JRException
{
    List<ParameterContributor> allContributors = null;
    List<?> factories = getJasperReportsContext().getExtensions(ParameterContributorFactory.class);
    if (factories != null && factories.size() > 0)
    {
        allContributors = new ArrayList<ParameterContributor>();
        for (Iterator<?> it = factories.iterator(); it.hasNext();)
        {
            ParameterContributorFactory factory = (ParameterContributorFactory)it.next();
            List<ParameterContributor> contributors = factory.getContributors(context);
            if (contributors != null)
            {
                allContributors.addAll(contributors);
            }
        }
    }
    return allContributors;
}
项目:jasperreports    文件:JRFillDataset.java   
/**
 * 
 */
public void contributeParameters(Map<String,Object> parameterValues) throws JRException
{
    parameterContributors = getParameterContributors(new ParameterContributorContext(getJasperReportsContext(), this, parameterValues));
    if (parameterContributors != null)
    {
        for(ParameterContributor contributor : parameterContributors)
        {
            contributor.contributeParameters(parameterValues);
        }
    }
}
项目:jasperreports    文件:JRFillDataset.java   
/**
 * 
 */
public void disposeParameterContributors()
{
    if (parameterContributors != null)
    {
        for(ParameterContributor contributor : parameterContributors)
        {
            contributor.dispose();
        }
    }
}
项目:jasperreports    文件:HeaderToolbarParameterContributorFactory.java   
@Override
public List<ParameterContributor> getContributors(ParameterContributorContext context) throws JRException
{
    return Collections.<ParameterContributor>singletonList(new HeaderToolbarParameterContributor(context));
}
项目:jasperreports    文件:SortParameterContributorFactory.java   
@Override
public List<ParameterContributor> getContributors(ParameterContributorContext context) throws JRException
{
    return Collections.<ParameterContributor>singletonList(new SortParameterContributor(context));
}