Java 类net.sf.jasperreports.engine.type.EvaluationTimeEnum 实例源码

项目:jasperreports    文件:XYChartXmlFactory.java   
@Override
public Object createObject(Attributes attrs) throws Exception
{
    XYChartComponent chart = new XYChartComponent();

    EvaluationTimeEnum evaluationTime = EvaluationTimeEnum.getByName(attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
    if (evaluationTime != null)
    {
        chart.setEvaluationTime(evaluationTime);
    }

    if (chart.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        String groupName = attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
        chart.setEvaluationGroup(groupName);
    }

    return chart;
}
项目:jasperreports    文件:XYChartCompiler.java   
protected void verifyEvaluation(JRVerifier verifier,
        XYChartComponent chart)
{
    EvaluationTimeEnum evaluationTime = chart.getEvaluationTime();
    if (evaluationTime == EvaluationTimeEnum.AUTO)
    {
        verifier.addBrokenRule("Axis chart evaluation time cannot be Auto", chart);
    }
    else if (evaluationTime == EvaluationTimeEnum.GROUP)
    {
        String groupName = chart.getEvaluationGroup();
        if (groupName == null)
        {
            verifier.addBrokenRule("Evaluation group not set for axis chart", chart);
        }
        else
        {
            JasperDesign report = verifier.getReportDesign();
            if (!report.getGroupsMap().containsKey(groupName))
            {
                verifier.addBrokenRule("Axis chart evaluation group " + groupName 
                        + " not found in report", chart);
            }
        }
    }
}
项目:jasperreports    文件:PieChartCompiler.java   
protected void verifyEvaluation(JRVerifier verifier,
        PieChartComponent chart)
{
    EvaluationTimeEnum evaluationTime = chart.getEvaluationTime();
    if (evaluationTime == EvaluationTimeEnum.AUTO)
    {
        verifier.addBrokenRule("Pie chart evaluation time cannot be Auto", chart);
    }
    else if (evaluationTime == EvaluationTimeEnum.GROUP)
    {
        String groupName = chart.getEvaluationGroup();
        if (groupName == null)
        {
            verifier.addBrokenRule("Evaluation group not set for pie chart", chart);
        }
        else
        {
            JasperDesign report = verifier.getReportDesign();
            if (!report.getGroupsMap().containsKey(groupName))
            {
                verifier.addBrokenRule("Pie chart evaluation group " + groupName 
                        + " not found in report", chart);
            }
        }
    }
}
项目:jasperreports    文件:PieChartXmlFactory.java   
public Object createObject(Attributes attrs) throws Exception
{
    PieChartComponent chart = new PieChartComponent();

    EvaluationTimeEnum evaluationTime = EvaluationTimeEnum.getByName(attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
    if (evaluationTime != null)
    {
        chart.setEvaluationTime(evaluationTime);
    }

    if (chart.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        String groupName = attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
        chart.setEvaluationGroup(groupName);
    }

    return chart;
}
项目:jasperreports    文件:BarChartXmlFactory.java   
public Object createObject(Attributes attrs) throws Exception
{
    BarChartComponent chart = new BarChartComponent();

    EvaluationTimeEnum evaluationTime = EvaluationTimeEnum.getByName(attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
    if (evaluationTime != null)
    {
        chart.setEvaluationTime(evaluationTime);
    }

    if (chart.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        String groupName = attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
        chart.setEvaluationGroup(groupName);
    }

    return chart;
}
项目:jasperreports    文件:SpiderChartXmlFactory.java   
@Override
public Object createObject(Attributes attrs) throws Exception
{
    SpiderChartComponent chartComponent = new SpiderChartComponent();

    EvaluationTimeEnum evaluationTime = EvaluationTimeEnum.getByName(attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
    if (evaluationTime != null)
    {
        chartComponent.setEvaluationTime(evaluationTime);
    }
    else
    {
        chartComponent.setEvaluationTime(EvaluationTimeEnum.NOW);
    }

    if (chartComponent.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        String groupName = attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
        chartComponent.setEvaluationGroup(groupName);
    }

    return chartComponent;
}
项目:jasperreports    文件:JRBaseTextField.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (linkType == null)
    {
         linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType));
    }

    if (linkTarget == null)
    {
         linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget));
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
    }
}
项目:jasperreports    文件:SpiderChartCompiler.java   
protected void verifyEvaluation(JRVerifier verifier,
        SpiderChartComponent chart)
{
    EvaluationTimeEnum evaluationTime = chart.getEvaluationTime();
    if (evaluationTime == EvaluationTimeEnum.AUTO)
    {
        verifier.addBrokenRule("Spider chart evaluation time cannot be Auto", chart);
    }
    else if (evaluationTime == EvaluationTimeEnum.GROUP)
    {
        String groupName = chart.getEvaluationGroup();
        if (groupName == null)
        {
            verifier.addBrokenRule("Evaluation group not set for spider chart", chart);
        }
        else
        {
            JasperDesign report = verifier.getReportDesign();
            if (!report.getGroupsMap().containsKey(groupName))
            {
                verifier.addBrokenRule("Spider chart evaluation group " + groupName 
                        + " not found in report", chart);
            }
        }
    }
}
项目:jasperreports    文件:JRGenericElementFactory.java   
@Override
public Object createObject(Attributes attrs) throws Exception
{
    JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2);
    JRDesignGenericElement element = new JRDesignGenericElement(jasperDesign);

    EvaluationTimeEnum evaluationTime = EvaluationTimeEnum.getByName(attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
    if (evaluationTime != null)
    {
        element.setEvaluationTime(evaluationTime);
    }

    if (element.getEvaluationTimeValue() == EvaluationTimeEnum.GROUP)
    {
        String groupName = attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
        if (groupName != null)
        {
            element.setEvaluationGroupName(groupName);
        }
    }

    return element;
}
项目:jasperreports    文件:JRDesignTextField.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (linkType == null)
    {
         linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType));
    }

    if (linkTarget == null)
    {
         linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget));
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
    }
}
项目:jasperreports    文件:JRVerifier.java   
private void verifyChart(JRChart chart)
{
    verifyReportElement(chart);

    if (chart.getEvaluationTimeValue() == EvaluationTimeEnum.AUTO)
    {
        addBrokenRule("Charts do not support Auto evaluation time.", chart);
    }

    JRChartDataset dataset = chart.getDataset();
    if (dataset == null)
    {
        addBrokenRule("Chart dataset missing.", chart);
    }
    else
    {
        dataset.validate(this);
    }
}
项目:jasperreports    文件:EvaluationTimeSerializer.java   
@Override
public void write(JREvaluationTime value, VirtualizationOutput out) throws IOException
{
    //FIXME we should have keep these in memory and only write an ID/index
    EvaluationTimeEnum type = value.getType();
    @SuppressWarnings("deprecation")
    byte byteType = type.getValue(); 
    out.writeByte(byteType);
    if (type == EvaluationTimeEnum.BAND)
    {
        out.writeInt(value.getBandId());
    }
    else if (type == EvaluationTimeEnum.GROUP)
    {
        out.writeJRObject(value.getGroupName());
    }
}
项目:jasperreports    文件:ComponentsXmlDigesterConfigurer.java   
@SuppressWarnings("deprecation")
protected <T> void addBarcodeRules(Digester digester, 
        String barcodePattern, Class<T> barcodeComponentClass,
        String[] ignoredProperties)
{
    digester.addObjectCreate(barcodePattern, barcodeComponentClass);
    digester.addSetProperties(barcodePattern,
            //properties to be ignored by this rule
            ignoredProperties, 
            new String[0]);
    //rule to set evaluation time
    digester.addRule(barcodePattern, 
            new XmlConstantPropertyRule(
                    JRXmlConstants.ATTRIBUTE_evaluationTime, "evaluationTimeValue",
                    EvaluationTimeEnum.values()));

    String codeExpressionPattern = barcodePattern + "/codeExpression";
    digester.addFactoryCreate(codeExpressionPattern, 
            JRExpressionFactory.StringExpressionFactory.class.getName());
    digester.addCallMethod(codeExpressionPattern, "setText", 0);
    digester.addSetNext(codeExpressionPattern, "setCodeExpression", 
            JRExpression.class.getName());
}
项目:jasperreports    文件:JRFillChart.java   
@Override
protected JRPrintElement fill()
{
    JRTemplatePrintImage printImage = new JRTemplatePrintImage(getJRTemplateImage(), printElementOriginator);

    printImage.setUUID(getUUID());
    printImage.setX(getX());
    printImage.setY(getRelativeY());
    printImage.setWidth(getWidth());
    printImage.setHeight(getStretchHeight());
    printImage.setBookmarkLevel(getBookmarkLevel());
    printImage.getPropertiesMap().setProperty(HtmlReportConfiguration.PROPERTY_EMBED_IMAGE, Boolean.TRUE.toString());
    printImage.getPropertiesMap().setProperty(HtmlReportConfiguration.PROPERTY_EMBEDDED_SVG_USE_FONTS, Boolean.TRUE.toString());

    EvaluationTimeEnum evaluationTime = getEvaluationTimeValue();
    if (evaluationTime == EvaluationTimeEnum.NOW)
    {
        copy(printImage);
    }
    else
    {
        filler.addBoundElement(this, printImage, evaluationTime, getEvaluationGroup(), band);
    }

    return printImage;
}
项目:jasperreports    文件:JRFillElement.java   
/**
 * Resolves an element.
 * 
 * @param element the element
 * @param evaluation the evaluation type
 * @param evaluationTime the current evaluation time
 */
