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

项目: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    文件:AbstractPartComponentXmlWriter.java   
/**
 * 
 */
public static String getVersion(JasperReportsContext jasperReportsContext, JRPart part, JRXmlWriter reportWriter) 
{
    String version = null;

    ComponentKey componentKey = part.getComponentKey();
    String versionProperty = PROPERTY_PART_COMPONENTS_PREFIX + componentKey.getName() + AbstractComponentXmlWriter.PROPERTY_COMPONENTS_VERSION_SUFFIX;

    if (part.getPropertiesMap().containsProperty(versionProperty))
    {
        version = part.getPropertiesMap().getProperty(versionProperty);
    }
    else
    {
        JRReport report = reportWriter.getReport();
        version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, versionProperty);

        if (version == null)
        {
            version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
        }
    }

    return version;
}
项目: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    文件:AbstractComponentXmlWriter.java   
/**
 * 
 */
public static String getVersion(JasperReportsContext jasperReportsContext, JRComponentElement componentElement, JRXmlWriter reportWriter) 
{
    String version = null;

    ComponentKey componentKey = componentElement.getComponentKey();
    String versionProperty = PROPERTY_COMPONENTS_PREFIX + componentKey.getName() + PROPERTY_COMPONENTS_VERSION_SUFFIX;

    if (componentElement.getPropertiesMap().containsProperty(versionProperty))
    {
        version = componentElement.getPropertiesMap().getProperty(versionProperty);
    }
    else
    {
        JRReport report = reportWriter.getReport();
        version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, versionProperty);

        if (version == null)
        {
            version = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
        }
    }

    return version;
}
项目:jasperreports    文件:ComponentsXmlDigesterConfigurer.java   
protected <T> void addExpressionRules(Digester digester, String expressionPattern,
        Class<T> factoryClass, String setterMethod, boolean jrNamespace)
{
    String originalNamespace = digester.getRuleNamespaceURI();
    if (jrNamespace)
    {
        digester.setRuleNamespaceURI(JRXmlWriter.JASPERREPORTS_NAMESPACE.getNamespaceURI());
    }

    digester.addFactoryCreate(expressionPattern, factoryClass);
    digester.addCallMethod(expressionPattern, "setText", 0);
    digester.addSetNext(expressionPattern, setterMethod,
            JRExpression.class.getName());

    if (jrNamespace)
    {
        digester.setRuleNamespaceURI(originalNamespace);
    }
}
项目:ireport-fork    文件:CompileThread.java   
public static void writeReport(JasperDesign jd, File outputFile) throws java.lang.Exception
{
    final String compatibility = IReportManager.getPreferences().get("compatibility", "");

    String content = "";
    if (compatibility.length() == 0)
    {
        content = JRXmlWriter.writeReport(jd, "UTF-8"); // IReportManager.getInstance().getProperty("jrxmlEncoding", System.getProperty("file.encoding") ));
    }
    else
    {
        content = JRXmlWriterHelper.writeReport(jd, "UTF-8", compatibility);
    }

    Writer out = new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8");
    out.write(content);
    out.close();
}
项目:ireport-fork    文件:JrxmlSourceEditor.java   
@Override
public void componentShowing() {
    super.componentShowing();
    JasperDesign jd = ((JrxmlEditorSupport)cloneableEditorSupport()).getCurrentModel();
    if (jd != null && ((JrxmlEditorSupport)cloneableEditorSupport()).isModified())
    {
        // Update the content...
        try {
                String content = JRXmlWriter.writeReport(jd,"UTF-8"); // IReportManager.getInstance().getProperty("jrxmlEncoding", System.getProperty("file.encoding") ));
                getEditorPane().setText(content);
                getEditorPane().setCaretPosition(0);
                ((JrxmlVisualView)((JrxmlEditorSupport)cloneableEditorSupport()).getDescriptions()[0]).setNeedModelRefresh(false);
        } catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }
    ((JrxmlEditorSupport)cloneableEditorSupport()).setCurrentModel(null);

}
项目:ireport-fork    文件:ReportUnitWizardDescriptor.java   
public static void writeReport(JasperDesign jd, File outputFile) throws java.lang.Exception
{
    final String compatibility = IReportManager.getPreferences().get("compatibility", "");

    String content = "";
    if (compatibility.length() == 0)
    {
        content = JRXmlWriter.writeReport(jd, "UTF-8"); // IReportManager.getInstance().getProperty("jrxmlEncoding", System.getProperty("file.encoding") ));
    }
    else
    {
        content = JRXmlWriterHelper.writeReport(jd, "UTF-8", compatibility);
    }

    Writer out = new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8");
    out.write(content);
    out.close();
}
项目:jasperreports-wms-component    文件:WmsMapComponentsXmlWriter.java   
@Override
public boolean isToWrite(JRComponentElement componentElement,
    JRXmlWriter reportWriter)
{
  ComponentKey componentKey = componentElement.getComponentKey();
  if (ComponentsExtensionsRegistryFactory.NAMESPACE.equals(componentKey
      .getNamespace())) {
    if (ComponentsExtensionsRegistryFactory.WMS_MAP_COMPONENT_NAME
        .equals(componentKey.getName())) {
      return isNewerVersionOrEqual(componentElement, reportWriter,
          JRConstants.VERSION_5_0_1);
    }
  }
  // XXX: Defaults to true in jr ComponentsExtensionRegistryFactory???
  return false;
}
项目:jasperreports-wms-component    文件:WmsMapComponentsXmlWriter.java   
protected String getVersion(JRComponentElement componentElement,
    JRXmlWriter reportWriter) {
  String version = null;

  ComponentKey componentKey = componentElement.getComponentKey();
  String versionProperty = PROPERTY_COMPONENTS_PREFIX
      + componentKey.getName() + PROPERTY_COMPONENTS_VERSION_SUFFIX;

  if (componentElement.getPropertiesMap().containsProperty(versionProperty)) {
    version = componentElement.getPropertiesMap()
        .getProperty(versionProperty);
  } else {
    JRReport report = reportWriter.getReport();
    version = JRPropertiesUtil.getInstance(jasperReportsContext)
        .getProperty(report, versionProperty);

    if (version == null) {
      version = JRPropertiesUtil.getInstance(jasperReportsContext)
          .getProperty(report, JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
    }
  }

  return version;
}
项目:jasperreports    文件:TextInputComponentXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    if (component instanceof TextInputComponent) {
        TextInputComponent textInputComponent = (TextInputComponent) component;
        ComponentKey componentKey = componentElement.getComponentKey();
        writeTextInputComponent(textInputComponent, componentKey, reportWriter);
    }
}
项目: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   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    if (component instanceof HtmlComponent) 
    {
        writeHtmlComponent(componentElement, reportWriter);
    }
}
项目: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   
@Override
public void writeToXml(JRPart part, JRXmlWriter reportWriter) throws IOException
{
    PartComponent component = part.getComponent();
    if (component instanceof SubreportPartComponent)
    {
        writeSubreport(part, reportWriter);
    }
}
项目: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    文件:PartComponentsXmlWriter.java   
@Override
public boolean isToWrite(JRPart part, JRXmlWriter reportWriter) 
{
    ComponentKey componentKey = part.getComponentKey();
    if (ComponentsExtensionsRegistryFactory.NAMESPACE.equals(componentKey.getNamespace()))
    {
        if(PartComponentsExtensionsRegistryFactory.SUBREPORT_PART_COMPONENT_NAME.equals(componentKey.getName()))
        {
            return isNewerVersionOrEqual(part, reportWriter, JRConstants.VERSION_6_0_0);
        }
    }

    return true;
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 * 
 */
public static void main(String[] args) 
{
    if(args.length < 2)
    {
        System.out.println( "JRApiWriter usage:" );
        System.out.println( "\tjava JRApiWriter reportCreatorClassName file" );
        return;
    }

    String reportCreatorClassName = args[0];
    String destFileName = args[1];

    try
    {
        Class<?> reportCreatorClass = Class.forName(reportCreatorClassName);
        ReportCreator reportCreator = (ReportCreator)reportCreatorClass.newInstance();
        JasperDesign jasperDesign = reportCreator.create();
        new JRXmlWriter(DefaultJasperReportsContext.getInstance()).write(jasperDesign, destFileName, "UTF-8");
    }
    catch (Exception e)
    {
        if (log.isErrorEnabled())
        {
            log.error("Error running report creator class : " + reportCreatorClassName, e);
        }
    }
}
项目:jasperreports    文件:JasperCompileManager.java   
/**
 * Generates the XML representation of the report design supplied as the first parameter
 * and place it in the file specified by the second parameter. The result is "UTF-8" encoded.
 *
 * @param report       source report design object
 * @param destFileName output file name to write the XML report design representation to
 * @see net.sf.jasperreports.engine.xml.JRXmlWriter
 */
public void writeToXmlFile(
    JRReport report,
    String destFileName
    ) throws JRException
{
    new JRXmlWriter(jasperReportsContext).write(
        report,
        destFileName,
        "UTF-8"
        );
}
项目:jasperreports    文件:JasperCompileManager.java   
/**
 * Generates the XML representation of the report design object supplied as parameter
 * and writes it to the specified output stream, using the "UTF-8" encoding.
 *
 * @param report       source report design object
 * @param outputStream output stream to write the XML report design representation to
 * @see net.sf.jasperreports.engine.xml.JRXmlWriter
 */
public void writeToXmlStream(
    JRReport report, 
    OutputStream outputStream
    ) throws JRException
{
    new JRXmlWriter(jasperReportsContext).write(
        report, 
        outputStream,
        "UTF-8"
        );
}
项目:jasperreports    文件:BarcodeXmlWriter.java   
public BarcodeXmlWriter(JRXmlWriter reportWriter, JRComponentElement componentElement, String version, VersionComparator versionComparator)
{
    this.xmlWriteHelper = reportWriter.getXmlWriteHelper();
    this.barcodeComponent = (BarcodeComponent) componentElement.getComponent();
    this.componentKey = componentElement.getComponentKey();
    this.version = version;
    this.versionComparator = versionComparator;
}
项目: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    文件:ComponentsXmlWriter.java   
@Override
public boolean isToWrite(JRComponentElement componentElement, JRXmlWriter reportWriter) 
{
    ComponentKey componentKey = componentElement.getComponentKey();
    if (ComponentsExtensionsRegistryFactory.NAMESPACE.equals(componentKey.getNamespace()))
    {
        if(ComponentsExtensionsRegistryFactory.SORT_COMPONENT_NAME.equals(componentKey.getName())
                || ComponentsExtensionsRegistryFactory.MAP_COMPONENT_NAME.equals(componentKey.getName()))
        {
            return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_1_1);
        }
        else if(ComponentsExtensionsRegistryFactory.SPIDERCHART_COMPONENT_NAME.equals(componentKey.getName()))
        {
            return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_7_4);
        }
        else if(ComponentsExtensionsRegistryFactory.TABLE_COMPONENT_NAME.equals(componentKey.getName()))
        {
            return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_7_2);
        }
        else if(ComponentsExtensionsRegistryFactory.LIST_COMPONENT_NAME.equals(componentKey.getName()))
        {
            return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_5_1);
        }
        else if(ComponentsExtensionsRegistryFactory.BARBECUE_COMPONENT_NAME.equals(componentKey.getName())
                || isBarcode4jName(componentKey.getName()))
        {
            return isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_3_5_2);
        }
    }

    return true;
}
项目: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 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    文件: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);
    }
}