Java 类net.sf.jasperreports.engine.xml.JRXmlConstants 实例源码

项目:jasperreports    文件:TextInputComponentDigester.java   
public static void addTextInputComponentRules(Digester digester)
    {
        String componentNamespace = digester.getRuleNamespaceURI();

        String textInputComponentPattern = "*/componentElement/textInput";
//      digester.addObjectCreate(textInputComponentPattern, TextInputComponent.class.getName());
        digester.addFactoryCreate(textInputComponentPattern, TextInputComponentFactory.class.getName());

        digester.addSetProperties(textInputComponentPattern);

//      digester.addSetProperties(textInputComponentPattern,
//          //properties to be ignored by this rule
//          new String[]{JRXmlConstants.ATTRIBUTE_evaluationTime, StandardBarbecueComponent.PROPERTY_ROTATION}, 
//          new String[0]);

        digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

        digester.addFactoryCreate(textInputComponentPattern + "/textField", TextInputTextFieldFactory.class.getName());

        digester.setRuleNamespaceURI(componentNamespace);
    }
项目: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    文件: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    文件:JRPiePlotFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRChart chart = (JRChart) digester.peek();
    JRDesignPiePlot piePlot = (JRDesignPiePlot)chart.getPlot();

    String isCircular = atts.getValue(JRXmlConstants.ATTRIBUTE_isCircular);
    if (isCircular != null && isCircular.length() > 0) {
        piePlot.setCircular(Boolean.valueOf(isCircular));
    }

    piePlot.setLabelFormat(atts.getValue(JRXmlConstants.ATTRIBUTE_labelFormat));
    piePlot.setLegendLabelFormat(atts.getValue(JRXmlConstants.ATTRIBUTE_legendLabelFormat));

    String isShowLabels = atts.getValue( ATTRIBUTE_isShowLabels );
    if( isShowLabels != null && isShowLabels.length() > 0 ){
        piePlot.setShowLabels(Boolean.valueOf(isShowLabels));
    }

    return piePlot; 
}
项目:jasperreports    文件:JRPie3DPlotFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRChart chart = (JRChart) digester.peek();
    JRDesignPie3DPlot pie3DPlot = (JRDesignPie3DPlot)chart.getPlot();

    String depthFactor = atts.getValue(ATTRIBUTE_depthFactor);
    if (depthFactor != null && depthFactor.length() > 0)
    {
        pie3DPlot.setDepthFactor(Double.valueOf(depthFactor));
    }

    String isCircular = atts.getValue(JRXmlConstants.ATTRIBUTE_isCircular);
    if (isCircular != null && isCircular.length() > 0) {
        pie3DPlot.setCircular(Boolean.valueOf(isCircular));
    }

    pie3DPlot.setLabelFormat(atts.getValue(JRXmlConstants.ATTRIBUTE_labelFormat));
    pie3DPlot.setLegendLabelFormat(atts.getValue(JRXmlConstants.ATTRIBUTE_legendLabelFormat));

    String isShowLabels = atts.getValue( ATTRIBUTE_isShowLabels );
    if( isShowLabels != null && isShowLabels.length() > 0 ){
        pie3DPlot.setShowLabels(Boolean.valueOf(isShowLabels));
    }
    return pie3DPlot;
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 *
 */
protected void exportPart(Integer pageIndex, PrintPart part) throws JRException, IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_part);

    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_pageIndex, pageIndex);
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, part.getName());
    PrintPageFormat pageFormat = part.getPageFormat();
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_pageWidth, pageFormat.getPageWidth());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_pageHeight, pageFormat.getPageHeight());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_topMargin, pageFormat.getTopMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_leftMargin, pageFormat.getLeftMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_bottomMargin, pageFormat.getBottomMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_rightMargin, pageFormat.getRightMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_orientation, pageFormat.getOrientation(), OrientationEnum.PORTRAIT);

    xmlWriter.closeElement();
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
private void exportBox(JRLineBox box) throws IOException
{
    if (box != null)
    {
        xmlWriter.startElement(JRXmlConstants.ELEMENT_box);

        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_padding, box.getOwnPadding());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_topPadding, box.getOwnTopPadding());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_leftPadding, box.getOwnLeftPadding());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_bottomPadding, box.getOwnBottomPadding());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_rightPadding, box.getOwnRightPadding());

        exportPen(JRXmlConstants.ELEMENT_pen, box.getPen());
        exportPen(JRXmlConstants.ELEMENT_topPen, box.getTopPen());
        exportPen(JRXmlConstants.ELEMENT_leftPen, box.getLeftPen());
        exportPen(JRXmlConstants.ELEMENT_bottomPen, box.getBottomPen());
        exportPen(JRXmlConstants.ELEMENT_rightPen, box.getRightPen());

        xmlWriter.closeElement(true);
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 *
 */
