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

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


    return reportJob;
  }

  public void setReportJob(final MasterReport reportJob)
  {
    final MasterReport oldJob = this.reportJob;
    this.reportJob = reportJob;

    firePropertyChange(PreviewPane.REPORT_JOB_PROPERTY, oldJob, reportJob);

    if (reportJob == null)


    deferredRepagination = false;


    try
    {
      final MasterReport reportJob = getReportJob();
      printReportProcessor = new PrintReportProcessor(reportJob);

      paginationWorker = createWorker();
      paginationWorker.setWorkload(new RepaginationRunnable(printReportProcessor));
    }

  }

  public void testBugPre181 () throws ReportDefinitionException
  {
    final SimplePatientFormDemo demo = new SimplePatientFormDemo();
    final MasterReport report = demo.createReport();
    final Group group = report.getGroupByName("Patient-Group");
    group.getFooter().getStyle().setStyleProperty(BandStyleKeys.FIXED_POSITION, new Float(1000));
    assertTrue(FunctionalityTestLib.execGraphics2D(report));
   
  }

    }
  }

  protected Configuration computeContextConfiguration()
  {
    final MasterReport report = getReportJob();
    if (report != null)
    {
      return report.getConfiguration();
    }
    return ClassicEngineBoot.getInstance().getGlobalConfig();
  }

      return SwingUtil.getWindowAncestor(PreviewPane.this);
    }

    public Locale getLocale()
    {
      final MasterReport report = getReportJob();
      if (report != null)
      {
        final Locale bundleLocale = report.getResourceBundleFactory().getLocale();
        if (bundleLocale != null)
        {
          return bundleLocale;
        }
        return report.getReportEnvironment().getLocale();
      }
      return Locale.getDefault();
    }

    ClassicEngineBoot.getInstance().start();
  }

  private MasterReport getReport() throws Exception
  {
    final MasterReport report = new MasterReport();
    report.getReportHeader().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "Report Header"));

    report.getReportFooter().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "Report Footer"));

    report.getPageHeader().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "Page Header"));

    report.getPageFooter().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "Page Footer"));

    report.getItemBand().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "Item Band"));

    report.getGroup(0).getHeader().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "Group Header"));

    report.getGroup(0).getFooter().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "Group Footer"));

    report.getGroup(0).getHeader().getStyle().
        setBooleanStyleProperty(BandStyleKeys.PAGEBREAK_BEFORE, true);
    report.getGroup(0).getFooter().getStyle().
        setBooleanStyleProperty(BandStyleKeys.PAGEBREAK_AFTER, true);

    return report;
  }

{
  public static void main(String[] args)
  {
    ClassicEngineBoot.getInstance().start();

    MasterReport report = new MasterReport();
    report.setName("ReportTextLayout001");

    final RectangleElementFactory rectangleElementFactory = new RectangleElementFactory();
    rectangleElementFactory.setColor(Color.GREEN);
    rectangleElementFactory.setStroke(new BasicStroke(1));
    rectangleElementFactory.setX(new Float (0));
    rectangleElementFactory.setY(new Float (10));
    rectangleElementFactory.setMinimumWidth(new Float (-100));
    rectangleElementFactory.setMinimumHeight(new Float (104));
    rectangleElementFactory.setShouldFill(Boolean.TRUE);
    rectangleElementFactory.setShouldDraw(Boolean.TRUE);

    Element labelElement = LabelElementFactory.createLabelElement("Label1",
        new Rectangle2D.Double(0, 10, -100, 104),
        Color.BLACK,
        ElementAlignment.LEFT,
        new FontDefinition("Arial", 40),
        "ppp Title ");
    labelElement.getStyle().setStyleProperty(TextStyleKeys.UNDERLINED, Boolean.TRUE);
    labelElement.getStyle().setStyleProperty(TextStyleKeys.STRIKETHROUGH, Boolean.TRUE);


    report.getReportHeader().addElement(rectangleElementFactory.createElement());
    report.getReportHeader().addElement(labelElement);

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

    ClassicEngineBoot.getInstance().start();
    PreviewFrame preview = new PreviewFrame(report);
    preview.pack();

    return report;
  }

  public void testPageCount() throws Exception
  {
    final MasterReport report = getReport();
    final PrintReportProcessor proc = new PrintReportProcessor(report);
    assertEquals(3, proc.getNumberOfPages());
    proc.close();
  }

  }


  public void testSmallPageCount() throws Exception
  {
    final MasterReport report = getReport();
    report.setReportFooter(new ReportFooter());
    report.setReportHeader(new ReportHeader());

    final PrintReportProcessor proc = new PrintReportProcessor(report);
    assertEquals(1, proc.getNumberOfPages());
    proc.close();
  }

    proc.close();
  }

  public MasterReport getReportTest2()
  {
    /**
     * <groups>
     * <group name="CMR">
     * <fields>
     * <field>CMR</field>
     * </fields>
     * <groupheader height="20">
     * </groupheader>
     * </group>
     *
     * <!-- Second group-->
     * <group name="OC" >
     * <fields>
     * <field>CMR</field>
     * <field>OC</field>
     * </fields>
     *
     * <groupheader height="20" repeat="true">
     * ......................
     * </groupheader>
     *
     * <groupfooter height="10" pagebreak-after-print="true">
     * ....................
     * </groupfooter>
     * </group>
     * </groups>
     *
     * <items height="95" fontname="Serif" fontstyle="plain" fontsize="10">
     */
    final MasterReport report = new MasterReport();
    final RelationalGroup cmr = new RelationalGroup();
    cmr.addField("CMR");
    cmr.getHeader().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "CMR header"));
    cmr.getHeader().getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.ORANGE);

    report.addGroup(cmr);

    final RelationalGroup oc = new RelationalGroup();
    oc.addField("CMR");
    oc.addField("OC");
    oc.getHeader().getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.YELLOW);
    oc.getHeader().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "CMR-OC header"));
    oc.getHeader().getStyle().setBooleanStyleProperty(BandStyleKeys.REPEAT_HEADER, true);

    oc.getFooter().getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.YELLOW);
    oc.getFooter().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "CMR-OC footer"));
    oc.getFooter().getStyle().setBooleanStyleProperty(BandStyleKeys.PAGEBREAK_AFTER, true);
    report.addGroup(oc);

    report.getItemBand().addElement(LabelElementFactory.createLabelElement
        (null, new Rectangle2D.Float(0, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "ItemBand"));
    report.getItemBand().addElement
        (TextFieldElementFactory.createStringElement(null, new Rectangle2D.Float(200, 0, 150, 20), null,
            ElementAlignment.LEFT, null, "-", "RowIndicator"));
    report.setDataFactory(new TableDataFactory
        ("default", createTest2Model()));
    return report;
  }

TOP

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

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.