protected void resolveElement (JRPrintElement element, byte evaluation, JREvaluationTime evaluationTime) throws JRException
{
    EvaluationTimeEnum evaluationTimeType = getEvaluationTimeValue();
    switch (evaluationTimeType)
    {
        case NOW:
            break;
        case AUTO:
            delayedEvaluate((JRRecordedValuesPrintElement) element, evaluationTime, evaluation);
            break;
        default:
            performDelayedEvaluation(element, evaluation);
            break;
    }
}
项目:jasperreports    文件:BarcodeComponent.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    GetField fields = in.readFields();
    this.PSEUDO_SERIAL_VERSION_UID = fields.get("PSEUDO_SERIAL_VERSION_UID", 0);
    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        byte evaluationTime = fields.get("evaluationTime", (byte) 0);
        this.evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
    }
    else
    {
        this.evaluationTimeValue = (EvaluationTimeEnum) fields.get("evaluationTimeValue", null);
    }
    this.evaluationGroup = (String) fields.get("evaluationGroup", null);
    this.codeExpression = (JRExpression) fields.get("codeExpression", null);

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2
            && this instanceof Barcode4jComponent)
    {
        //up to 6.0.0 this class had several fields that were moved to Barcode4jComponent in 6.0.2.
        //copying the values to the Barcode4jComponent fields.
        Barcode4jComponent barcode4jComponent = (Barcode4jComponent) this;
        barcode4jComponent.copyBarcodeComponentFields(fields);
    }
}
项目:jasperreports    文件:SortComponentDigester.java   
public static void addSortComponentRules(Digester digester)
{
    String componentNamespace = digester.getRuleNamespaceURI();

    String sortComponentPattern = "*/componentElement/sort";
    digester.addObjectCreate(sortComponentPattern, SortComponent.class.getName());

    digester.addSetProperties(sortComponentPattern, new String[] {
            SortComponent.PROPERTY_EVALUATION_TIME,
            }, 
            new String[0]);

    digester.addRule(sortComponentPattern, 
            new XmlConstantPropertyRule(
                    SortComponent.PROPERTY_EVALUATION_TIME,
                    EvaluationTimeEnum.values()));

    digester.addFactoryCreate(sortComponentPattern + "/symbol", SortComponentSymbolFactory.class.getName());

    digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

    digester.addFactoryCreate(sortComponentPattern + "/symbol/font", SortComponentSymbolFontFactory.class.getName());
    digester.addSetNext(sortComponentPattern + "/symbol/font", "setSymbolFont", JRFont.class.getName());

    digester.setRuleNamespaceURI(componentNamespace);
}
项目:jasperreports    文件:StandardBarbecueComponent.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
    }
}
项目:jasperreports    文件:PieChartXmlWriter.java   
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    PieChartComponent chart = (PieChartComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    ComponentKey componentKey = componentElement.getComponentKey();

    String namespaceURI = componentKey.getNamespace();
    String schemaLocation = 
        ComponentsEnvironment.getInstance(jasperReportsContext)
            .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation();
    XmlNamespace namespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(),
            schemaLocation);

    writer.startElement("pieChart", namespace);

    writer.addAttribute("evaluationTime", chart.getEvaluationTime(), EvaluationTimeEnum.NOW);
    if (chart.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        writer.addEncodedAttribute("evaluationGroup", chart.getEvaluationGroup());
    }

    PieDataset dataset = chart.getDataset();
    writer.startElement("pieDataset");

    reportWriter.writeElementDataset(dataset);

    writer.writeExpression("keyExpression", dataset.getKeyExpression());
    writer.writeExpression("valueExpression", dataset.getValueExpression());

    writer.closeElement();//pieDataset

    writer.writeExpression("titleExpression", chart.getTitleExpression());

    writer.closeElement();//pieChart
}
项目:jasperreports    文件:HtmlComponentDigester.java   
@SuppressWarnings("deprecation")
protected void setHtmlComponentRules(Digester digester)
{
    String htmlComponentPattern = "*/componentElement/html";
    digester.addObjectCreate(htmlComponentPattern, HtmlComponent.class.getName());

    digester.addSetProperties(htmlComponentPattern, new String[] {
            HtmlComponent.PROPERTY_SCALE_TYPE,
            HtmlComponent.PROPERTY_HORIZONTAL_ALIGN,
            HtmlComponent.PROPERTY_VERTICAL_ALIGN,
            HtmlComponent.PROPERTY_EVALUATION_TIME }, 
            new String[0]);

    digester.addRule(htmlComponentPattern, 
            new XmlConstantPropertyRule(
                    HtmlComponent.PROPERTY_SCALE_TYPE,
                    ScaleImageEnum.values()));
    digester.addRule(htmlComponentPattern, 
            new XmlConstantPropertyRule(
                    HtmlComponent.PROPERTY_HORIZONTAL_ALIGN,
                    "horizontalImageAlign",
                    HorizontalImageAlignEnum.values()));
    digester.addRule(htmlComponentPattern, 
            new XmlConstantPropertyRule(
                    HtmlComponent.PROPERTY_VERTICAL_ALIGN,
                    "verticalImageAlign",
                    VerticalImageAlignEnum.values()));
    digester.addRule(htmlComponentPattern, 
            new XmlConstantPropertyRule(
                    HtmlComponent.PROPERTY_EVALUATION_TIME,
                    EvaluationTimeEnum.values()));

    String htmlContentPattern = htmlComponentPattern + "/htmlContentExpression";
    digester.addFactoryCreate(htmlContentPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
    digester.addCallMethod(htmlContentPattern, "setText", 0);
    digester.addSetNext(htmlContentPattern, "setHtmlContentExpression", JRExpression.class.getName());
}
项目:jasperreports    文件:HtmlComponent.java   
/**
 * @param evaluationTime the evaluationTime to set
 */
public void setEvaluationTime(EvaluationTimeEnum evaluationTime) {
    Object old = this.evaluationTime;
    this.evaluationTime = evaluationTime;
    getEventSupport().firePropertyChange(PROPERTY_EVALUATION_TIME, 
            old, this.evaluationTime);
}
项目:jasperreports    文件:HtmlComponentXmlWriter.java   
protected void writeHtmlComponent(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    HtmlComponent htmlComponent = (HtmlComponent) component;
    ComponentKey componentKey = componentElement.getComponentKey();

    XmlNamespace namespace = new XmlNamespace(
            HtmlComponentExtensionsRegistryFactory.NAMESPACE, 
            componentKey.getNamespacePrefix(),
            HtmlComponentExtensionsRegistryFactory.XSD_LOCATION);

    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();

    writer.startElement("html", namespace);

    writer.addAttribute(HtmlComponent.PROPERTY_SCALE_TYPE, htmlComponent.getScaleType());
    writer.addAttribute(HtmlComponent.PROPERTY_HORIZONTAL_ALIGN, htmlComponent.getHorizontalImageAlign());
    writer.addAttribute(HtmlComponent.PROPERTY_VERTICAL_ALIGN, htmlComponent.getVerticalImageAlign());
    writeExpression(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION, htmlComponent.getHtmlContentExpression(), false, componentElement, reportWriter);

    if (htmlComponent.getEvaluationTime() != EvaluationTimeEnum.NOW) {
        writer.addAttribute(HtmlComponent.PROPERTY_EVALUATION_TIME, htmlComponent.getEvaluationTime());
    }
    writer.addAttribute(HtmlComponent.PROPERTY_EVALUATION_GROUP, htmlComponent.getEvaluationGroup());
    writer.addAttribute(HtmlComponent.PROPERTY_CLIP_ON_OVERFLOW, htmlComponent.getClipOnOverflow());

    writer.closeElement();
}
项目:jasperreports    文件:JRBaseChart.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (linkType == null)
    {
         linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType));
    }

    if (linkTarget == null)
    {
         linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget));
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);

        if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_1_3)
        {
            legendPositionValue = EdgeEnum.getByValue(legendPosition);
            titlePositionValue = EdgeEnum.getByValue(titlePosition);
            showLegend = Boolean.valueOf(isShowLegend);
        }
        else
        {
            legendPositionValue = EdgeEnum.getByValue(legendPositionByte);
            titlePositionValue = EdgeEnum.getByValue(titlePositionByte);

            legendPositionByte = null;
            titlePositionByte = null;
        }

    }
}
项目:jasperreports    文件:JRBaseGenericElement.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
    }
}
项目:jasperreports    文件:JRXmlWriter.java   
/**
 *
 */
