Java 类net.sf.jasperreports.engine.design.JRDesignScriptlet 实例源码

项目:PDFReporter-Studio    文件:ScriptletSystemSection.java   
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    parent = getWidgetFactory().createSection(parent, "Scriptlet Properties", false, 3);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    ASPropertyWidget w = createWidget4Property(parent, JRDesignScriptlet.PROPERTY_NAME);
    w.getControl().setLayoutData(gd);
    w.setReadOnly(true);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    w = createWidget4Property(parent, JRDesignScriptlet.PROPERTY_DESCRIPTION);
    w.getControl().setLayoutData(gd);
    w.setReadOnly(true);

    w = createWidget4Property(parent, JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME);
    w.setReadOnly(true);
}
项目:PDFReporter-Studio    文件:MScriptlet.java   
public void setPropertyValue(Object id, Object value) {
    JRDesignScriptlet jrField = (JRDesignScriptlet) getValue();
    if (id.equals(JRDesignScriptlet.PROPERTY_NAME)) {
        if (!value.equals("")) {
            jrField.setName((String) value);
            JRDesignDataset d = ModelUtils.getDataset(this);
            if (d != null) {
                d.getScriptletsMap().remove(jrField);
                d.getScriptletsMap().put(jrField.getName(), jrField);
            }
        }
    } else if (id.equals(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME)) {
        if (((String) value).isEmpty())
            value = null;
        jrField.setValueClassName((String) value);
    } else if (id.equals(JRDesignScriptlet.PROPERTY_DESCRIPTION))
        jrField.setDescription((String) value);
}
项目: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    文件:JRScriptletFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRDesignScriptlet scriptlet = new JRDesignScriptlet();

    setScriptletAttributes(scriptlet, atts);

    return scriptlet;
}
项目:jasperreports    文件:JRScriptletFactory.java   
protected void setScriptletAttributes(JRDesignScriptlet scriptlet, Attributes atts)
{
    scriptlet.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));

    if (atts.getValue(JRXmlConstants.ATTRIBUTE_class) != null)
    {
        scriptlet.setValueClassName(atts.getValue(JRXmlConstants.ATTRIBUTE_class));
    }
}
项目: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    文件:ScriptletSystemSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRDesignScriptlet.PROPERTY_NAME, Messages.common_name);
    addProvidedProperties(JRDesignScriptlet.PROPERTY_DESCRIPTION, Messages.common_description);
    addProvidedProperties(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME, Messages.common_class);
}
项目:PDFReporter-Studio    文件:ScriptletSection.java   
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    parent = getWidgetFactory().createSection(parent, "Scriptlet Properties", false, 3);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    createWidget4Property(parent, JRDesignScriptlet.PROPERTY_NAME).getControl().setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    createWidget4Property(parent, JRDesignScriptlet.PROPERTY_DESCRIPTION).getControl().setLayoutData(gd);

    createWidget4Property(parent, JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME);
}
项目:PDFReporter-Studio    文件:ScriptletSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRDesignScriptlet.PROPERTY_NAME, Messages.common_name);
    addProvidedProperties(JRDesignScriptlet.PROPERTY_DESCRIPTION, Messages.common_description);
    addProvidedProperties(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME, Messages.common_class);
}
项目: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   
public Object getPropertyValue(Object id) {
    JRDesignScriptlet jrField = (JRDesignScriptlet) getValue();
    if (id.equals(JRDesignScriptlet.PROPERTY_NAME))
        return jrField.getName();
    if (id.equals(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME))
        return jrField.getValueClassName();
    if (id.equals(JRDesignScriptlet.PROPERTY_DESCRIPTION))
        return jrField.getDescription();
    return null;
}
项目: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;

}
项目:PDFReporter-Studio    文件:MSystemScriptlet.java   
public Object getPropertyValue(Object id) {
    JRDesignScriptlet jrField = (JRDesignScriptlet) getValue();
    if (id.equals(JRDesignScriptlet.PROPERTY_NAME))
        return jrField.getName();
    if (id.equals(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME))
        return jrField.getValueClassName();
    if (id.equals(JRDesignScriptlet.PROPERTY_DESCRIPTION))
        return jrField.getDescription();
    return null;
}
项目:ireport-fork    文件:ScriptletsChildren.java   
@SuppressWarnings("unchecked")
public void recalculateKeys() {

    List l = (List)lock();
    l.clear();
    List params = null;
    JRDesignScriptlet mainScriptlet = new JRDesignScriptlet();
    mainScriptlet.setName("REPORT");
    mainScriptlet.setValueClassName(dataset.getScriptletClass());
    mainScriptlet.setDescription("Default scriptlet");
    l.add(mainScriptlet);
    l.addAll(dataset.getScriptletsList());
    update();
}
项目:ireport-fork    文件:ScriptletNode.java   
public ScriptletNode(JasperDesign jd, JRDesignScriptlet scriptlet, Lookup doLkp)
{
    super (Children.LEAF, new ProxyLookup(doLkp, Lookups.fixed(jd, scriptlet)));
    this.jd = jd;
    this.scriptlet = scriptlet;
    setDisplayName ( scriptlet.getName());
    super.setName( scriptlet.getName() );
    setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/scriptlet-16.png");

    scriptlet.getEventSupport().addPropertyChangeListener(this);
}
项目:ireport-fork    文件:ScriptletNode.java   
@Override
@SuppressWarnings("unchecked")
public void setName(String s) {

    if (s.equals("") || s.equals("REPORT"))
    {
        throw new IllegalArgumentException("Scriptlet name not valid.");
    }

    List<JRScriptlet> currentScriptlets = null;
    JRDesignDataset dataset = getParentNode().getLookup().lookup(JRDesignDataset.class);
    currentScriptlets = (List<JRScriptlet>)dataset.getScriptletsList();
    for (JRScriptlet pa : currentScriptlets)
    {
        JRDesignScriptlet p = (JRDesignScriptlet)pa;
        if (p != getScriptlet() && p.getName().equals(s))
        {
            throw new IllegalArgumentException("Scriptlet name already in use.");
        }
    }

    String oldName = getScriptlet().getName();
    getScriptlet().setName(s);
    dataset.getScriptletsMap().remove(oldName);
    dataset.getScriptletsMap().put(s,getScriptlet());

    ObjectPropertyUndoableEdit opue = new ObjectPropertyUndoableEdit(
                getScriptlet(), "Name", String.class, oldName, s);

    IReportManager.getInstance().addUndoableEdit(opue);
}
项目:ireport-fork    文件:ScriptletNode.java   
public void propertyChange(PropertyChangeEvent evt) {

    com.jaspersoft.ireport.designer.IReportManager.getInstance().notifyReportChange();
    if (evt.getPropertyName() == null) return;
    if (evt.getPropertyName().equals( JRDesignScriptlet.PROPERTY_NAME ))
    {
        super.setName(getScriptlet().getName());
        this.setDisplayName(getScriptlet().getName());
    }

    // Update the sheet
    this.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue() );
}
项目:ireport-fork    文件:ScriptletNode.java   
@SuppressWarnings("unchecked")
public NameProperty(JRDesignScriptlet scriptlet, JRDesignDataset dataset)
{
    super(JRDesignScriptlet.PROPERTY_NAME, String.class,
          I18n.getString("ScriptletNode.Property.Name"),
          I18n.getString("ScriptletNode.Property.Namedetail"));
    this.scriptlet = scriptlet;
    this.dataset = dataset;
    this.setValue("oneline", Boolean.TRUE);
}
项目:ireport-fork    文件:ScriptletNode.java   
@SuppressWarnings("unchecked")
public ValueClassNameProperty(JRDesignScriptlet scriptlet, JRDesignDataset dataset)
{
    super(scriptlet);
    setName(JRDesignScriptlet.PROPERTY_VALUE_CLASS_NAME);
    setDisplayName(I18n.getString("ScriptletNode.Property.ScriptletClass"));
    setShortDescription(I18n.getString("ScriptletNode.Property.ScriptletClass"));
    this.scriptlet = scriptlet;
    this.dataset = dataset;
}
项目:ireport-fork    文件:ScriptletNode.java   
@SuppressWarnings("unchecked")
public DescriptionProperty(JRDesignScriptlet scriptlet)
{
    super(scriptlet);
    setName(JRDesignScriptlet.PROPERTY_DESCRIPTION);
    setDisplayName(I18n.getString("ScriptletNode.Property.ScriptletDescription"));
    setShortDescription(I18n.getString("ScriptletNode.Property.ScriptletDescription"));
    this.scriptlet = scriptlet;
}
项目:ireport-fork    文件:ScriptletNode.java   
public JRDesignScriptlet getScriptlet() {
    return scriptlet;
}
项目:ireport-fork    文件:ScriptletNode.java   
public void setScriptlet(JRDesignScriptlet scriptlet) {
    this.scriptlet = scriptlet;
}
项目:ireport-fork    文件:ScriptletNode.java   
public JRDesignScriptlet getScriptlet() {
    return scriptlet;
}
项目:ireport-fork    文件:ScriptletNode.java   
public void setScriptlet(JRDesignScriptlet 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;
}
项目:PDFReporter-Studio    文件:ReorderScriptletCommand.java   
/**
 * Instantiates a new reorder scriptlet command.
 * 
 * @param child
 *          the child
 * @param parent
 *          the parent
 * @param newIndex
 *          the new index
 */
