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

项目:jasperreports    文件:JRFillDataset.java   
/**
 * Creates the scriptlets.
 * 
 * @return the scriptlets list
 * @throws JRException
 */
protected List<JRAbstractScriptlet> createScriptlets(Map<String,Object> parameterValues) throws JRException
{
    ScriptletFactoryContext context = new ScriptletFactoryContext(getJasperReportsContext(), this, parameterValues);

    scriptlets = new ArrayList<JRAbstractScriptlet>();

    List<ScriptletFactory> factories = getJasperReportsContext().getExtensions(ScriptletFactory.class);
    for (Iterator<ScriptletFactory> it = factories.iterator(); it.hasNext();)
    {
        ScriptletFactory factory = it.next();
        List<JRAbstractScriptlet> tmpScriptlets = factory.getScriplets(context);
        if (tmpScriptlets != null)
        {
            scriptlets.addAll(tmpScriptlets);
        }
    }

    if (scriptlets.size() == 0)
    {
        scriptlets.add(0, new JRDefaultScriptlet());
    }

    return scriptlets;
}
项目:PDFReporter-Studio    文件:MSystemScriptlet.java   
/**
 * Creates the property descriptors.
 * 
 * @param desc
 *          the desc
 */
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
    NTextPropertyDescriptor nameD = new NTextPropertyDescriptor(JRDesignScriptlet.PROPERTY_NAME, Messages.common_name);
    nameD.setDescription(Messages.MScriptlet_name_description);
    desc.add(nameD);

    List<Class<?>> clist = new ArrayList<Class<?>>();
    clist.add(JRAbstractScriptlet.class);
    clist.add(JRDefaultScriptlet.class);
    NClassTypePropertyDescriptor classD = new NClassTypePropertyDescriptor(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME,
            Messages.common_class);
    classD.setClasses(clist);
    classD.setDescription(Messages.MScriptlet_class_description);
    desc.add(classD);

    NTextPropertyDescriptor descriptionD = new NTextPropertyDescriptor(JRDesignScriptlet.PROPERTY_DESCRIPTION,
            Messages.common_description);
    descriptionD.setDescription(Messages.MScriptlet_description_description);
    desc.add(descriptionD);
}
项目:jasperreports    文件:JRDesignDataset.java   
/**
 * Sets the scriptlet class name.
 * <p>
 * If no scriptlet class name is specified, a default scriptlet is used.
 * 
 * @param scriptletClass the class name of the scriptlet
 * @see net.sf.jasperreports.engine.JRDataset#getScriptletClass()
 */