public void writeImage(JRImage image) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_image, getNamespace());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_scaleImage, image.getOwnScaleImageValue());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_hAlign, image.getOwnHorizontalImageAlign());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_vAlign, image.getOwnVerticalImageAlign());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_isUsingCache, image.getUsingCache());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_isLazy, image.isLazy(), false);
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_onErrorType, image.getOnErrorTypeValue(), OnErrorTypeEnum.ERROR);
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, image.getEvaluationTimeValue(), EvaluationTimeEnum.NOW);

    if (image.getEvaluationGroup() != null)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, image.getEvaluationGroup().getName());
    }

    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, image.getLinkType(), HyperlinkTypeEnum.NONE.getName());
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, image.getLinkTarget(), HyperlinkTargetEnum.SELF.getName());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_bookmarkLevel, image.getBookmarkLevel(), JRAnchor.NO_BOOKMARK);

    writeReportElement(image);
    writeBox(image.getLineBox());
    writeGraphicElement(image);

    //FIXME class is mandatory in verifier

    writeExpression(JRXmlConstants.ELEMENT_imageExpression, image.getExpression(), true);
    writeExpression(JRXmlConstants.ELEMENT_anchorNameExpression, image.getAnchorNameExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkReferenceExpression, image.getHyperlinkReferenceExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkWhenExpression, image.getHyperlinkWhenExpression(), false);//FIXMENOW can we reuse method for writing hyperlink?
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkAnchorExpression, image.getHyperlinkAnchorExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkPageExpression, image.getHyperlinkPageExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkTooltipExpression, image.getHyperlinkTooltipExpression(), false);
    writeHyperlinkParameters(image.getHyperlinkParameters());

    writer.closeElement();
}
项目:jasperreports    文件:JRXmlWriter.java   
/**
 *
 */