protected void exportFont(JRFont font) throws IOException
{
    if (font != null)
    {
        xmlWriter.startElement(JRXmlConstants.ELEMENT_font);
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_fontName, font.getOwnFontName());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_size, font.getOwnFontsize(), true);
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isBold, font.isOwnBold());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isItalic, font.isOwnItalic());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isUnderline, font.isOwnUnderline());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isStrikeThrough, font.isOwnStrikeThrough());
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pdfFontName, font.getOwnPdfFontName());
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pdfEncoding, font.getOwnPdfEncoding());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isPdfEmbedded, font.isOwnPdfEmbedded());
        xmlWriter.closeElement(true);
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
protected void exportFrame(JRPrintFrame frame) throws IOException, JRException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_frame);

    setFrameElementsOffset(frame, true);
    try
    {
        exportReportElement(frame);
        exportBox(frame.getLineBox());
        exportElements(frame.getElements());

        xmlWriter.closeElement();
    }
    finally
    {
        restoreElementOffsets();
    }
}
项目:jasperreports    文件:ChartSettingsXmlFactory.java   
@Override
public Object createObject(Attributes atts)
{
    StandardChartSettings chartSettings = (StandardChartSettings) digester.peek();

    EdgeEnum position = EdgeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_position));
    if (position != null)
    {
        chartSettings.setTitlePosition(position);
    }

    Color color = JRColorUtil.getColor(atts.getValue(JRXmlConstants.ATTRIBUTE_color), Color.black);
    if (color != null)
    {
        chartSettings.setTitleColor(color);
    }

    return chartSettings;
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
/**
 * @deprecated To be removed.
 */
private void writeMarkerProperty(
    net.sf.jasperreports.components.map.MarkerProperty markerProperty, 
    JRXmlWriteHelper writer, 
    JRXmlWriter reportWriter, 
    XmlNamespace namespace, 
    JRComponentElement componentElement
    ) throws IOException
{
    writer.startElement(MapXmlFactory.ELEMENT_markerProperty, namespace);
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_name, markerProperty.getName());
    if(markerProperty.getValue() != null)
    {
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_value, markerProperty.getValue());
    }
    writeExpression(JRXmlConstants.ELEMENT_valueExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, markerProperty.getValueExpression(), false, componentElement, reportWriter);
    writer.closeElement();
}
项目:jasperreports    文件:MarkerPropertyXmlFactory.java   
@Override
public Object createObject(Attributes atts)
{
    StandardMarkerProperty markerProperty = new StandardMarkerProperty();

    String name = atts.getValue(JRXmlConstants.ATTRIBUTE_name);
    if(name != null)
    {
        markerProperty.setName(name);
    }
    String value = atts.getValue(JRXmlConstants.ATTRIBUTE_value);
    if(value != null)
    {
        markerProperty.setValue(value);
    }
    return markerProperty;
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
private void writeFont(JRFont font, JRXmlWriteHelper writer) throws IOException
{
    if (font != null)
    {
        writer.startElement(JRXmlConstants.ELEMENT_font, JRXmlWriter.JASPERREPORTS_NAMESPACE);
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_fontName, font.getOwnFontName());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_size, font.getOwnFontsize());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_isBold, font.isOwnBold());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_isItalic, font.isOwnItalic());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_isUnderline, font.isOwnUnderline());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_isStrikeThrough, font.isOwnStrikeThrough());
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pdfFontName, font.getOwnPdfFontName());
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pdfEncoding, font.getOwnPdfEncoding());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_isPdfEmbedded, font.isOwnPdfEmbedded());
        writer.closeElement(true);
    }
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
private void writeSpiderPlot(SpiderPlot spiderPlot, ChartSettings chartSettings, JRXmlWriteHelper writer, XmlNamespace namespace) throws IOException
    {
        writer.startElement(ELEMENT_spiderPlot, namespace);
        writer.addAttribute(ATTRIBUTE_rotation, spiderPlot.getRotation());
        writer.addAttribute(ATTRIBUTE_tableOrder, spiderPlot.getTableOrder());
        writer.addAttribute(ATTRIBUTE_webFilled, spiderPlot.getWebFilled());
        writer.addAttribute(ATTRIBUTE_startAngle, spiderPlot.getStartAngle());
        writer.addAttribute(ATTRIBUTE_headPercent, spiderPlot.getHeadPercent());
        writer.addAttribute(ATTRIBUTE_interiorGap, spiderPlot.getInteriorGap());
        writer.addAttribute(ATTRIBUTE_axisLineColor, spiderPlot.getAxisLineColor());
        writer.addAttribute(ATTRIBUTE_axisLineWidth, spiderPlot.getAxisLineWidth());
        writer.addAttribute(ATTRIBUTE_labelGap, spiderPlot.getLabelGap());
        writer.addAttribute(ATTRIBUTE_labelColor, spiderPlot.getLabelColor());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_backcolor, spiderPlot.getBackcolor());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_backgroundAlpha, spiderPlot.getBackgroundAlpha());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_foregroundAlpha, spiderPlot.getForegroundAlpha());

        //FIXME: series colors
