Java 类net.sf.jasperreports.engine.util.JRXmlWriteHelper 实例源码

项目:jasperreports    文件:TextInputComponentXmlWriter.java   
protected void writeTextInputComponent(TextInputComponent textInputComponent, ComponentKey componentKey,
        JRXmlWriter reportWriter) throws IOException {
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();

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

    writer.startElement("textInput", componentNamespace);

    writer.addAttribute("multiLine", textInputComponent.isMultiLine());

    reportWriter.writeTextField(textInputComponent.getTextField());

    writer.closeElement();
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
private void writeItemDataContent(String name, ItemData itemData, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException
{
    writer.startElement(name, namespace);

    JRElementDataset dataset = itemData.getDataset();
    if (dataset != null)
    {
        reportWriter.writeElementDataset(dataset, false);
    }

    /*   */
    List<Item> itemList = itemData.getItems();
    if (itemList != null && !itemList.isEmpty())
    {
        for(Item item : itemList)
        {
            if(item.getProperties() != null && !item.getProperties().isEmpty())
            {
                writeItem(item, writer, reportWriter, namespace, componentElement);
            }
        }
    }
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
/**
 * @deprecated To be removed.
 */
private void writeMarker(
    net.sf.jasperreports.components.map.Marker marker, 
    JRXmlWriteHelper writer, 
    JRXmlWriter reportWriter, 
    XmlNamespace namespace, 
    JRComponentElement componentElement
    ) throws IOException
{
    writer.startElement(MapXmlFactory.ELEMENT_marker, namespace);
    List<net.sf.jasperreports.components.map.MarkerProperty> markerProperties = marker.getProperties();
    for(net.sf.jasperreports.components.map.MarkerProperty property : markerProperties)
    {
        writeMarkerProperty(property, writer, reportWriter, namespace, componentElement);
    }
    writer.closeElement();
}
项目: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    文件:ComponentsXmlWriter.java   
protected void writeTableCell(JRComponentElement componentElement, Cell cell, String name, 
        JRXmlWriter reportWriter) throws IOException
{
    if (cell != null)
    {
        JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
        writer.startElement(name);
        reportWriter.writeStyleReferenceAttr(cell);
        writer.addAttribute("height", cell.getHeight());
        writer.addAttribute("rowSpan", cell.getRowSpan());

        if (isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_8_0))
        {
            reportWriter.writeProperties(cell);
        }
        reportWriter.writeBox(cell.getLineBox(), JRXmlWriter.JASPERREPORTS_NAMESPACE);
        reportWriter.writeChildElements(cell);

        writer.closeElement();//cell
    }
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
private void writeSpiderDataSet(SpiderDataset dataset, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace) throws IOException
{
    writer.startElement(ELEMENT_spiderDataset, namespace);

    reportWriter.writeElementDataset(dataset);

    /*   */
    JRCategorySeries[] categorySeries = dataset.getSeries();
    if (categorySeries != null && categorySeries.length > 0)
    {
        for(int i = 0; i < categorySeries.length; i++)
        {
            writeCategorySeries(categorySeries[i], writer, reportWriter);
        }
    }

    writer.closeElement();
}
项目: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    文件: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    文件: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    文件: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    文件:SimpleFontExtensionHelper.java   
protected static void writeFontExtensions(Writer out, FontExtensionsContainer extensions) throws IOException
{
    JRXmlWriteHelper writer = new JRXmlWriteHelper(out);
    writer.writeProlog(DEFAULT_ENCODING);

    writer.startElement("fontFamilies");

    List<? extends FontFamily> fontFamilies = extensions.getFontFamilies();
    if(fontFamilies != null)
    {
        for (FontFamily fontFamily : fontFamilies)
        {
            writeFontFamily(writer, fontFamily);
        }
    }

    List<? extends FontSet> fontSets = extensions.getFontSets();
    if (fontSets != null)
    {
        for (FontSet fontSet : fontSets)
        {
            writeFontSet(writer, fontSet);
        }
    }

    writer.closeElement();
}
项目:jasperreports    文件:SimpleFontExtensionHelper.java   
protected static void writeExportFonts(JRXmlWriteHelper writer, 
        Map<String, String> exportFonts) throws IOException
{
    if(exportFonts != null)
    {
        writer.startElement(NODE_exportFonts);
        for(String key : exportFonts.keySet())
        {
            writer.writeCDATAElement(NODE_export, exportFonts.get(key), ATTRIBUTE_key, key);
        }
        writer.closeElement();
    }
}
项目:jasperreports    文件:SimpleFontExtensionHelper.java   
private static void writeFontSet(JRXmlWriteHelper writer, FontSet fontSet) throws IOException
{
    if (fontSet == null)
    {
        log.info("Null font set encountered.");
        return;
    }

    if(fontSet.getName() == null)
    {
        log.error("Font set name is required.");
        return;
    }

    writer.startElement(NODE_fontSet);
    writer.addAttribute(ATTRIBUTE_name, fontSet.getName());

    if(fontSet instanceof SimpleFontSet)
    {
        Map<String, String> exportFonts = ((SimpleFontSet) fontSet).getExportFonts();
        writeExportFonts(writer, exportFonts);
    }

    List<FontSetFamily> families = fontSet.getFamilies();
    if (families != null)
    {
        for (FontSetFamily family : families)
        {
            writeFontSetFamily(writer, family);
        }
    }

    writer.closeElement();
}
项目:jasperreports    文件:JRXmlTemplateWriter.java   
/**
 * Creates an XML template writer.
 * 
 * @param jasperReportsContext
 * @param template the template to write
 * @param out the output writer
 * @param encoding the XML encoding to use
 */
public JRXmlTemplateWriter(JasperReportsContext jasperReportsContext, 
        JRTemplate template, Writer out, String encoding)
{
    this.template = template;
    this.encoding = encoding;

    String version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
    useWriter(new JRXmlWriteHelper(out), version);
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
protected void writeList(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    ListComponent list = (ListComponent) componentElement.getComponent();
    ComponentKey componentKey = componentElement.getComponentKey();
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();

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

    writer.startElement("list", namespace);
    if(isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_6_1))
    {
        writer.addAttribute("printOrder", list.getPrintOrderValue());
    }
    writer.addAttribute("ignoreWidth", list.getIgnoreWidth()); 
    reportWriter.writeDatasetRun(list.getDatasetRun());

    ListContents contents = list.getContents();
    writer.startElement("listContents");
    writer.addAttribute("height", contents.getHeight());
    writer.addAttribute("width", contents.getWidth());
    reportWriter.writeChildElements(contents);
    writer.closeElement();

    writer.closeElement();
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
protected void writeBarbecue(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    BarbecueComponent barcode = (BarbecueComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    ComponentKey componentKey = componentElement.getComponentKey();

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

    writer.startElement("barbecue", namespace);

    writer.addAttribute("type", barcode.getType());
    writer.addAttribute("drawText", barcode.isDrawText());
    writer.addAttribute("checksumRequired", barcode.isChecksumRequired());
    writer.addAttribute("barWidth", barcode.getBarWidth());
    writer.addAttribute("barHeight", barcode.getBarHeight());
    if (isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_0_0))
    {
        writer.addAttribute("rotation", barcode.getOwnRotation());
    }
    if (barcode.getEvaluationTimeValue() != EvaluationTimeEnum.NOW)
    {
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, 
                barcode.getEvaluationTimeValue());
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, 
            barcode.getEvaluationGroup());

    writeExpression("codeExpression", barcode.getCodeExpression(), false, componentElement, reportWriter);
    writeExpression("applicationIdentifierExpression", barcode.getApplicationIdentifierExpression(), false, componentElement, reportWriter);

    writer.closeElement();
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
private void writeItemData(String name, ItemData itemData, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException
{
    if (itemData != null)
    {
        writeItemDataContent(name, itemData, writer, reportWriter, namespace, componentElement);
        writer.closeElement();
    }
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
private void writeItem(Item item, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException
{
    writer.startElement(MapXmlFactory.ELEMENT_item, namespace);
    List<ItemProperty> itemProperties = item.getProperties();
    for(ItemProperty property : itemProperties)
    {
        writeItemProperty(property, writer, reportWriter, namespace, componentElement);
    }
    writer.closeElement();
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
private void writeItemProperty(ItemProperty itemProperty, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException
{
    writer.startElement(MapXmlFactory.ELEMENT_itemProperty, namespace);
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, itemProperty.getName());
    if(itemProperty.getValue() != null)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_value, itemProperty.getValue());
    }
    writeExpression(JRXmlConstants.ELEMENT_valueExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, itemProperty.getValueExpression(), false, componentElement, reportWriter);
    writer.closeElement();
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
/**
 * @deprecated To be removed.
 */
private void writeMarkerDataset(net.sf.jasperreports.components.map.MarkerDataset dataset, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException
{
    if (dataset != null)
    {
        writer.startElement(MapXmlFactory.ELEMENT_markerDataset, namespace);

        JRDatasetRun datasetRun = dataset.getDatasetRun();
        if (datasetRun != null)
        {
            reportWriter.writeDatasetRun(datasetRun);
        }

        /*   */
        List<net.sf.jasperreports.components.map.Marker> markerList = dataset.getMarkers();
        if (markerList != null && !markerList.isEmpty())
        {
            for(net.sf.jasperreports.components.map.Marker marker : markerList)
            {
                if(marker.getProperties() != null && !marker.getProperties().isEmpty())
                {
                    writeMarker(marker, writer, reportWriter, namespace, componentElement);
                }
            }
        }

        writer.closeElement();
    }
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
protected void writeGroupCells(JRComponentElement componentElement, List<GroupCell> cells, String name, 
        JRXmlWriter reportWriter) throws IOException
{
    if (cells != null)
    {
        JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
        for (GroupCell groupCell : cells)
        {
            writer.startElement(name);
            writer.addAttribute("groupName", groupCell.getGroupName());
            writeTableCell(componentElement, groupCell.getCell(), "cell", reportWriter);
            writer.closeElement();
        }
    }
}
项目: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    文件:SpiderChartXmlWriter.java   
/**
 *
 */
private void writeCategorySeries(JRCategorySeries categorySeries, JRXmlWriteHelper writer, JRXmlWriter reportWriter) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_categorySeries, JRXmlWriter.JASPERREPORTS_NAMESPACE);

    writeExpression(JRXmlConstants.ELEMENT_seriesExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, categorySeries.getSeriesExpression(), false, writer);
    writeExpression(JRXmlConstants.ELEMENT_categoryExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, categorySeries.getCategoryExpression(), false, writer);
    writeExpression(JRXmlConstants.ELEMENT_valueExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, categorySeries.getValueExpression(), false, writer);
    writeExpression(JRXmlConstants.ELEMENT_labelExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, categorySeries.getLabelExpression(), false, writer);
    reportWriter.writeHyperlink(JRXmlConstants.ELEMENT_itemHyperlink, JRXmlWriter.JASPERREPORTS_NAMESPACE, categorySeries.getItemHyperlink());

    writer.closeElement();
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
private void writeHyperlinkParameters(JRHyperlinkParameter[] parameters, JRXmlWriteHelper writer) throws IOException
{
    if (parameters != null)
    {
        for (int i = 0; i < parameters.length; i++)
        {
            JRHyperlinkParameter parameter = parameters[i];
            writeHyperlinkParameter(parameter, writer);
        }
    }
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
private void writeHyperlinkParameter(JRHyperlinkParameter parameter, JRXmlWriteHelper writer) throws IOException
{
    if (parameter != null)
    {
        writer.startElement(JRXmlConstants.ELEMENT_hyperlinkParameter, JRXmlWriter.JASPERREPORTS_NAMESPACE);
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, parameter.getName());

        writeExpression(JRXmlConstants.ELEMENT_hyperlinkParameterExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE,
                parameter.getValueExpression(), false, writer);

        writer.closeElement();
    }
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
private void writeLabelFont(JRFont labelFont, JRXmlWriteHelper writer) throws IOException
{
    if (labelFont != null)
    {
        writer.startElement(JRXmlConstants.ELEMENT_labelFont, JRXmlWriter.JASPERREPORTS_NAMESPACE);
        writeFont(labelFont, writer);
        writer.closeElement();
    }
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
@SuppressWarnings("deprecation")
protected void writeExpression(String name, XmlNamespace namespace, JRExpression expression, boolean writeClass, JRXmlWriteHelper writer)  throws IOException
{
    if(isNewerVersionOrEqual(version, JRConstants.VERSION_4_1_1))
    {
        writer.writeExpression(name, namespace, expression);
    }
    else
    {
        writer.writeExpression(name, namespace, expression, writeClass);
    }
}
项目:jasperreports    文件:AbstractComponentXmlWriter.java   
@SuppressWarnings("deprecation")
protected void writeExpression(String name, JRExpression expression, boolean writeClass, JRComponentElement componentElement, JRXmlWriter reportWriter)  throws IOException
{
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    if(isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_1_1))
    {
        writer.writeExpression(name, expression);
    }
    else
    {
        writer.writeExpression(name, expression, writeClass);
    }
}
项目:jasperreports    文件:AbstractComponentXmlWriter.java   
@SuppressWarnings("deprecation")
protected void writeExpression(String name, XmlNamespace namespace, JRExpression expression, boolean writeClass, JRComponentElement componentElement, JRXmlWriter reportWriter)  throws IOException
{
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    if(isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_1_1))
    {
        writer.writeExpression(name, namespace, expression);
    }
    else
    {
        writer.writeExpression(name, namespace, expression, writeClass);
    }
}
项目:jasperreports    文件:IconLabelComponentXmlWriter.java   
protected void writeIconLabelComponent(IconLabelComponent iconLabelComponent, ComponentKey componentKey,
        JRXmlWriter reportWriter) throws IOException {
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();

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

    writer.startElement("iconLabel", componentNamespace);

    writer.addAttribute(IconLabelComponent.PROPERTY_ICON_POSITION, iconLabelComponent.getIconPosition());
    writer.addAttribute(IconLabelComponent.PROPERTY_LABEL_FILL, iconLabelComponent.getLabelFill());
    writer.addAttribute(IconLabelComponent.PROPERTY_HORIZONTAL_ALIGNMENT, iconLabelComponent.getOwnHorizontalImageAlign());
    writer.addAttribute(IconLabelComponent.PROPERTY_VERTICAL_ALIGNMENT, iconLabelComponent.getOwnVerticalImageAlign());

    reportWriter.writeBox(iconLabelComponent.getLineBox(), JRXmlWriter.JASPERREPORTS_NAMESPACE);
    writer.startElement("label", componentNamespace);
    reportWriter.writeTextField(iconLabelComponent.getLabelTextField());
    writer.closeElement();
    writer.startElement("icon", componentNamespace);
    reportWriter.writeTextField(iconLabelComponent.getIconTextField());
    writer.closeElement();

    writer.closeElement();
}
项目:dynamicreports-jasper    文件:GoogleChartsHandler.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException {
    if (components.containsKey(componentElement.getComponentKey().getName())) {
        JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();

        String namespaceURI = componentElement.getComponentKey().getNamespace();
        String schemaLocation = ComponentsEnvironment.getInstance(DefaultJasperReportsContext.getInstance()).getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation();
        XmlNamespace namespace = new XmlNamespace(namespaceURI, componentElement.getComponentKey().getNamespacePrefix(), schemaLocation);

        writer.startElement(componentElement.getComponentKey().getName(), namespace);

        writer.closeElement();
    }
}
项目:jasperreports-wms-component    文件:WmsMapComponentsXmlWriter.java   
protected void writeWmsMap(JRComponentElement componentElement,
    JRXmlWriter reportWriter) throws IOException {
  Component component = componentElement.getComponent();
  WmsMapComponent map = (WmsMapComponent) component;
  JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
  ComponentKey componentKey = componentElement.getComponentKey();

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

  writer.startElement("wmsmap", namespace);

  if (map.getEvaluationTime() != EvaluationTimeEnum.NOW) {
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime,
        map.getEvaluationTime());
  }

  writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup,
      map.getEvaluationGroup());
  writer.addAttribute(ATTRIBUTE_WMS_SERVICE_URL, map.getWmsServiceUrl());
  writer.addAttribute(ATTRIBUTE_WMS_VERSION, map.getWmsVersion());
  writer.addAttribute(ATTRIBUTE_SRS, map.getSrs());
  writer.addAttribute(ATTRIBUTE_TRANSPARENT, map.getTransparent());
  writer.addAttribute(ATTRIBUTE_IMAGE_TYPE, map.getImageType());

  writer.writeExpression("bboxExpression",
      map.getBBoxExpression());
  writer.writeExpression("layersExpression",
      map.getLayersExpression());
  writer.writeExpression("stylesExpression",
      map.getStylesExpression());
  writer.writeExpression("urlParametersExpression",
      map.getUrlParametersExpression());

  writer.closeElement();
}
项目:jasperreports-wms-component    文件:WmsMapComponentsXmlWriter.java   
@SuppressWarnings("deprecation")
protected void writeExpression(String name, JRExpression expression,
    boolean writeClass, JRComponentElement componentElement,
    JRXmlWriter reportWriter) throws IOException {
  JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
  if (isNewerVersionOrEqual(componentElement, reportWriter,
      JRConstants.VERSION_4_1_1)) {
    writer.writeExpression(name, expression);
  } else {
    writer.writeExpression(name, expression, writeClass);
  }
}
项目:jasperreports-wms-component    文件:WmsMapComponentsXmlWriter.java   
@SuppressWarnings("deprecation")
protected void writeExpression(String name, XmlNamespace namespace,
    JRExpression expression, boolean writeClass,
    JRComponentElement componentElement, JRXmlWriter reportWriter)
    throws IOException {
  JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
  if (isNewerVersionOrEqual(componentElement, reportWriter,
      JRConstants.VERSION_4_1_1)) {
    writer.writeExpression(name, namespace, expression);
  } else {
    writer.writeExpression(name, namespace, expression, writeClass);
  }
}
项目:jasperreports    文件:XYChartXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    XYChartComponent chart = (XYChartComponent) 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(ELEMENT_XYChart, namespace);

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

    XYDataset dataset = chart.getDataset();
    writer.startElement(ELEMENT_XYDataset);

    reportWriter.writeElementDataset(dataset);

    XYSeries[] xySeriesArray = dataset.getSeries();
    if (xySeriesArray != null && xySeriesArray.length > 0)
    {
        for(XYSeries xySeries : xySeriesArray)
        {
            writer.startElement(ELEMENT_XYSeries);
            writeExpression(JRXmlConstants.ELEMENT_seriesExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, xySeries.getSeriesExpression(), false, writer);
            writeExpression(JRXmlConstants.ELEMENT_xValueExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, xySeries.getXValueExpression(), false, writer);
            writeExpression(JRXmlConstants.ELEMENT_yValueExpression, JRXmlWriter.JASPERREPORTS_NAMESPACE, xySeries.getYValueExpression(), false, writer);
            writeExpression(ELEMENT_colorExpression, xySeries.getColorExpression(), false, componentElement, reportWriter);
            writer.closeElement();
        }
    }

    writer.closeElement();//XYDataset

    writeExpression(ELEMENT_chartTitleExpression, chart.getChartTitleExpression(), false, componentElement, reportWriter);
    writeExpression(ELEMENT_xAxisTitleExpression, chart.getXAxisTitleExpression(), false, componentElement, reportWriter);
    writeExpression(ELEMENT_yAxisTitleExpression, chart.getYAxisTitleExpression(), false, componentElement, reportWriter);

    writer.closeElement();//XYChart
}
项目:jasperreports    文件:XYChartXmlWriter.java   
protected void writeExpression(String name, XmlNamespace namespace, JRExpression expression, boolean writeClass, JRXmlWriteHelper writer)  throws IOException
{
    writer.writeExpression(name, namespace, expression);
    }
项目:jasperreports    文件:BarChartXmlWriter.java   
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    BarChartComponent chart = (BarChartComponent) 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("barChart", namespace);

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

    BarDataset dataset = chart.getDataset();
    writer.startElement("barDataset");

    reportWriter.writeElementDataset(dataset);

    List<BarSeries> seriesList = dataset.getSeries();
    for(BarSeries series : seriesList)
    {
        writer.startElement("barSeries");
        writer.writeExpression("seriesExpression", series.getSeriesExpression());
        writer.writeExpression("categoryExpression", series.getCategoryExpression());
        writer.writeExpression("valueExpression", series.getValueExpression());
        writer.closeElement();//barSeries
    }
    writer.closeElement();//barDataset

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

    writer.closeElement();//barChart
}
项目:jasperreports    文件:SimpleFontExtensionHelper.java   
/**
 * @throws IOException 
 *
 */
private static void writeFontFamily(JRXmlWriteHelper writer, FontFamily fontFamily) throws IOException 
{
    if (fontFamily != null)
    {
        if (fontFamily.getName() == null)
        {
            log.error("Font family name is required.");
            return;
        }

        writer.startElement(NODE_fontFamily);
        writer.addAttribute(ATTRIBUTE_name, fontFamily.getName());
        writer.addAttribute(ATTRIBUTE_visible, fontFamily.isVisible(), true);

        writeFontFace(writer, fontFamily.getNormalFace(), NODE_normal);
        writeFontFace(writer, fontFamily.getBoldFace(), NODE_bold);
        writeFontFace(writer, fontFamily.getItalicFace(), NODE_italic);
        writeFontFace(writer, fontFamily.getBoldItalicFace(), NODE_boldItalic);

        if (fontFamily.getPdfEncoding() != null)
        {
            writer.writeCDATAElement(NODE_pdfEncoding, fontFamily.getPdfEncoding());

        }
        if (fontFamily.isPdfEmbedded() != null)
        {
            //TODO lucianc we can do without CDATA here
            writer.writeCDATAElement(NODE_pdfEmbedded, Boolean.toString(fontFamily.isPdfEmbedded()));
        }

        if (fontFamily instanceof SimpleFontFamily)
        {
            SimpleFontFamily simpleFontFamily = (SimpleFontFamily)fontFamily;

            Map<String, String> exportFonts = simpleFontFamily.getExportFonts();
            writeExportFonts(writer, exportFonts);

            Set<String> locales = simpleFontFamily.getLocales();

            if (locales != null)
            {
                writer.startElement(NODE_locales);
                for(String locale : locales)
                {
                    writer.writeCDATAElement(NODE_locale, locale);
                }
                writer.closeElement();
            }
        }
        writer.closeElement();
    }       
    else
    {
        log.info("Null font family encountered.");
    }
}
项目:jasperreports    文件:SimpleFontExtensionHelper.java   
/**
 * @throws IOException 
 *
 */
private static void writeFontFace(JRXmlWriteHelper writer, FontFace fontFace, String faceTypeName) throws IOException 
{
    if (fontFace != null)
    {
        if (
            fontFace.getPdf() == null
            && fontFace.getEot() == null
            && fontFace.getSvg() == null
            && fontFace.getWoff() == null
            )
        {
            if (fontFace.getTtf() != null)
            {
                writer.writeCDATAElement(faceTypeName, fontFace.getTtf());
            }
        }
        else
        {
            writer.startElement(faceTypeName);
            if (fontFace.getTtf() != null)
            {
                writer.writeCDATAElement("ttf", fontFace.getTtf());
            }
            if (fontFace.getPdf() != null)
            {
                writer.writeCDATAElement("pdf", fontFace.getPdf());
            }
            if (fontFace.getEot() != null)
            {
                writer.writeCDATAElement("eot", fontFace.getEot());
            }
            if (fontFace.getSvg() != null)
            {
                writer.writeCDATAElement("svg", fontFace.getSvg());
            }
            if (fontFace.getWoff() != null)
            {
                writer.writeCDATAElement("woff", fontFace.getWoff());
            }
            writer.closeElement();
        }
    }
}