public void writeTextField(JRTextField textField) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_textField, getNamespace());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_isStretchWithOverflow, textField.isStretchWithOverflow(), false);
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, textField.getEvaluationTimeValue(), EvaluationTimeEnum.NOW);

    if (textField.getEvaluationGroup() != null)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, textField.getEvaluationGroup().getName());
    }

    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pattern, textField.getOwnPattern());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_isBlankWhenNull, textField.isOwnBlankWhenNull());

    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, textField.getLinkType(), HyperlinkTypeEnum.NONE.getName());
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, textField.getLinkTarget(), HyperlinkTargetEnum.SELF.getName());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_bookmarkLevel, textField.getBookmarkLevel(), JRAnchor.NO_BOOKMARK);

    writeReportElement(textField);
    writeBox(textField.getLineBox());
    writeTextElement(textField);

    writeExpression(JRXmlConstants.ELEMENT_textFieldExpression, textField.getExpression(), true);

    if(isNewerVersionOrEqual(JRConstants.VERSION_4_1_1))
    {
        writer.writeExpression(JRXmlConstants.ELEMENT_patternExpression, textField.getPatternExpression());
    }
    writeExpression(JRXmlConstants.ELEMENT_anchorNameExpression, textField.getAnchorNameExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkReferenceExpression, textField.getHyperlinkReferenceExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkWhenExpression, textField.getHyperlinkWhenExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkAnchorExpression, textField.getHyperlinkAnchorExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkPageExpression, textField.getHyperlinkPageExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_hyperlinkTooltipExpression, textField.getHyperlinkTooltipExpression(), false);
    writeHyperlinkParameters(textField.getHyperlinkParameters());

    writer.closeElement();
}
项目:jasperreports    文件:StandardBarbecueComponent.java   
public void setEvaluationTimeValue(EvaluationTimeEnum evaluationTimeValue)
{
    Object old = this.evaluationTimeValue;
    this.evaluationTimeValue = evaluationTimeValue;
    getEventSupport().firePropertyChange(PROPERTY_EVALUATION_TIME, 
            old, this.evaluationTimeValue);
}
项目: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    文件:JRDesignTextField.java   
/**
 *
 */
