Package org.pentaho.reporting.engine.classic.core

Examples of org.pentaho.reporting.engine.classic.core.ReportHeader


  }

  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);
  }
View Full Code Here


  public void testCanvasLayout () throws ReportProcessingException, ContentProcessingException
  {

    final MasterReport report = new MasterReport();
    final ReportHeader reportHeader = report.getReportHeader();
    reportHeader.addElement(createBand("large", 0, 100));
    reportHeader.addElement(createBand("rel", -25, -50));

    // Each character (regarless of font or font-size) will be 8pt high and 4pt wide.
    // this makes this test independent of the fonts installed on the system we run on.

    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(report, reportHeader);
View Full Code Here

    rowBand.getStyle().setStyleProperty(ElementStyleKeys.VALIGNMENT, ElementAlignment.MIDDLE);
    rowBand.getStyle().setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    rowBand.addElement(label);

    final MasterReport report = new MasterReport();
    final ReportHeader band = report.getReportHeader();
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 2f);
    band.addElement(rowBand);

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

    final RenderNode labelRenderBox = MatchFactory.findElementByName(logicalPageBox, "Label");
View Full Code Here

    rowBand.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "row");
    rowBand.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 1f);
    rowBand.addElement(canvasBand);

    final MasterReport report = new MasterReport();
    final ReportHeader band = report.getReportHeader();
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 2f);
    band.setLayout("block");
    band.addElement(rowBand);

    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(report, band);
    final RenderNode canvasBandRenderBox = MatchFactory.findElementByName(logicalPageBox, "CanvasBand");
    assertEquals(0, canvasBandRenderBox.getWidth());
  }
View Full Code Here

    rowBand.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "canvas");
    rowBand.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 1f);
    rowBand.addElement(canvasBand);

    final MasterReport report = new MasterReport();
    final ReportHeader band = report.getReportHeader();
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 2f);
    band.setLayout("block");
    band.addElement(rowBand);

    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(report, band);
    final RenderNode canvasBandRenderBox = MatchFactory.findElementByName(logicalPageBox, "CanvasBand");
    assertEquals(0, canvasBandRenderBox.getWidth());
  }
View Full Code Here

    outsideBody.setLayout(BandStyleKeys.LAYOUT_BLOCK);
    outsideBody.setName("group-body-outside");
    outsideBody.addElement(insideGroup);
    outsideBody.addElement(insideGroup2);

    final ReportHeader band = report.getReportHeader();
    band.getStyle().setStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE, false);
    band.setLayout(BandStyleKeys.LAYOUT_BLOCK);
    band.setName("group-outside");
    band.getStyle().setStyleProperty(ElementStyleKeys.ORPHANS, 2);
    band.addElement(createBand("group-header-outside"));
    band.addElement(outsideBody);
    band.addElement(createBand("group-footer-outside"));

    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(report, band, false, false);
    final RenderNode grOut = MatchFactory.findElementByName(logicalPageBox, "group-outside");
    assertTrue(grOut instanceof RenderBox);
    final RenderBox grOutBox = (RenderBox) grOut;
View Full Code Here

    outsideBody.setLayout(BandStyleKeys.LAYOUT_BLOCK);
    outsideBody.setName("group-body-outside");
    outsideBody.addElement(insideGroup);
    outsideBody.addElement(insideGroup2);

    final ReportHeader band = report.getReportHeader();
    band.getStyle().setStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE, false);
    band.setLayout(BandStyleKeys.LAYOUT_BLOCK);
    band.setName("group-outside");
    band.getStyle().setStyleProperty(ElementStyleKeys.ORPHANS, 2);
    band.addElement(createBand("group-header-outside"));
    band.addElement(outsideBody);
    band.addElement(createBand("group-footer-outside"));

    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(report, band, false, false);
    final RenderNode grOut = MatchFactory.findElementByName(logicalPageBox, "group-outside");
    assertTrue(grOut instanceof RenderBox);
    final RenderBox grOutBox = (RenderBox) grOut;
View Full Code Here

    assertNotNull(url);
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    final Resource directly = resourceManager.createDirectly(url, MasterReport.class);
    final MasterReport report = (MasterReport) directly.getResource();
    final ReportHeader rh = report.getReportHeader();
//    rh.removeSubreport(rh.getSubReport(1));
    rh.removeSubreport(rh.getSubReport(1));
    rh.removeSubreport(rh.getSubReport(1));
    rh.removeSubreport(rh.getSubReport(1));
    rh.removeSubreport(rh.getSubReport(1));
    DebugReportRunner.execGraphics2D(report);

  }
View Full Code Here

  @Test
  public void testRowLayoutAtRunTime() throws Exception
  {
    MasterReport report = new MasterReport();
    ReportHeader reportHeader = report.getReportHeader();
    reportHeader.setLayout(BandStyleKeys.LAYOUT_ROW);
    reportHeader.getStyle().setStyleProperty(ElementStyleKeys.INVISIBLE_CONSUMES_SPACE, false);
    reportHeader.addElement(createElement(true));
    reportHeader.addElement(createElement(false));
    reportHeader.addElement(createElement(true));

    LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(report, reportHeader);

    RenderNode[] elementsByElementType = MatchFactory.findElementsByNodeType(logicalPageBox, LayoutNodeTypes.TYPE_BOX_PARAGRAPH);
    Assert.assertEquals(2, elementsByElementType.length);
View Full Code Here

  }

  public void testAlignmentCenter() throws Exception
  {
    final MasterReport report = new MasterReport();
    ReportHeader reportHeader = report.getReportHeader();
    reportHeader.addElement(LabelElementFactory.createLabelElement("CustomerLabel",
        new Rectangle2D.Double(0, 0, 203, 157),
        Color.RED,
        ElementAlignment.JUSTIFY,
        null,
        longText));
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.ReportHeader

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.