public void setScriptletClass(String scriptletClass)
{
    Object old = this.scriptletClass;
    this.scriptletClass = scriptletClass;
    if (scriptletClass == null)
    {
        ((JRDesignParameter) parametersMap.get(JRParameter.REPORT_SCRIPTLET)).setValueClass(JRAbstractScriptlet.class);
    }
    else
    {
        ((JRDesignParameter) parametersMap.get(JRParameter.REPORT_SCRIPTLET)).setValueClassName(scriptletClass);
    }
    getEventSupport().firePropertyChange(PROPERTY_SCRIPTLET_CLASS, old, this.scriptletClass);
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void setData(
    Map<String,JRFillParameter> parsm,
    Map<String,JRFillField> fldsm,
    Map<String,JRFillVariable> varsm,
    JRFillGroup[] grps
    )
{
    super.setData(parsm, fldsm, varsm, grps);

    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().setData(parsm, fldsm, varsm, grps);
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void beforeReportInit() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().beforeReportInit();
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void afterReportInit() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().afterReportInit();
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void beforePageInit() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().beforePageInit();
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void afterPageInit() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().afterPageInit();
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void beforeColumnInit() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().beforeColumnInit();
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void afterColumnInit() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().afterColumnInit();
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void beforeGroupInit(String groupName) throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().beforeGroupInit(groupName);
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void afterGroupInit(String groupName) throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().afterGroupInit(groupName);
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void beforeDetailEval() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().beforeDetailEval();
    }
}
项目:jasperreports    文件:JRFillDatasetScriptlet.java   
@Override
public void afterDetailEval() throws JRScriptletException
{
    for(Iterator<JRAbstractScriptlet> it = dataset.scriptlets.iterator(); it.hasNext();)
    {
        it.next().afterDetailEval();
    }
}
项目:jasperreports    文件:GovernorFactory.java   
@Override
public List<JRAbstractScriptlet> getScriplets(ScriptletFactoryContext context) throws JRException
{
    List<JRAbstractScriptlet> scriptlets = new ArrayList<JRAbstractScriptlet>();

    boolean maxPagesEnabled = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getBooleanProperty(context.getDataset(), MaxPagesGovernor.PROPERTY_MAX_PAGES_ENABLED, true);
    if (maxPagesEnabled)
    {
        int maxPages = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getIntegerProperty(context.getDataset(), MaxPagesGovernor.PROPERTY_MAX_PAGES, 0);
        if (maxPages > 0)
        {
            scriptlets.add(new MaxPagesGovernor(maxPages));
        }
    }

    boolean timeoutEnabled = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getBooleanProperty(context.getDataset(), TimeoutGovernor.PROPERTY_TIMEOUT_ENABLED, true);
    if (timeoutEnabled)
    {
        long timeout = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getLongProperty(context.getDataset(), TimeoutGovernor.PROPERTY_TIMEOUT, 0l);
        if (timeout > 0)
        {
            scriptlets.add(new TimeoutGovernor(timeout));
        }
    }

    return scriptlets;
}
项目:jasperreports    文件:TableReportDataset.java   
public void addScriptlet(String name, Class<? extends JRAbstractScriptlet> type)
{
    JRDesignScriptlet scriptlet = new JRDesignScriptlet();
    scriptlet.setName(name);
    scriptlet.setValueClass(type);

    JRDesignParameter parameter = new JRDesignParameter();
    parameter.setName(name + JRScriptlet.SCRIPTLET_PARAMETER_NAME_SUFFIX);
    parameter.setValueClass(scriptlet.getValueClass());
    parameter.setSystemDefined(true);
    parameter.setForPrompting(false);

    scriptlets.add(scriptlet);
    parameters.add(parameter);
}
项目:PDFReporter-Studio    文件:MScriptlet.java   
/**
 * Creates the property descriptors.
 * 
 * @param desc
 *          the desc
 */
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
    NTextPropertyDescriptor nameD = new NTextPropertyDescriptor(JRDesignScriptlet.PROPERTY_NAME, Messages.common_name);
    nameD.setDescription(Messages.MScriptlet_name_description);
    desc.add(nameD);

    List<Class<?>> clist = new ArrayList<Class<?>>();
    clist.add(JRAbstractScriptlet.class);
    clist.add(JRDefaultScriptlet.class);
    NClassTypePropertyDescriptor classD = new NClassTypePropertyDescriptor(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME,
            Messages.common_class);
    classD.setClasses(clist);
    classD.setDescription(Messages.MScriptlet_class_description);
    desc.add(classD);
    classD.setHelpRefBuilder(new HelpReferenceBuilder(
            "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#scriptlet_class"));

    NTextPropertyDescriptor descriptionD = new NTextPropertyDescriptor(JRDesignScriptlet.PROPERTY_DESCRIPTION,
            Messages.common_description);
    descriptionD.setDescription(Messages.MScriptlet_description_description);
    desc.add(descriptionD);
    descriptionD.setHelpRefBuilder(new HelpReferenceBuilder(
            "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#scriptletDescription"));

    setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#scriptlet");
}
项目:PDFReporter-Studio    文件:RecordCountScriptletFactory.java   
public List<JRAbstractScriptlet> getScriplets(ScriptletFactoryContext context) throws JRException {
    if (list == null) {
        list = new ArrayList<JRAbstractScriptlet>();
    }
    list.add(new RecordCountScriptlet());
    return list;
}
项目:PDFReporter-Studio    文件:RecordCountScriptletFactory.java   
public int getRecordCount() {
    int count = 0;
    if (list != null)
        for (JRAbstractScriptlet s : list)
            if (s instanceof RecordCountScriptlet)
                count += ((RecordCountScriptlet) s).getCounter();
    return count;
}
项目:dynamicreports-jasper    文件:ReportTransform.java   
private void addScriptlet(String name, Class<? extends JRAbstractScriptlet> scriptletClass) {
    try {
        accessor.getDesign().addScriptlet(scriptlet(name, scriptletClass));
    } catch (JRException e) {
        throw new JasperDesignException("Registration failed for scriptlet \"" + name + "\"", e);
    }
}
项目:jasperreports    文件:JRFillScriptlet.java   
/**
 *
 */
public JRAbstractScriptlet getScriptlet()
{
    return scriptlet;
}
项目:jasperreports    文件:JRFillScriptlet.java   
/**
 *
 */
public void setScriptlet(JRAbstractScriptlet scriptlet)
{
    this.scriptlet = scriptlet;
}
项目:dynamicreports-jasper    文件:ReportTransform.java   
protected JRDesignScriptlet scriptlet(String name, Class<? extends JRAbstractScriptlet> scriptletClass) {
    JRDesignScriptlet jrScriptlet = new JRDesignScriptlet();
    jrScriptlet.setName(name);
    jrScriptlet.setValueClass(scriptletClass);
    return jrScriptlet;
}
项目:jasperreports    文件:ScriptletFactory.java   
/**
 * Returns a list of scriptlet instances to be used during report filling.
 * This method can return <code>null</code> if no scriplet is to be used.
 */
List<JRAbstractScriptlet> getScriplets(ScriptletFactoryContext context) throws JRException;