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

项目: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);
}
项目: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    文件:MScriptlet.java   
/**
 * Creates the jr scriptlet.
 * 
 * @param jrDataset
 *          the jr dataset
 * @return the jR design scriptlet
 */
public static JRDesignScriptlet createJRScriptlet(JRDesignDataset jrDataset) {
    JRDesignScriptlet jrScriptlet = new JRDesignScriptlet();
    jrScriptlet.setName(ModelUtils.getDefaultName(jrDataset.getScriptletsMap(), "Scriptlet_")); //$NON-NLS-1$
    jrScriptlet.setValueClass(JRDefaultScriptlet.class);
    return jrScriptlet;

}