Examples of MasterReport


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

    return "Testcase: A totally empty report must not crash";
  }

  public MasterReport createReport() throws ReportDefinitionException
  {
    return new MasterReport();
  }

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

    return "Testcase: A totally empty report must not crash";
  }

  public MasterReport createReport() throws ReportDefinitionException
  {
    MasterReport report = new MasterReport();

    report.setName("BorderTest");

    Element label1 = LabelElementFactory.createLabelElement("Label1",
        new Rectangle2D.Double(0, 0, 200, 100),
        Color.RED,
        ElementAlignment.LEFT,
        new FontDefinition("Arial", 12),
        "Label1");

    report.getReportHeader().addElement(label1);

    label1.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, new Color(255, 127, 127, 120));

    Element label2 = LabelElementFactory.createLabelElement("Label2",
        new Rectangle2D.Double(0, 110, 200, 100),
        Color.RED,
        ElementAlignment.LEFT,
        new FontDefinition("Arial", 12),
        "Label2");

    report.getReportHeader().addElement(label2);

    label2.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, new Color(255, 127, 127, 120));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(10));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(10));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(10));
    label2.getStyle().setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(10));


    Element label3 = LabelElementFactory.createLabelElement("Label3",
        new Rectangle2D.Double(210, 0, 200, 100),
        Color.RED,
        ElementAlignment.LEFT,
        new FontDefinition("Arial", 12),
        "Label3");

    report.getReportHeader().addElement(label3);

    label3.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, new Color(255, 127, 127, 120));
    label3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(10));
    label3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(10));
    label3.getStyle().setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(10));

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

    final DefaultTableModel reportTableModel = new DefaultTableModel(
        new Object[][]{{"Customer_ASDFSDFSDFSDFSaasdasdasdasweruzweurzwiezrwieuzriweuzriweu", "Bern", "123"},
            {"Hugo", "Z?rich", "2234"},},
        columnNames);

    final MasterReport report = new MasterReport();

    report.setName("BorderTest");