public ReorderScriptletCommand(MScriptlet child, MScriptlets parent, int newIndex) {
    super(Messages.common_reorder_elements);

    this.newIndex = Math.max(0, newIndex);
    this.jrDataset = (JRDesignDataset) parent.getValue();
    this.jrScriptlet = (JRDesignScriptlet) child.getValue();
}
项目:PDFReporter-Studio    文件:CreateScriptletCommand.java   
/**
 * Instantiates a new creates the scriptlet command.
 * 
 * @param destNode
 *          the dest node
 * @param srcNode
 *          the src node
 * @param index
 *          the index
 */
public CreateScriptletCommand(MScriptlets destNode, MScriptlet srcNode, int index) {
    super();
    this.jrDataset = (JRDesignDataset) destNode.getValue();
    this.index = index;
    if (srcNode != null && srcNode.getValue() != null)
        this.jrScriptlet = (JRDesignScriptlet) srcNode.getValue();
}
项目:PDFReporter-Studio    文件:DeleteScriptletCommand.java   
/**
 * Instantiates a new delete scriptlet command.
 * 
 * @param destNode
 *          the dest node
 * @param srcNode
 *          the src node
 */
public DeleteScriptletCommand(MScriptlets destNode, MScriptlet srcNode) {
    super();
    this.jrDataset = (JRDesignDataset) destNode.getValue();
    this.jrScriptlet = (JRDesignScriptlet) srcNode.getValue();
}
项目:ireport-fork    文件:ScriptletsChildren.java   
protected Node[] createNodes(Object key) {

    return new Node[]{new ScriptletNode(jd, (JRDesignScriptlet)key,doLkp)};
}