//      writeSeriesColors(spiderPlot.getSeriesColors(), writer);

        writeLabelFont(spiderPlot.getLabelFont(), writer);
        writeExpression(ELEMENT_maxValueExpression, namespace, spiderPlot.getMaxValueExpression(), false, writer);
        writer.closeElement(true);

    }
项目: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    文件: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    文件:SortComponentSymbolFontFactory.java   
@Override
public void setStyle(JRFont font, Attributes atts)
{
    JRDesignFont designFont = (JRDesignFont)font;
        String styleName = atts.getValue(JRXmlConstants.ATTRIBUTE_reportFont);

        if (styleName != null)
        {
            JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2);
            Map<String,JRStyle> stylesMap = jasperDesign.getStylesMap();

            if (stylesMap.containsKey(styleName))
            {
                JRStyle style = stylesMap.get(styleName);
                designFont.setStyle(style);
            }
            else
            {
                designFont.setStyleNameReference(styleName);
            }
        }
}
项目: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    文件:ComponentsXmlDigesterConfigurer.java   
protected void addItemRules(Digester digester, String itemPattern, String namespace)
{
    digester.addFactoryCreate(itemPattern, ItemXmlFactory.class.getName());
    digester.addSetNext(itemPattern, "addItem", Item.class.getName());

    String locationItemPropertyPattern = itemPattern + "/itemProperty";
    digester.addFactoryCreate(locationItemPropertyPattern, ItemPropertyXmlFactory.class.getName());
    digester.addSetNext(locationItemPropertyPattern, "addItemProperty", ItemProperty.class.getName());

    digester.setRuleNamespaceURI(namespace);

    String locationItemPropertyValueExpressionPattern = locationItemPropertyPattern + "/" + JRXmlConstants.ELEMENT_valueExpression;
    digester.addFactoryCreate(locationItemPropertyValueExpressionPattern, JRExpressionFactory.class.getName());
    digester.addCallMethod(locationItemPropertyValueExpressionPattern, "setText", 0);
    digester.addSetNext(locationItemPropertyValueExpressionPattern, "setValueExpression", JRExpression.class.getName());
}
项目:jasperreports    文件:ItemPropertyXmlFactory.java   
@Override
public Object createObject(Attributes atts)
{
    StandardItemProperty itemProperty = new StandardItemProperty();

    String name = atts.getValue(JRXmlConstants.ATTRIBUTE_name);
    if(name != null)
    {
        itemProperty.setName(name);
    }
    String value = atts.getValue(JRXmlConstants.ATTRIBUTE_value);
    if(value != null)
    {
        itemProperty.setValue(value);
    }
    return itemProperty;
}
项目:jasperreports    文件:PartComponentsXmlWriter.java   
protected void writeSubreport(JRPart part, JRXmlWriter reportWriter) throws IOException
{
    SubreportPartComponent subreport = (SubreportPartComponent) part.getComponent();
    ComponentKey componentKey = part.getComponentKey();
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();

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

    writer.startElement(PartComponentsExtensionsRegistryFactory.SUBREPORT_PART_COMPONENT_NAME, namespace);
    writer.addAttribute("usingCache", subreport.getUsingCache());

    writer.writeExpression(JRXmlConstants.ELEMENT_parametersMapExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, subreport.getParametersMapExpression());

    JRSubreportParameter[] parameters = subreport.getParameters();
    if (parameters != null && parameters.length > 0)
    {
        for(int i = 0; i < parameters.length; i++)
        {
            reportWriter.writeSubreportParameter(parameters[i], JRXmlWriter.JASPERREPORTS_NAMESPACE);
        }
    }

    JRSubreportReturnValue[] returnValues = subreport.getReturnValues();
    if (returnValues != null && returnValues.length > 0)
    {
        for(int i = 0; i < returnValues.length; i++)
        {
            reportWriter.writeSubreportReturnValue(returnValues[i], JRXmlWriter.JASPERREPORTS_NAMESPACE);
        }
    }

    writer.writeExpression(JRXmlConstants.ELEMENT_subreportExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, subreport.getExpression());

    writer.closeElement();
}
项目:jasperreports    文件:PartComponentsXmlDigesterConfigurer.java   
protected void addSubreportRules(Digester digester)
{
    String subreportPattern = "*/part/subreportPart";
    digester.addObjectCreate(subreportPattern, StandardSubreportPartComponent.class);
    digester.addSetProperties(subreportPattern);

    String partNamespace = digester.getRuleNamespaceURI();
    String jrNamespace = JRXmlConstants.JASPERREPORTS_NAMESPACE;

    digester.setRuleNamespaceURI(jrNamespace);

    String paramMapExpressionPattern = subreportPattern + "/parametersMapExpression";
    digester.addFactoryCreate(paramMapExpressionPattern, 
            JRExpressionFactory.class.getName());
    digester.addCallMethod(paramMapExpressionPattern, "setText", 0);
    digester.addSetNext(paramMapExpressionPattern, "setParametersMapExpression", 
            JRExpression.class.getName());

    /*   */
    digester.addFactoryCreate("*/subreportPart/subreportParameter", JRSubreportParameterFactory.class.getName());
    digester.addSetNext("*/subreportPart/subreportParameter", "addParameter", JRSubreportParameter.class.getName());

    /*   */
    digester.addFactoryCreate("*/subreportPart/subreportParameter/subreportParameterExpression", JRExpressionFactory.class.getName());
    digester.addSetNext("*/subreportPart/subreportParameter/subreportParameterExpression", "setExpression", JRExpression.class.getName());
    digester.addCallMethod("*/subreportPart/subreportParameter/subreportParameterExpression", "setText", 0);

    /*   */
    digester.addFactoryCreate("*/subreportPart/returnValue", JRSubreportReturnValueFactory.class.getName());
    digester.addSetNext("*/subreportPart/returnValue", "addReturnValue", JRSubreportReturnValue.class.getName());

    String subreportExpressionPattern = subreportPattern + "/subreportExpression";
    digester.addFactoryCreate(subreportExpressionPattern, 
            JRExpressionFactory.class.getName());
    digester.addCallMethod(subreportExpressionPattern, "setText", 0);
    digester.addSetNext(subreportExpressionPattern, "setExpression", 
            JRExpression.class.getName());

    digester.setRuleNamespaceURI(partNamespace);
}
项目:jasperreports    文件:JRXmlExporter.java   
protected void exportProperties(JRPropertiesHolder propertiesHolder) throws IOException
{
    if (propertiesHolder.hasProperties())
    {
        JRPropertiesMap propertiesMap = propertiesHolder.getPropertiesMap();
        String[] propertyNames = propertiesMap.getPropertyNames();
        if (propertyNames != null && propertyNames.length > 0)
        {
            for(int i = 0; i < propertyNames.length; i++)
            {
                xmlWriter.startElement(JRXmlConstants.ELEMENT_property);
                xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, propertyNames[i]);
                String value = propertiesMap.getProperty(propertyNames[i]);
                if (value != null)
                {
                    String encodedValue = JRStringUtil.encodeXmlAttribute(value);
                    if (
                        isNewerVersionOrEqual(JRConstants.VERSION_6_4_0)
                        && encodedValue.length() != value.length()
                        )
                    {
                        xmlWriter.writeCDATA(value);
                    }
                    else
                    {
                        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_value, encodedValue);
                    }
                }
                xmlWriter.closeElement();
            }
        }
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 */
protected void exportOrigin(JROrigin origin) throws IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_origin);
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_report, origin.getReportName());
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_group, origin.getGroupName());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_band, origin.getBandTypeValue());
    xmlWriter.closeElement();
}
项目:jasperreports    文件:JRXmlExporter.java   
protected void exportBookmark(PrintBookmark bookmark) throws IOException
{
    if (bookmark != null)
    {
        xmlWriter.startElement(JRXmlConstants.ELEMENT_bookmark);
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_label, bookmark.getLabel());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_pageIndex, bookmark.getPageIndex());
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_elementAddress, bookmark.getElementAddress());

        exportBookmarks(bookmark.getBookmarks());

        xmlWriter.closeElement();
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
protected void exportPage(JRPrintPage page) throws JRException, IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_page);

    exportElements(page.getElements());

    xmlWriter.closeElement();

    JRExportProgressMonitor progressMonitor = getCurrentItemConfiguration().getProgressMonitor();
    if (progressMonitor != null)
    {
        progressMonitor.afterPageExport();
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
protected void exportLine(JRPrintLine line) throws IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_line);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_direction, line.getDirectionValue(), LineDirectionEnum.TOP_DOWN);

    exportReportElement(line);
    exportGraphicElement(line);

    xmlWriter.closeElement();
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
protected void exportGraphicElement(JRPrintGraphicElement element) throws IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_graphicElement);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_fill, element.getOwnFillValue());
    exportPen(element.getLinePen());
    xmlWriter.closeElement(true);
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
protected void exportPen(String element, JRPen pen) throws IOException
{
    xmlWriter.startElement(element);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineWidth, pen.getOwnLineWidth());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineStyle, pen.getOwnLineStyleValue());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineColor, pen.getOwnLineColor());
    xmlWriter.closeElement(true);
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
protected void exportRectangle(JRPrintRectangle rectangle) throws IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_rectangle);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_radius, rectangle.getOwnRadius());

    exportReportElement(rectangle);
    exportGraphicElement(rectangle);

    xmlWriter.closeElement();
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
protected void exportEllipse(JRPrintEllipse ellipse) throws IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_ellipse);

    exportReportElement(ellipse);
    exportGraphicElement(ellipse);

    xmlWriter.closeElement();
}
项目:jasperreports    文件:JRXmlExporter.java   
protected StringBuilder formatTextLineBreakOffsets(short[] lineBreakOffsets)
{
    StringBuilder offsetsString = new StringBuilder();
    for (int i = 0; i < lineBreakOffsets.length; i++)
    {
        if (i > 0)
        {
            offsetsString.append(JRXmlConstants.LINE_BREAK_OFFSET_SEPARATOR);
        }
        offsetsString.append(lineBreakOffsets[i]);
    }
    return offsetsString;
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
private void exportParagraph(JRParagraph paragraph) throws IOException
{
    if (paragraph != null)
    {
        xmlWriter.startElement(JRXmlConstants.ELEMENT_paragraph);

        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineSpacing, paragraph.getOwnLineSpacing());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineSpacingSize, paragraph.getOwnLineSpacingSize());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_firstLineIndent, paragraph.getOwnFirstLineIndent());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_leftIndent, paragraph.getOwnLeftIndent());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_rightIndent, paragraph.getOwnRightIndent());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_spacingBefore, paragraph.getOwnSpacingBefore());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_spacingAfter, paragraph.getOwnSpacingAfter());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_tabStopWidth, paragraph.getOwnTabStopWidth());

        /*   */
        TabStop[] tabStops = paragraph.getTabStops();
        if (tabStops != null && tabStops.length > 0)
        {
            for(int i = 0; i < tabStops.length; i++)
            {
                exportTabStop(tabStops[i]);
            }
        }

        xmlWriter.closeElement(true);
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 *
 */
