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

项目:jasperreports    文件:JRBaseGenericElement.java   
/**
 * Creates a generic element by copying an existing element.
 * 
 * @param element the element to copy
 * @param factory the object factory to be used for creating sub objects
 */
public JRBaseGenericElement(JRGenericElement element,
        JRBaseObjectFactory factory)
{
    super(element, factory);

    this.genericType = element.getGenericType();
    this.evaluationTimeValue = element.getEvaluationTimeValue();
    this.evaluationGroupName = element.getEvaluationGroupName();

    JRGenericElementParameter[] elementParameters = element.getParameters();
    this.parameters = new ArrayList<JRGenericElementParameter>(elementParameters.length);
    for (int i = 0; i < elementParameters.length; i++)
    {
        JRGenericElementParameter elementParameter = elementParameters[i];
        JRGenericElementParameter parameter = factory.getGenericElementParameter(
                elementParameter);
        this.parameters.add(parameter);
    }
}
项目:jasperreports    文件:JRBaseObjectFactory.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    JRBaseGenericElement base = null;
    if (element != null)
    {
        base = (JRBaseGenericElement) get(element);
        if (base == null)
        {
            base = new JRBaseGenericElement(element, this);
        }
    }
    setVisitResult(base);
}
项目:jasperreports    文件:ConvertVisitor.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    JRPrintElement image = GenericElementConverter.getInstance()
        .convert(reportConverter, element);
    addElement(parentFrame, image);
    addContour(reportConverter, parentFrame, image);
}
项目:jasperreports    文件:XmlWriterVisitor.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    try
    {
        xmlWriter.writeGenericElement(element);
    }
    catch (IOException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRApiWriter.java   
/**
     * 
     *
    protected XmlNamespace getNamespace()
    {
        return JASPERREPORTS_NAMESPACE;
    }


    /**
     * 
     */
    public void writeGenericElement( JRGenericElement element, String elementName)
    {
        write( "JRDesignGenericElement " + elementName + " = new JRDesignGenericElement(jasperDesign);\n");

        write( elementName + ".setEvaluationTime({0});\n", element.getEvaluationTimeValue(), EvaluationTimeEnum.NOW);
        write( elementName + ".setEvaluationGroup(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(element.getEvaluationGroupName()));

        writeReportElement( element, elementName);

        JRGenericElementType printKey = element.getGenericType();
//      JRGenericElementType t = new JRGenericElementType(printKey.getNamespace(), printKey.getName());

        write( "JRGenericElementType " + elementName + "Type = new JRGenericElementType(\"" 
                + JRStringUtil.escapeJavaStringLiteral(printKey.getNamespace()) 
                + "\", \"" 
                + JRStringUtil.escapeJavaStringLiteral(printKey.getName()) 
                + "\");\n");
        write( elementName + ".setGenericType(" + elementName + "Type);\n");
        flush();//genericElementType

        JRGenericElementParameter[] params = element.getParameters();
        for (int i = 0; i < params.length; i++)
        {
            JRGenericElementParameter param = params[i];

            String paramName =  elementName + "Parameter" + i;
            write( "JRDesignGenericElementParameter " + paramName + " = new JRDesignGenericElementParameter();\n");
            write( paramName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(param.getName()));
            write( paramName + ".setSkipWhenEmpty({0});\n", param.isSkipWhenEmpty(), false);
            writeExpression(param.getValueExpression(), paramName, "ValueExpression");

            write( elementName + ".addParameter({0});\n", paramName);

            flush();//genericElementParameter
        }

        flush();//genericElement
    }
项目:jasperreports    文件:JRVerifier.java   
public void verifyElement(JRElement element)
{
    if (element instanceof JRStaticText)
    {
        verifyStaticText((JRStaticText)element);
    }
    else if (element instanceof JRTextField)
    {
        verifyTextField((JRTextField)element);
    }
    else if (element instanceof JRImage)
    {
        verifyImage((JRImage)element);
    }
    else if (element instanceof JRSubreport)
    {
        verifySubreport((JRSubreport)element);
    }
    else if (element instanceof JRCrosstab)
    {
        verifyCrosstab((JRDesignCrosstab) element);
    }
    else if (element instanceof JRChart)
    {
        verifyChart((JRChart) element);
    }
    else if (element instanceof JRFrame)
    {
        verifyFrame((JRFrame) element);
    }
    else if (element instanceof JRComponentElement)
    {
        verifyComponentElement((JRComponentElement) element);
    }
    else if (element instanceof JRGenericElement)
    {
        verifyGenericElement((JRGenericElement) element);
    }
}
项目:jasperreports    文件:JRFillObjectFactory.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    JRFillGenericElement fill = null;
    if (element != null)
    {
        fill = (JRFillGenericElement) get(element);
        if (fill == null)
        {
            fill = new JRFillGenericElement(filler, element, this);
        }
    }
    setVisitResult(fill);
}
项目:jasperreports    文件:JRTemplateGenericElement.java   
protected JRTemplateGenericElement(JROrigin origin, 
        JRDefaultStyleProvider defaultStyleProvider, JRGenericElement element)
{
    super(origin, defaultStyleProvider);

    setElement(element);
    setGenericType(element.getGenericType());
}
项目:jasperreports    文件:JRFillGenericElement.java   
public JRFillGenericElement(JRBaseFiller filler, JRGenericElement element,
        JRFillObjectFactory factory)
{
    super(filler, element, factory);

    this.parameters = element.getParameters();
}
项目:jasperreports    文件:JRXmlWriter.java   
public void writeGenericElement(JRGenericElement element) throws IOException
{
    if(isNewerVersionOrEqual(JRConstants.VERSION_3_1_0))
    {
        writer.startElement(JRXmlConstants.ELEMENT_genericElement, getNamespace());

        writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, 
                element.getEvaluationTimeValue(),
                EvaluationTimeEnum.NOW);
        if (element.getEvaluationGroupName() != null)
        {
            writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, 
                    element.getEvaluationGroupName());
        }

        writeReportElement(element);

        writer.startElement(JRXmlConstants.ELEMENT_genericElementType);
        JRGenericElementType printKey = element.getGenericType();
        if (printKey != null)
        {
            writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_namespace, 
                    printKey.getNamespace());
            writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, 
                    printKey.getName());
        }
        writer.closeElement();//genericElementType

        JRGenericElementParameter[] params = element.getParameters();
        for (int i = 0; i < params.length; i++)
        {
            JRGenericElementParameter param = params[i];
            writer.startElement(JRXmlConstants.ELEMENT_genericElementParameter);
            writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, 
                    param.getName());
            writer.addAttribute(JRXmlConstants.ATTRIBUTE_skipWhenNull, 
                    param.isSkipWhenEmpty(), false);

            JRExpression valueExpression = param.getValueExpression();
            if (valueExpression != null)
            {
                writeExpression(JRXmlConstants.ELEMENT_genericElementParameter_valueExpression, 
                        valueExpression, true, Object.class.getName());
            }

            writer.closeElement();//genericElementParameter
        }

        writer.closeElement();//genericElement
    }
}
项目:jasperreports    文件:JRDelegationVisitor.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    visitor.visitGenericElement(element);
}
项目:jasperreports    文件:UniformElementVisitor.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    visitElement(element);
}
项目:jasperreports    文件:JRApiWriter.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    apiWriter.writeGenericElement(element, name);
}
项目:jasperreports    文件:JRVisitorSupport.java   
@Override
public void visitGenericElement(JRGenericElement element)
{
    // NOOP
}
项目:jasperreports    文件:JRVerifier.java   
protected void verifyGenericElement(JRGenericElement element)
{
    verifyReportElement(element);

    if (element.getEvaluationTimeValue() == EvaluationTimeEnum.GROUP)
    {
        String groupName = element.getEvaluationGroupName();
        if (groupName == null)
        {
            addBrokenRule("Evaluation group not set for generic element", element);
        }
        else
        {
            if (!jasperDesign.getGroupsMap().containsKey(groupName))
            {
                addBrokenRule("Generic element evaluation group " + groupName 
                        + " not found in report", element);
            }
        }
    }

    JRGenericElementType type = element.getGenericType();
    if (type == null)
    {
        addBrokenRule("No type set for generic element", element);
    }
    else
    {
        if (type.getNamespace() == null)
        {
            addBrokenRule("No namespace set for generic element type", type);
        }

        if (type.getName() == null)
        {
            addBrokenRule("No name set for generic element type", type);
        }
    }

    JRGenericElementParameter[] parameters = element.getParameters();
    for (int i = 0; i < parameters.length; i++)
    {
        JRGenericElementParameter parameter = parameters[i];

        if (parameter.getName() == null)
        {
            addBrokenRule("No name set for generic element parameter", parameter);
        }
    }
}
项目:jasperreports    文件:JRFillGenericElement.java   
@Override
public JRGenericElementType getGenericType()
{
    return ((JRGenericElement) parent).getGenericType();
}
项目:jasperreports    文件:JRFillGenericElement.java   
@Override
public EvaluationTimeEnum getEvaluationTimeValue()
{
    return ((JRGenericElement) parent).getEvaluationTimeValue();
}
项目:jasperreports    文件:JRFillGenericElement.java   
@Override
public String getEvaluationGroupName()
{
    return ((JRGenericElement) parent).getEvaluationGroupName();
}
项目:ireport-fork    文件:ElementNameVisitor.java   
public void visitGenericElement(JRGenericElement arg0) {
    name = "Generic element";
}
项目:ireport-fork    文件:ElementNodeVisitor.java   
public void visitGenericElement(JRGenericElement genericElement) {
    node = new ElementNode(jasperDesign, (JRDesignGenericElement)genericElement,doLkp);
    node.setIconBaseWithExtension(ICON_GENERIC_ELEMENT);
}
项目:ireport-fork    文件:HasExpressionVisitor.java   
public void visitGenericElement(JRGenericElement genericElement) {
    collector.collect(genericElement);
}