public void setEvaluationTime(EvaluationTimeEnum evaluationTimeValue)
{
    Object old = this.evaluationTimeValue;
    this.evaluationTimeValue = evaluationTimeValue;
    getEventSupport().firePropertyChange(PROPERTY_EVALUATION_TIME, old, this.evaluationTimeValue);
}
项目:jasperreports    文件:JRDesignChart.java   
/**
 *
 */
public void setEvaluationTime(EvaluationTimeEnum evaluationTimeValue)
{
    Object old = this.evaluationTimeValue;
    this.evaluationTimeValue = evaluationTimeValue;
    getEventSupport().firePropertyChange(PROPERTY_EVALUATION_TIME, old, this.evaluationTimeValue);
}
项目:jasperreports    文件:JRDesignChart.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (linkType == null)
    {
         linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType));
    }

    if (linkTarget == null)
    {
         linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget));
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);
        if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_1_3)
        {
            legendPositionValue = EdgeEnum.getByValue(legendPosition);
            titlePositionValue = EdgeEnum.getByValue(titlePosition);
            showLegend = Boolean.valueOf(isShowLegend);
        }
        else
        {
            legendPositionValue = EdgeEnum.getByValue(legendPositionByte);
            titlePositionValue = EdgeEnum.getByValue(titlePositionByte);

            legendPositionByte = null;
            titlePositionByte = null;
        }

    }
}
项目:jasperreports    文件:JRDesignImage.java   
/**
 * Sets the evaluation time for this image.
 * 
 */
