Package net.sf.jasperreports.engine.util

Examples of net.sf.jasperreports.engine.util.JRXmlWriteHelper


  }

  protected void writeList(ListComponent list, ComponentKey componentKey,
      JRXmlWriter reportWriter) throws IOException
  {
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
   
    XmlNamespace namespace = new XmlNamespace(
        ComponentsExtensionsRegistryFactory.NAMESPACE,
        componentKey.getNamespacePrefix(),
        ComponentsExtensionsRegistryFactory.XSD_LOCATION);
   
    writer.startElement("list", namespace);
    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();
  }
View Full Code Here


  }

  protected void writeBarbecue(BarbecueComponent barcode, ComponentKey componentKey,
      JRXmlWriter reportWriter) throws IOException
  {
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
   
    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());
    writer.addAttribute("rotation", barcode.getOwnRotation());
    if (barcode.getEvaluationTimeValue() != EvaluationTimeEnum.NOW)
    {
      writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime,
          barcode.getEvaluationTimeValue());
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup,
        barcode.getEvaluationGroup());

    writer.writeExpression("codeExpression",
        barcode.getCodeExpression(), false);
    writer.writeExpression("applicationIdentifierExpression",
        barcode.getApplicationIdentifierExpression(), false);
   
    writer.closeElement();
  }
View Full Code Here

  }

  protected void writeTable(TableComponent table, ComponentKey componentKey,
      final JRXmlWriter reportWriter) throws IOException
  {
    final JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
   
    XmlNamespace namespace = new XmlNamespace(
        ComponentsExtensionsRegistryFactory.NAMESPACE,
        componentKey.getNamespacePrefix(),
        ComponentsExtensionsRegistryFactory.XSD_LOCATION);
   
    writer.startElement("table", namespace);
    reportWriter.writeDatasetRun(table.getDatasetRun());
   
    ColumnVisitor<Void> columnWriter = new ColumnVisitor<Void>()
    {
      public Void visitColumn(Column column)
      {
        try
        {
          writer.startElement("column");
          writer.addAttribute("width", column.getWidth());
          writer.writeExpression(JRXmlConstants.ELEMENT_printWhenExpression,
              JRXmlWriter.JASPERREPORTS_NAMESPACE,
              column.getPrintWhenExpression(), false);
          writeTableCell(column.getTableHeader(), "tableHeader", reportWriter);
          writeTableCell(column.getTableFooter(), "tableFooter", reportWriter);
          writeGroupCells(column.getGroupHeaders(), "groupHeader", reportWriter);
          writeGroupCells(column.getGroupFooters(), "groupFooter", reportWriter);
          writeTableCell(column.getColumnHeader(), "columnHeader", reportWriter);
          writeTableCell(column.getColumnFooter(), "columnFooter", reportWriter);
          writeTableCell(column.getDetailCell(), "detailCell", reportWriter);
          writer.closeElement();
        }
        catch (IOException e)
        {
          throw new JRRuntimeException(e);
        }
       
        return null;
      }

      public Void visitColumnGroup(ColumnGroup columnGroup)
      {
        try
        {
          writer.startElement("columnGroup");
          writer.addAttribute("width", columnGroup.getWidth());
          writer.writeExpression(JRXmlConstants.ELEMENT_printWhenExpression,
              JRXmlWriter.JASPERREPORTS_NAMESPACE,
              columnGroup.getPrintWhenExpression(), false);
          writeTableCell(columnGroup.getTableHeader(), "tableHeader", reportWriter);
          writeTableCell(columnGroup.getTableFooter(), "tableFooter", reportWriter);
          writeGroupCells(columnGroup.getGroupHeaders(), "groupHeader", reportWriter);
          writeGroupCells(columnGroup.getGroupFooters(), "groupFooter", reportWriter);
          writeTableCell(columnGroup.getColumnHeader(), "columnHeader", reportWriter);
          writeTableCell(columnGroup.getColumnFooter(), "columnFooter", reportWriter);
         
          // deep
          for (BaseColumn column : columnGroup.getColumns())
          {
            column.visitColumn(this);
          }
         
          writer.closeElement();
        }
        catch (IOException e)
        {
          throw new JRRuntimeException(e);
        }
       
        return null;
      }
    };
   
    for (BaseColumn column : table.getColumns())
    {
      column.visitColumn(columnWriter);
    }
   
    writer.closeElement();
  }
View Full Code Here

  protected void writeGroupCells(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(groupCell.getCell(), "cell", reportWriter);
        writer.closeElement();
      }
    }
  }
View Full Code Here

  protected void writeTableCell(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());
     
      reportWriter.writeBox(cell.getLineBox(), JRXmlWriter.JASPERREPORTS_NAMESPACE);
      reportWriter.writeChildElements(cell);
     
      writer.closeElement();//cell
    }
  }
View Full Code Here

 
  public void writeToXml(ComponentKey componentKey, Component component,
      JRXmlWriter reportWriter) throws IOException
  {
    SpiderChartComponent spiderChartComponent = (SpiderChartComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
   
    String namespaceURI = componentKey.getNamespace();
    String schemaLocation = ComponentsEnvironment
      .getComponentsBundle(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
  }
View Full Code Here

  }


  protected void exportReportToStream(Writer writer) throws JRException, IOException
  {
    xmlWriter = new JRXmlWriteHelper(writer);
   
    xmlWriter.writeProlog(encoding);
    xmlWriter.writePublicDoctype(JRXmlConstants.ELEMENT_jasperPrint, JRXmlConstants.JASPERPRINT_PUBLIC_ID, dtdLocation);

    xmlWriter.startElement(JRXmlConstants.ELEMENT_jasperPrint);
View Full Code Here

  public void writeToXml(ComponentKey componentKey, Component component,
      JRXmlWriter reportWriter) throws IOException
  {
    PieChartComponent chart = (PieChartComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
   
    String namespaceURI = componentKey.getNamespace();
    String schemaLocation = ComponentsEnvironment
      .getComponentsBundle(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(), false);
    writer.writeExpression("valueExpression", dataset.getValueExpression(), false);
   
    writer.closeElement();//pieDataset
   
    writer.writeExpression("titleExpression", chart.getTitleExpression(), false);
   
    writer.closeElement();//pieChart
  }
View Full Code Here

   */
  public JRXmlTemplateWriter(JRTemplate template, Writer out, String encoding)
  {
    this.template = template;
    this.encoding = encoding;
    useWriter(new JRXmlWriteHelper(out));
  }
View Full Code Here

  /**
   *
   */
  protected void writeReport(Writer out) throws IOException
  {
    useWriter(new JRXmlWriteHelper(out));

    writer.writeProlog(encoding);

    writer.startElement(JRXmlConstants.ELEMENT_jasperReport, getNamespace());
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, report.getName());
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.util.JRXmlWriteHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.