@Test
  public void testCanvasWithPrePostPad() throws Exception {
    final MasterReport report = new MasterReport();
    report.setDataFactory(new TableDataFactory("query", new DefaultTableModel(10, 1)));
    report.setQuery("query");

    final Band table = TableTestUtil.createTable(1, 1, 6, new CustomProducer());
    table.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 200f);
    table.getStyle().setStyleProperty(ElementStyleKeys.POS_X, 100f);
    table.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, 10f);
    table.setName("table");
    report.getReportHeader().addElement(TableTestUtil.createDataItem("Pre-Padding", 100, 10));
    report.getReportHeader().addElement(table);

    Element postPaddingItem = TableTestUtil.createDataItem("Post-Padding", 100, 10);
    postPaddingItem.getStyle().setStyleProperty(ElementStyleKeys.POS_X, 300f);
    report.getReportHeader().addElement(postPaddingItem);
    report.getReportHeader().setLayout("canvas");

    PdfReportUtil.createPDF(report, "test-output/PRD-3857-output-canvas.pdf");

    List<LogicalPageBox> pages = DebugReportRunner.layoutPages(report, 0, 1, 2);
    assertPageValid(pages, 0, StrictGeomUtility.toInternalValue(10));
    assertPageValid(pages, 1);
    assertPageValid(pages, 2);
  }
  public void testRichText() throws ReportProcessingException, ContentProcessingException {
    final Element e = new Element();
    e.setElementType(LabelType.INSTANCE);
    e.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.RICH_TEXT_TYPE, "text/html");
    e.setAttribute(
        AttributeNames.Core.NAMESPACE,
        AttributeNames.Core.VALUE,
        "Hi I am trying to use the <b>rich text type = text/html</b> in PRD version - 3.7.");
    e.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, 12);
    e.getStyle().setStyleProperty(TextStyleKeys.FONT, "Arial");
    e.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 285f);
    e.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 20f);

    final MasterReport report = new MasterReport();
    report.getReportHeader().addElement(e);

    final LogicalPageBox logicalPageBox =
        DebugReportRunner.layoutSingleBand(report, report.getReportHeader(), false, false);
    logicalPageBox.getRepeatFooterArea().setY(logicalPageBox.getContentArea().getHeight());
    logicalPageBox.getFooterArea().setY(logicalPageBox.getContentArea().getHeight());

    // ModelPrinter.INSTANCE.print(logicalPageBox);

    final RenderNode[] elementsByNodeType =
        MatchFactory.findElementsByNodeType(logicalPageBox, LayoutNodeTypes.TYPE_NODE_TEXT);
    assertEquals(
        17, elementsByNodeType.length); // quick and easy way to see that all elements are there.

    // debugPrintText(elementsByNodeType);

    final LocalFontRegistry registry = new LocalFontRegistry();
    registry.initialize();

    final GraphicsOutputProcessorMetaData metaData =
        new GraphicsOutputProcessorMetaData(new DefaultFontStorage(registry));
    metaData.initialize(report.getConfiguration());

    final LogicalPageDrawable drawable = new LogicalPageDrawable();
    drawable.init(logicalPageBox, metaData, report.getResourceManager());

    final TracingGraphics g2 = new TracingGraphics();
    drawable.draw(g2, new Rectangle2D.Double(0, 0, 500, 500));
    /*
        for (int i = 0; i < g2.records.size(); i++)
        {
          final TextTraceRecord record = g2.records.get(i);
          System.out.println ("goldenSamples.add(new TextTraceRecord(" + record.x + ", " + record.y + ", \"" + record.text +"\"));");
        }
    */
    assertEquals(getSamples(), g2.records);
  }
  public void testErrorHandlingBad() throws Exception {
    final URL url = getClass().getResource("Prd-3985.prpt");
    final ResourceManager mgr = new ResourceManager();
    final MasterReport report =
        (MasterReport) mgr.createDirectly(url, MasterReport.class).getResource();
    report
        .getReportConfiguration()
        .setConfigProperty(
            "org.pentaho.reporting.engine.classic.core.FailOnAttributeExpressionErrors", "true");

    final FormulaExpression function = new FormulaExpression();
    function.setName("Test");
    function.setFormula("=MULTIVALUEQUERY(\"Bad\")");

    report
        .getReportHeader()
        .setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, function);

    try {
      DebugReportRunner.createPDF(report);
      Assert.fail();
    } catch (Exception e) {
      // ignored
    }
  }
  public void testMissingTableRow() throws ReportProcessingException, ContentProcessingException {
    final Band tableBody = new Band();
    tableBody.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_TABLE_BODY);
    tableBody.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, -100f);
    tableBody.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 200f);

    final Band table = new Band();
    table.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_TABLE);
    table.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, -100f);
    table.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 200f);
    table.addElement(TableTestUtil.createAutoBox(tableBody));

    final MasterReport report = new MasterReport();
    final ReportHeader band = report.getReportHeader();
    band.addElement(table);

    final LogicalPageBox logicalPageBox =
        DebugReportRunner.layoutSingleBand(report, band, false, false);
    // ModelPrinter.print(logicalPageBox);

    final DescendantMatcher matcher =
        new DescendantMatcher(new ElementMatcher("TableCellRenderBox"));
    final RenderNode[] all = MatchFactory.matchAll(logicalPageBox, matcher);

    assertEquals(0, all.length);
  }
  /**
   * Validate that the banded subreport contained in an inline subreport page-footer content DOES
   * NOT show up in the layout-editor
   *
   * @throws Exception
   */
  public void testInlineBandedSubReport() throws Exception {
    final URL resource = getClass().getResource("Prd-4637.prpt");
    assertNotNull(resource);

    final ResourceManager mgr = new ResourceManager();
    mgr.registerDefaults();
    final MasterReport report =
        (MasterReport) mgr.createDirectly(resource, MasterReport.class).getResource();

    final GlobalAuthenticationStore globalAuthenticationStore = new GlobalAuthenticationStore();
    final ReportRenderContext masterContext =
        new ReportRenderContext(report, report, null, globalAuthenticationStore);
    final SubReport subReport = (SubReport) report.getReportHeader().getElement(0);
    final ReportRenderContext subContext =
        new ReportRenderContext(report, subReport, masterContext, globalAuthenticationStore);

    final SubReport subReport2 = subReport.getReportHeader().getSubReport(0);
    final ReportRenderContext subSubContext =
        new ReportRenderContext(report, subReport2, subContext, globalAuthenticationStore);

    final TestRootBandRenderer r =
        new TestRootBandRenderer(subReport.getPageFooter(), subSubContext);

    final ValidateTextGraphics graphics2D = new ValidateTextGraphics(468, 108);
    graphics2D.expect("Any Text Printed Is An Error!");
    assertTrue(graphics2D.hitClip(10, 10, 1, 1));
    r.draw(graphics2D);
  }
  @Test
  public void testBlockWithPrePostPad() throws Exception {
    final MasterReport report = new MasterReport();
    report.setDataFactory(new TableDataFactory("query", new DefaultTableModel(10, 1)));
    report.setQuery("query");

    final Band table = TableTestUtil.createTable(1, 1, 6, true);
    table.setName("table");
    report.getReportHeader().addElement(TableTestUtil.createDataItem("Pre-Padding", 100, 10));
    report.getReportHeader().addElement(table);
    report.getReportHeader().addElement(TableTestUtil.createDataItem("Post-Padding", 100, 10));
    report.getReportHeader().setLayout("block");

    PdfReportUtil.createPDF(report, "test-output/PRD-3857-output-block.pdf");

    List<LogicalPageBox> pages = DebugReportRunner.layoutPages(report, 0, 1, 2);
    assertPageValid(pages, 0, StrictGeomUtility.toInternalValue(10));
    assertPageValid(pages, 1);
    assertPageValid(pages, 2);
    //    assertPageValid(report, 3);
    //    assertPageValid(report, 4);
  }
  @Test
  public void testRowWithPrePostPad() throws Exception {
    final MasterReport report = new MasterReport();
    report.setDataFactory(new TableDataFactory("query", new DefaultTableModel(10, 1)));
    report.setQuery("query");

    final Band table = TableTestUtil.createTable(1, 1, 6, true);
    table.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 200f);
    table.setName("table");
    report.getReportHeader().addElement(TableTestUtil.createDataItem("Pre-Padding", 100, 10));
    report.getReportHeader().addElement(table);
    report.getReportHeader().addElement(TableTestUtil.createDataItem("Post-Padding", 100, 10));
    report.getReportHeader().setLayout("row");

    PdfReportUtil.createPDF(report, "test-output/PRD-3857-output-row.pdf");
    List<LogicalPageBox> pages = DebugReportRunner.layoutPages(report, 0, 1, 2);

    assertPageValid(pages, 0);
    assertPageValid(pages, 1);
    assertPageValid(pages, 2);
    //    assertPageValid(report, 3);
    //    assertPageValid(report, 4);
  }
  public void testLoadSaveFromDisk() throws Exception {
    final ResourceKey key = createImageKey();

    final Element element = new Element();
    element.setElementType(new ContentType());
    element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, key);
    // .. save it.
    final MasterReport report = new MasterReport();
    report.getReportHeader().addElement(element);

    saveReport(report, new File("bin/test-tmp/prd-3319-load-save-disk-1.prpt"));

    // load it to establish the context in all resource-keys ..
    final ResourceManager mgr = new ResourceManager();
    mgr.registerDefaults();
    final Resource resource =
        mgr.createDirectly(
            new File("bin/test-tmp/prd-3319-load-save-disk-1.prpt"), MasterReport.class);

    // save it once, that changes the bundle ...
    final MasterReport report2 = (MasterReport) resource.getResource();
    saveReport(report2, new File("bin/test-tmp/prd-3319-load-save-disk-2.prpt"));
    // save it twice, that triggers the crash...
    saveReport(report2, new File("bin/test-tmp/prd-3319-load-save-disk-2.prpt"));

    final ProcessingContext processingContext = new DefaultProcessingContext();
    final DebugExpressionRuntime runtime =
        new DebugExpressionRuntime(new DefaultTableModel(), 0, processingContext);

    final Element reportElement = report2.getReportHeader().getElement(0);
    Object attribute =
        reportElement.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);

    assertTrue(attribute instanceof ResourceKey);
    ResourceKey atKey = (ResourceKey) attribute;
    assertEquals("http://127.0.0.1:65535/image.jpg", atKey.getIdentifierAsString());
  }
  public void testRendering() throws Exception {
    MasterReport masterReport = new MasterReport();
    SubReport element = new SubReport();
    masterReport.getReportHeader().addSubReport(element);

    ReportLayouter l = new ReportLayouter(new ReportRenderContext(masterReport));
    LogicalPageBox layout = l.layout();
    ModelPrinter.INSTANCE.print(layout);

    MatchFactory.findElementsByAttribute(
        layout,
        AttributeNames.Core.NAMESPACE,
        AttributeNames.Core.ELEMENT_TYPE,
        element.getElementType());
  }
  @Test
  public void testRunSimpleReport() throws Exception {
    final MasterReport report = new MasterReport();
    report.setDataFactory(new TableDataFactory("query", new DefaultTableModel(10, 1)));
    report.setQuery("query");

    final Band table = TableTestUtil.createTable(1, 1, 6, true);
    table.setName("table");
    report.getReportHeader().addElement(table);
    report.getReportHeader().setLayout("block");

    List<LogicalPageBox> pages = DebugReportRunner.layoutPages(report, 0, 1, 2);
    assertPageValid(pages, 0);
    assertPageValid(pages, 1);
    assertPageValid(pages, 2);
  }
  @Test
  public void testRunRowSpanReport() throws Exception {
    final MasterReport report = new MasterReport();
    report.setDataFactory(new TableDataFactory("query", new DefaultTableModel(10, 1)));
    report.setQuery("query");

    final Band table = TableTestUtil.createTable(1, 1, 6, true);
    final Band section = (Band) table.getElement(1);
    final Band row = (Band) section.getElement(0);
    final Band cell = TableTestUtil.createCell(6, 1);
    cell.addElement(TableTestUtil.createDataItem("Text", 100, 20));
    row.addElement(0, cell);

    table.setName("table");
    report.getReportHeader().addElement(table);
    report.getReportHeader().setLayout("block");

    PdfReportUtil.createPDF(report, "test-output/PRD-3857-rowspan-output.pdf");
    /*
    assertPageValid(report, 0);
    assertPageValid(report, 1);
    assertPageValid(report, 2);
    */
  }
  public void testWeirdTocLayout() throws ReportProcessingException, ContentProcessingException {
    Element textField = new Element();
    textField.setName("textField");
    textField.getStyle().setStyleProperty(TextStyleKeys.FONT, "Arial");
    textField.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, 14);
    textField.getStyle().setStyleProperty(TextStyleKeys.TEXT_WRAP, TextWrap.NONE);
    textField.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 97f);
    textField.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 20f);
    textField.getStyle().setStyleProperty(ElementStyleKeys.POS_X, 0f);
    textField.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, 0f);
    textField.setElementType(LabelType.INSTANCE);
    textField.setAttribute(
        AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "Classic Cars");

    Element dotField = new Element();
    dotField.setName("dotField");
    dotField.getStyle().setStyleProperty(TextStyleKeys.FONT, "Arial");
    dotField.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, 14);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.RIGHT);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.VALIGNMENT, ElementAlignment.TOP);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.POS_X, 97f);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, 0f);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 628.463f);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 20f);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.WIDTH, 100f);
    dotField.getStyle().setStyleProperty(ElementStyleKeys.MAX_WIDTH, 100f);
    dotField.setElementType(LabelType.INSTANCE);
    dotField.setAttribute(
        AttributeNames.Core.NAMESPACE,
        AttributeNames.Core.VALUE,
        " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
            + " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
            + ". . . . . . . . . . . . . . . . . .");

    Band band = new Band();
    band.setName("outer-box");
    band.setLayout("inline");
    band.getStyle().setStyleProperty(ElementStyleKeys.BOX_SIZING, BoxSizing.CONTENT_BOX);
    band.getStyle().setStyleProperty(ElementStyleKeys.OVERFLOW_X, false);
    band.getStyle().setStyleProperty(ElementStyleKeys.OVERFLOW_Y, false);
    band.getStyle().setStyleProperty(TextStyleKeys.LINEHEIGHT, 1f);
    band.getStyle()
        .setStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE, WhitespaceCollapse.PRESERVE_BREAKS);
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 708f);
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 12f);
    band.getStyle().setStyleProperty(ElementStyleKeys.MAX_HEIGHT, 20f);
    band.addElement(textField);
    band.addElement(dotField);

    final MasterReport report = new MasterReport();
    report.getReportHeader().addElement(band);

    LogicalPageBox logicalPageBox =
        DebugReportRunner.layoutSingleBand(report, report.getReportHeader(), false, false);
    // ModelPrinter.INSTANCE.print(logicalPageBox);

    RenderBox outerBox = (RenderBox) MatchFactory.findElementByName(logicalPageBox, "outer-box");
    RenderNode dotFieldBox = MatchFactory.findElementByName(logicalPageBox, "dotField");
    RenderNode textFieldBox = MatchFactory.findElementByName(logicalPageBox, "textField");
    assertNotNull(outerBox);
    assertNotNull(dotFieldBox);
    assertNotNull(textFieldBox);

    assertEquals(0, outerBox.getY());
    assertEquals(0, dotFieldBox.getY());
    assertEquals(0, textFieldBox.getY());

    // box only contains one line, and min-size is set to 8, max size = 20, so the line-height of
    // 14.024 is used.
    assertEquals(StrictGeomUtility.toInternalValue(14.024), outerBox.getHeight());
    assertEquals(StrictGeomUtility.toInternalValue(14.024), outerBox.getFirstChild().getHeight());
    assertEquals(StrictGeomUtility.toInternalValue(14), dotFieldBox.getHeight());
    assertEquals(StrictGeomUtility.toInternalValue(14), textFieldBox.getHeight());
  }
  public void testCanvasBug() throws Exception {
    final MasterReport report = new MasterReport();
    final ReportHeader header = report.getReportHeader();
    header.getStyle().setStyleProperty(TextStyleKeys.FONT, "Monospaced");
    header.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, new Integer(6));
    header.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(50));
    header.getStyle().setStyleProperty(ElementStyleKeys.VALIGNMENT, ElementAlignment.MIDDLE);

    final Element label1 = new Element();
    label1.setElementType(LabelType.INSTANCE);
    label1.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "COST");
    label1.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "COST");
    label1.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    label1.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    label1.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    label1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    label1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    label1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    label1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    label1.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(0));
    label1.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(0));
    header.addElement(label1);

    final Element label2 = new Element();
    label2.setElementType(LabelType.INSTANCE);
    label2.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "DROPPED");
    label2.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "DROPPED");
    label2.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    label2.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    label2.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    label2.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(100));
    label2.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(0));
    header.addElement(label2);

    final Element label3 = new Element();
    label3.setElementType(LabelType.INSTANCE);
    label3.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "DROPPED");
    label3.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "DROPPED");
    label3.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    label3.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    label3.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    label3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    label3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    label3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    label3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    label3.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(200));
    label3.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(0));
    header.addElement(label3);

    final Element labelA1 = new Element();
    labelA1.setElementType(LabelType.INSTANCE);
    labelA1.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "COST");
    labelA1.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "COST");
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(0));
    labelA1.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(12));
    header.addElement(labelA1);

    final Element labelA2 = new Element();
    labelA2.setElementType(LabelType.INSTANCE);
    labelA2.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "DROPPED");
    labelA2.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "DROPPED");
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(100));
    labelA2.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(12));
    header.addElement(labelA2);

    final Element labelA3 = new Element();
    labelA3.setElementType(LabelType.INSTANCE);
    labelA3.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "DROPPED");
    labelA3.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "DROPPED");
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(200));
    labelA3.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(12));
    header.addElement(labelA3);

    final Element labelB1 = new Element();
    labelB1.setElementType(LabelType.INSTANCE);
    labelB1.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "COST");
    labelB1.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "COST");
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(0));
    labelB1.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(24));
    header.addElement(labelB1);

    final Element labelB2 = new Element();
    labelB2.setElementType(LabelType.INSTANCE);
    labelB2.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "DROPPED");
    labelB2.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "DROPPED");
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(100));
    labelB2.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(24));
    header.addElement(labelB2);

    final Element labelB3 = new Element();
    labelB3.setElementType(LabelType.INSTANCE);
    labelB3.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "DROPPED");
    labelB3.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, "DROPPED");
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(12));
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(100));
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(2));
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(2));
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(2));
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(2));
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(200));
    labelB3.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(24));
    header.addElement(labelB3);

    DebugReportRunner.createStreamHTML(report);
  }