//    report.getItemBand().addElement(LabelElementFactory.createLabelElement("CustomerLabel",
//        new Rectangle2D.Double(0, 0, 200, 100),
//        Color.RED,
//        ElementAlignment.LEFT,
//        new FontDefinition("Arial", 12),
//        "CustomerLabel"));

    final Element element = TextFieldElementFactory.createStringElement(
        "CustomerField",
        new Rectangle2D.Double(110, 0, 250, 50),
        Color.black,
        ElementAlignment.LEFT,
        ElementAlignment.TOP,
        null, // font
        "-", // null string
        "Customer"
    );


    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_TOP_COLOR, Color.RED);
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_TOP_WIDTH, new Float(5));
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_TOP_STYLE, BorderStyle.SOLID);

    //TODO Was f?r Werte muss ich w?hlen, damit die Linien nicht schr?g ?ber den Report laufen. Ich glaube hier ist etwas noch nicht richtig.
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS, new Dimension(5, 5));
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS, new Dimension(5, 5));
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS, new Dimension(5, 5));
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS, new Dimension(5, 5));

    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_LEFT_COLOR, Color.GREEN);
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_LEFT_WIDTH, new Float(5));
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_LEFT_STYLE, BorderStyle.SOLID);

    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_RIGHT_COLOR, Color.YELLOW);
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_RIGHT_WIDTH, new Float(5));
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_RIGHT_STYLE, BorderStyle.SOLID);

    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_COLOR, Color.CYAN);
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_WIDTH, new Float(5));
    element.getStyle().setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_STYLE, BorderStyle.SOLID);

    //TODO Zum Testen mit halbtransparenter Farbe.
    //TODO Ein Rechteck wird hinter dem Text mit der originalgr?sse des Textes gezeichnet, und nicht mit der Elementgr?sse, auch wenn OVEFRFLOW_X nicht auf true gesetzt ist.
    //TODO Wird Transparenz bei Farben unterst?tzt?
    element.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, new Color(255, 127, 127, 120));

    //TODO padding-left wird auch als padding-top verwendet. Vermutlich verursacht durch den Fehler im ElementStyleKeys (siehe Mail)
    element.getStyle().setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(5));
    //element.getStyle().setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(5));

    //TODO sollte das Padding des Hintergrundes ber?cksichtigt werden, oder sollte der Hintergrund im Overflow-Bereich nicht erscheinen?
    //element.getStyle().setStyleProperty(ElementStyleKeys.OVERFLOW_X, Boolean.TRUE);

    report.getItemBand().addElement(element);

    report.setDataFactory(new TableDataFactory("default", reportTableModel));

    return report;
  }

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

      36523, 22788, 20309, 26041, 65281, 23427, 20197,
      40644, 37329, 20316, 20026, 31561, 20215, 22522,
      30784, 65292, 23436, 20840, 33073, 31163, 20219,
      20309, 22269, 23478, 20869, 37096, 36130, 25919,
      30340, 24433, 21709, 12290};
    final MasterReport report = new MasterReport();
    report.getReportHeader().addElement(LabelElementFactory.createLabelElement(
        null, new Rectangle2D.Float(0, 0, -100, 12), null,
        ElementAlignment.LEFT, null,
        "4 lines with chinese text follows ..."));

    // This font is a chinese font ... if you dont have this font, replace
    // it with another font, which is able to display chinese characters ...
    report.getReportHeader().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 12, -100, 48),
            null, ElementAlignment.LEFT,
            new FontDefinition("mhya9gjp", 10), new String(text)));

    // Embedding the fonts increases the size of the PDF file, but makes
    // sure, that everbody can read the file. If all users have all the fonts
    // installed, which were used to create the report, then you can remove
    // the font-embedding flag.
    //
    // Embedding can also be enabled for single elements (using a FontDefinition
    // object).
    report.getReportConfiguration().setConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.EmbedFonts", "true");

    // Make the PDF file an Unicode file. Without this, you would only see
    // ascii characters, all other characters would not be displayed.
    report.getReportConfiguration().setConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.EmbedFonts", "Identity-H");
    return report;
  }

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

    super(s);
  }

  public void testRemoveElement()
  {
    final MasterReport report = new MasterReport();
    report.setName("A Very Simple Report");


    TextFieldElementFactory factory = new TextFieldElementFactory();
    factory.setName("T1");
    factory.setAbsolutePosition(new Point2D.Float(0, 0));
    factory.setMinimumSize(new FloatDimension(150, 20));
    factory.setColor(Color.black);
    factory.setHorizontalAlignment(ElementAlignment.LEFT);
    factory.setVerticalAlignment(ElementAlignment.MIDDLE);
    factory.setNullString("-");
    factory.setFieldname("Column1");

    final Element element1 = factory.createElement();
    report.getItemBand().addElement(element1);

    factory = new TextFieldElementFactory();
    factory.setName("T2");
    factory.setAbsolutePosition(new Point2D.Float(200, 0));
    factory.setMinimumSize(new FloatDimension(150, 20));
    factory.setColor(Color.black);
    factory.setHorizontalAlignment(ElementAlignment.LEFT);
    factory.setVerticalAlignment(ElementAlignment.MIDDLE);
    factory.setNullString("-");
    factory.setFieldname("Column2");

    final Element element2 = factory.createElement();
    report.getItemBand().addElement(element2);

    //report.getStyleSheetCollection().debug();

    report.getItemBand().removeElement(element1);
    //report.getStyleSheetCollection().debug();
    FunctionalityTestLib.execGraphics2D(report);
  }

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

    FunctionalityTestLib.execGraphics2D(report);
  }

  public void testRemoveElementComplete()
  {
    final MasterReport report = new MasterReport();
    report.setName("A Very Simple Report");


    TextFieldElementFactory factory = new TextFieldElementFactory();
    factory.setName("T1");
    factory.setAbsolutePosition(new Point2D.Float(0, 0));
    factory.setMinimumSize(new FloatDimension(150, 20));
    factory.setColor(Color.black);
    factory.setHorizontalAlignment(ElementAlignment.LEFT);
    factory.setVerticalAlignment(ElementAlignment.MIDDLE);
    factory.setNullString("-");
    factory.setFieldname("Column1");

    final Element element1 = factory.createElement();
    report.getItemBand().addElement(element1);

    factory = new TextFieldElementFactory();
    factory.setName("T2");
    factory.setAbsolutePosition(new Point2D.Float(200, 0));
    factory.setMinimumSize(new FloatDimension(150, 20));
    factory.setColor(Color.black);
    factory.setHorizontalAlignment(ElementAlignment.LEFT);
    factory.setVerticalAlignment(ElementAlignment.MIDDLE);
    factory.setNullString("-");
    factory.setFieldname("Column2");

    final Element element2 = factory.createElement();
    report.getItemBand().addElement(element2);

    //report.getStyleSheetCollection().debug();

    report.getItemBand().removeElement(element1);
    report.getItemBand().removeElement(element2);

    //report.getStyleSheetCollection().debug();
    FunctionalityTestLib.execGraphics2D(report);

  }

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

  {
    if (GraphicsEnvironment.isHeadless())
    {
      return;
    }
    MasterReport report = getReport();
    TestSystem.showPreview(report);
  }

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

   * @return the fully initialized JFreeReport object.
   * @throws ReportDefinitionException if an error occured preventing the report definition.
   */
  public MasterReport createReport() throws ReportDefinitionException
  {
    final MasterReport report = parseReport();
    report.setDataFactory(new TableDataFactory("default", data));
    return report;
  }

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

  {
    // Boot the system

    // Load the report
    final ReportGenerator generator = ReportGenerator.getInstance();
    final MasterReport report = generator.parseReport
        (ObjectUtilities.getResourceRelative("IncomeStatement.xml", IncomeStatementTest.class));
    // Create the report and export to the supplied output filename
    PdfReportUtil.createPDF(report, "report.pdf");
    HtmlReportUtil.createStreamHTML(report, "bug.html");
  }

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

   * @throws org.pentaho.reporting.engine.classic.demo.util.ReportDefinitionException
   *          if an error occured preventing the report definition.
   */
  public MasterReport createReport() throws ReportDefinitionException
  {
    final MasterReport report = new MasterReport();

    final BarcodeElementFactory factory = new BarcodeElementFactory();
    factory.setFieldname("value");
    factory.setAbsolutePosition(new Point2D.Float(0, 0));
    // remember that with barcodes we do not have much control over the element size, just make it big enough
    // to be fully printable
    factory.setMinimumSize(new Dimension(300, 50));
    factory.setType(SimpleBarcodesUtility.BARCODE_CODE128);   // code128 accepts every characters
    factory.setBarWidth(new Integer(2));
    factory.setBarHeight(new Integer(30));
    factory.setFontSize(new Integer(10));
    factory.setFontName("SansSerif");


    final ItemBand itemBand = report.getItemBand();
    itemBand.addElement(factory.createElement());

    report.setDataFactory(new TableDataFactory("default", data));
    return report;
  }
TOP
Copyright © 2018 www.massapi.com. 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.