public void setEvaluationTime(EvaluationTimeEnum evaluationTimeValue)
{
    Object old = this.evaluationTimeValue;
    this.evaluationTimeValue = evaluationTimeValue;
    getEventSupport().firePropertyChange(PROPERTY_EVALUATION_TIME, old, this.evaluationTimeValue);
}
项目:jasperreports    文件:JRDesignImage.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        horizontalAlignmentValue = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getByValue(horizontalAlignment);
        verticalAlignmentValue = net.sf.jasperreports.engine.type.VerticalAlignEnum.getByValue(verticalAlignment);
        scaleImageValue = ScaleImageEnum.getByValue(scaleImage);
        onErrorTypeValue = OnErrorTypeEnum.getByValue(onErrorType);
        evaluationTimeValue = EvaluationTimeEnum.getByValue(evaluationTime);

        horizontalAlignment = null;
        verticalAlignment = null;
        scaleImage = null;
    }

    if (linkType == null)
    {
         linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType));
    }

    if (linkTarget == null)
    {
         linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget));
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2)
    {
        horizontalImageAlign = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getHorizontalImageAlignEnum(horizontalAlignmentValue);
        verticalImageAlign = net.sf.jasperreports.engine.type.VerticalAlignEnum.getVerticalImageAlignEnum(verticalAlignmentValue);

        horizontalAlignmentValue = null;
        verticalAlignmentValue = null;
    }
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    SpiderChartComponent spiderChartComponent = (SpiderChartComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    ComponentKey componentKey = componentElement.getComponentKey();

    String namespaceURI = componentKey.getNamespace();
    String schemaLocation = 
        ComponentsEnvironment.getInstance(jasperReportsContext)
            .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation();
    XmlNamespace componentNamespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(),
            schemaLocation);


    writer.startElement(ELEMENT_spiderChart, componentNamespace);

    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, spiderChartComponent.getEvaluationTime(), EvaluationTimeEnum.NOW);

    if (spiderChartComponent.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, spiderChartComponent.getEvaluationGroup());
    }

    ChartSettings chartSettings = spiderChartComponent.getChartSettings();
    writeChart(chartSettings, writer, reportWriter, componentNamespace);

    SpiderDataset dataset = (SpiderDataset)spiderChartComponent.getDataset();
    writeSpiderDataSet(dataset, writer, reportWriter, componentNamespace);

    SpiderPlot spiderPlot = (SpiderPlot)spiderChartComponent.getPlot();
    writeSpiderPlot(spiderPlot, chartSettings, writer, componentNamespace);

    writer.closeElement();//spiderChart
}
项目:jasperreports    文件:ComponentsXmlDigesterConfigurer.java   
@SuppressWarnings("deprecation")
protected void addBarbecueRules(Digester digester)
{
    String barcodePattern = "*/componentElement/barbecue";
    digester.addObjectCreate(barcodePattern, StandardBarbecueComponent.class);
    digester.addSetProperties(barcodePattern,
            //properties to be ignored by this rule
            new String[]{JRXmlConstants.ATTRIBUTE_evaluationTime, StandardBarbecueComponent.PROPERTY_ROTATION}, 
            new String[0]);
    digester.addRule(barcodePattern, 
            new XmlConstantPropertyRule(
                    JRXmlConstants.ATTRIBUTE_evaluationTime, "evaluationTimeValue",
                    EvaluationTimeEnum.values()));
    digester.addRule(barcodePattern, 
            new XmlConstantPropertyRule(
                    StandardBarbecueComponent.PROPERTY_ROTATION,
                    RotationEnum.values()));

    String barcodeExpressionPattern = barcodePattern + "/codeExpression";
    digester.addFactoryCreate(barcodeExpressionPattern, 
            JRExpressionFactory.StringExpressionFactory.class.getName());
    digester.addCallMethod(barcodeExpressionPattern, "setText", 0);
    digester.addSetNext(barcodeExpressionPattern, "setCodeExpression", 
            JRExpression.class.getName());

    String applicationIdentifierExpressionPattern = barcodePattern 
            + "/applicationIdentifierExpression";
    digester.addFactoryCreate(applicationIdentifierExpressionPattern, 
            JRExpressionFactory.StringExpressionFactory.class.getName());
    digester.addCallMethod(applicationIdentifierExpressionPattern, "setText", 0);
    digester.addSetNext(applicationIdentifierExpressionPattern, 
            "setApplicationIdentifierExpression", 
            JRExpression.class.getName());
}
项目:jasperreports    文件:JRFillComponentElement.java   
@Override
public void registerDelayedEvaluation(JRPrintElement printElement, 
        EvaluationTimeEnum evaluationTime, String evaluationGroup)
{
    filler.addBoundElement(this, printElement, 
            evaluationTime, evaluationGroup, band);
}
项目:jasperreports    文件:JRFillImage.java   
@Override
protected JRPrintElement fill() throws JRException
{
    EvaluationTimeEnum evaluationTime = this.getEvaluationTimeValue();
    JRTemplatePrintImage printImage;
    JRRecordedValuesPrintImage recordedValuesImage;
    if (isEvaluateAuto())
    {
        printImage = recordedValuesImage = new JRRecordedValuesPrintImage(getJRTemplateImage(), printElementOriginator);
    }
    else
    {
        printImage = new JRTemplatePrintImage(getJRTemplateImage(), printElementOriginator);
        recordedValuesImage = null;
    }

    printImage.setUUID(this.getUUID());
    printImage.setX(this.getX());
    printImage.setY(this.getRelativeY());
    printImage.setWidth(getWidth());
    printImage.setHeight(this.getStretchHeight());
    printImage.setBookmarkLevel(getBookmarkLevel());

    if (isEvaluateNow())
    {
        this.copy(printImage);
    }
    else if (isEvaluateAuto())
    {
        initDelayedEvaluationPrint(recordedValuesImage);
    }
    else
    {
        filler.addBoundElement(this, printImage, evaluationTime, getEvaluationGroup(), band);
    }

    return printImage;
}
项目:jasperreports    文件:JREvaluationTime.java   
/**
 * Returns the evaluation time corresponding to an evaluation time type.
 * 
 * @param type the evaluation time type
 * @param group the group used for {@link EvaluationTimeEnum#GROUP EvaluationTimeEnum.GROUP}
 *  evaluation time type
 * @param band the band used for {@link EvaluationTimeEnum#BAND EvaluationTimeEnum.BAND}
 *  evaluation time type
 * @return the evaluation time corresponding to an evaluation time type
 */