public void exportTabStop(TabStop tabStop) throws IOException
{
    if (tabStop != null)
    {
        xmlWriter.startElement(JRXmlConstants.ELEMENT_tabStop);

        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_position, tabStop.getPosition());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_alignment, tabStop.getAlignment());

        xmlWriter.closeElement(true);
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
protected void exportHyperlinkParameter(JRPrintHyperlinkParameter parameter) throws IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_hyperlinkParameter);
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, parameter.getName());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_class, parameter.getValueClass(), DEFAULT_OBJECT_TYPE);

    if (parameter.getValue() != null)
    {
        String data = JRValueStringUtils.serialize(parameter.getValueClass(), parameter.getValue());
        xmlWriter.writeCDATAElement(JRXmlConstants.ELEMENT_hyperlinkParameterValue, data);
    }

    xmlWriter.closeElement();
}
项目:jasperreports    文件:JRCrosstabMeasureFactory.java   
@Override
public Object createObject(Attributes attributes)
{
    JRDesignCrosstabMeasure measure = new JRDesignCrosstabMeasure();

    measure.setName(attributes.getValue(ATTRIBUTE_name));
    measure.setValueClassName(attributes.getValue(ATTRIBUTE_class));
    measure.setIncrementerFactoryClassName(attributes.getValue(ATTRIBUTE_incrementerFactoryClass));

    String calcAttr = attributes.getValue(ATTRIBUTE_calculation);
    if (calcAttr != null)
    {
        CalculationEnum calculation = CalculationEnum.getByName(attributes.getValue(JRXmlConstants.ATTRIBUTE_calculation));
        measure.setCalculation(calculation);

    }

    CrosstabPercentageEnum percentage = CrosstabPercentageEnum.getByName(attributes.getValue(ATTRIBUTE_percentageOf));
    if (percentage != null)
    {
        measure.setPercentageType(percentage);
    }

    String percentageCalcAttr = attributes.getValue(ATTRIBUTE_percentageCalculatorClass);
    if (percentageCalcAttr != null)
    {
        measure.setPercentageCalculatorClassName(percentageCalcAttr);
    }

    return measure;
}
项目:jasperreports    文件:ChartSettingsXmlFactory.java   
@Override
public Object createObject(Attributes atts)
{
    StandardChartSettings chartSettings = new StandardChartSettings();

    String isShowLegend = atts.getValue(JRXmlConstants.ATTRIBUTE_isShowLegend);
    if (isShowLegend != null && isShowLegend.length() > 0)
    {
        chartSettings.setShowLegend(Boolean.valueOf(isShowLegend));
    }

    Color backcolor = JRColorUtil.getColor(atts.getValue(JRXmlConstants.ATTRIBUTE_backcolor), null);
    if (backcolor != null)
    {
        chartSettings.setBackcolor(backcolor);
    }

    chartSettings.setLinkType(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkType));
    chartSettings.setLinkTarget(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTarget));

    String bookmarkLevelAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_bookmarkLevel);
    if (bookmarkLevelAttr != null)
    {
        chartSettings.setBookmarkLevel(Integer.parseInt(bookmarkLevelAttr));
    }

    chartSettings.setCustomizerClass(atts.getValue(JRXmlConstants.ATTRIBUTE_customizerClass));
    chartSettings.setRenderType(atts.getValue(JRXmlConstants.ATTRIBUTE_renderType));

    return chartSettings;
}
项目:jasperreports    文件:ChartSettingsXmlFactory.java   
@Override
public Object createObject(Attributes atts)
{
    StandardChartSettings chartSettings = (StandardChartSettings) digester.peek();

    Color color = JRColorUtil.getColor(atts.getValue(JRXmlConstants.ATTRIBUTE_color), Color.black);
    if (color != null)
    {
        chartSettings.setSubtitleColor(color);
    }

    return chartSettings;
}
项目:jasperreports    文件:BarcodeXmlWriter.java   
protected void writeBaseAttributes(BarcodeComponent barcode)
{
    xmlWriteHelper.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, 
            barcode.getEvaluationTimeValue(), EvaluationTimeEnum.NOW);
    xmlWriteHelper.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, 
            barcode.getEvaluationGroup());
}