public static JREvaluationTime getEvaluationTime(EvaluationTimeEnum type, JRGroup group, JRFillBand band)
{
    JREvaluationTime evaluationTime;

    switch (type)
    {
        case REPORT:
            evaluationTime = EVALUATION_TIME_REPORT;
            break;
        case MASTER:
            evaluationTime = EVALUATION_TIME_MASTER;
            break;
        case PAGE:
            evaluationTime = EVALUATION_TIME_PAGE;
            break;
        case COLUMN:
            evaluationTime = EVALUATION_TIME_COLUMN;
            break;
        case GROUP:
            evaluationTime = getGroupEvaluationTime(group.getName());
            break;
        case BAND:
            evaluationTime = getBandEvaluationTime(band);
            break;
        default:
            evaluationTime = null;
            break;
    }

    return evaluationTime;
}
项目:jasperreports    文件:JREvaluationTime.java   
private JREvaluationTime(EvaluationTimeEnum type, String groupName, int bandId)
{
    this.type = type;
    this.groupName = groupName;
    this.bandId = bandId;

    this.hash = computeHash();
}
项目:jasperreports    文件:JRFillChart.java   
@Override
protected void evaluate(byte evaluation) throws JRException
{
    reset();

    evaluatePrintWhenExpression(evaluation);

    if (isPrintWhenExpressionNull() || isPrintWhenTrue())
    {
        if (getEvaluationTimeValue() == EvaluationTimeEnum.NOW)
        {
            evaluateRenderer(evaluation);
        }
    }
}