Examples of MasterReport


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

  {
    try
    {
      final ResourceKey selectedFile = resourceManager.createKey(filename);
      final Resource directly = resourceManager.create(selectedFile, null, new Class[]{MasterReport.class});
      final MasterReport resource = (MasterReport) directly.getResource();
      final DocumentBundle bundle = resource.getBundle();
      if (bundle == null)
      {
        // Ok, that should not happen if we work with the engine's parsers, but better safe than sorry.
        final MemoryDocumentBundle documentBundle = new MemoryDocumentBundle(resource.getContentBase());
        documentBundle.getWriteableDocumentMetaData().setBundleType(ClassicEngineBoot.BUNDLE_TYPE);
        resource.setBundle(documentBundle);
        resource.setContentBase(documentBundle.getBundleMainKey());
      }
      else
      {
        final MemoryDocumentBundle mem = new MemoryDocumentBundle(resource.getContentBase());
        BundleUtilities.copyStickyInto(mem, bundle);
        BundleUtilities.copyMetaData(mem, bundle);
        resource.setBundle(mem);
        resource.setContentBase(mem.getBundleMainKey());
      }

      return (AbstractReportDefinition) resource.derive();
    }
    catch (Exception ex)
    {
      getDesignTimeContext().error(ex);
      return null;

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

//      if (handler instanceof StackedLayoutXMLDemoHandler == false &&
//          handler instanceof StackedLayoutAPIDemoHandler == false)
//      {
//        continue;
//      }
      final MasterReport report = handler.createReport();
      logger.debug ("Processing " + handler.getDemoName());
      assertNotNull(report);

      logger.debug("   GRAPHICS2D ..");
      assertTrue(FunctionalityTestLib.execGraphics2D(report));

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

  {
  }

  private MasterReport buildSampleReport()
  {
    MasterReport jfreeReport = new MasterReport();
    jfreeReport.setName("Sample Group Report");
    final int width = (int) jfreeReport.getPageDefinition().getWidth();

    final String[] columns = {"column0", "column1", "column2", "column3", "type"};
    final String numberFormat = "$#,##0.00";
    jfreeReport.getPageHeader().addElement(messageField("Sample Group Report",//
        true, 14, ElementAlignment.CENTER, new Rectangle(0, 0, width, 16)));
    RelationalGroup group = new RelationalGroup();
    group.setName("group");
    group.addField("type");
    // group.getHeader().setRepeat(true);
    group.getHeader().addElement(label("Column 0", true, ElementAlignment.CENTER, new Rectangle(0, 0, 120, 14)));
    group.getHeader().addElement(label("Column 1", true, ElementAlignment.CENTER, new Rectangle(130, 0, 120, 14)));
    group.getHeader().addElement(label("Column 2", true, ElementAlignment.CENTER, new Rectangle(260, 0, 120, 14)));
    group.getHeader().addElement(label("Column 3", true, ElementAlignment.CENTER, new Rectangle(390, 0, 70, 14)));
    group.getHeader().addElement(HorizontalLineElementFactory.createHorizontalLine(16));
    group.getHeader().setRepeat(false);
    group.getHeader().setPagebreakBeforePrint(true);
    group.getFooter().setPagebreakAfterPrint(true);
    jfreeReport.addGroup(group);
    // report data item elements
    jfreeReport.getReportFooter().setPagebreakBeforePrint(true);
    jfreeReport.getItemBand().addElement(textField(columns[0], false, new Rectangle(0, 0, 120, 14)));
    jfreeReport.getItemBand().addElement(textField(columns[1], false, new Rectangle(130, 0, 120, 14)));
    jfreeReport.getItemBand().addElement(textField(columns[2], false, new Rectangle(260, 0, 120, 14)));
    jfreeReport.getItemBand().addElement(numberField(columns[3], false, numberFormat, new Rectangle(390, 0, 70, 14)));
    // layout is built, so now fill in the report content to be display
    final int length = 60;
    final int breakpos = 20;
    Object[][] data = new Object[length][5];
    int type = 0;
    for (int i = 0; i < length; i++)
    {
      if (i % breakpos == 0)
      {
        type++;
      }
      data[i][0] = "ROW-" + i + "-0";
      data[i][1] = "ROW-" + i + "-1";
      data[i][2] = "ROW-" + i + "-2";
      data[i][3] = IntegerCache.getInteger(i);
      data[i][4] = IntegerCache.getInteger(type);
    }
    jfreeReport.setDataFactory(new TableDataFactory("default", new DefaultTableModel(data, columns)));
    return jfreeReport;
  }

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

  public static void main(String[] args) throws Exception
  {
    ClassicEngineBoot.getInstance().start();
    Pre205Test sampleReport = new Pre205Test();
    final MasterReport report = sampleReport.buildSampleReport();
//    PreviewDialog previewDialog = new PreviewDialog(report);
//    previewDialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//    previewDialog.pack();
//    previewDialog.setSize(800, 1024);
//    previewDialog.setVisible(true);

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

    ClassicEngineBoot.getInstance().start();
  }

  public void testLoadWorldDemos() throws ReportDefinitionException
  {
    final MasterReport report = new CountryReportAPIDemoHandler().createReport();
    assertTrue(report.getItemBand().getElementCount() > 0);

    final MasterReport report2 = new CountryReportXMLDemoHandler().createReport();
    assertTrue(report2.getItemBand().getElementCount() > 0);
    final MasterReport report3 = new CountryReportExtXMLDemoHandler().createReport();
    assertTrue(report3.getItemBand().getElementCount() > 0);
    final MasterReport report4 = new CountryReportSecurityXMLDemoHandler().createReport();
    assertTrue(report4.getItemBand().getElementCount() > 0);
    final MasterReport report5 = new CountryReportSecurityXMLDemoHandler().createReport();
    assertTrue(report5.getItemBand().getElementCount() > 0);

  }

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

  }

  public void testLoadGroupDemo() throws ReportDefinitionException
  {
    final MasterReport report5 = new GroupsDemo().createReport();
    assertTrue(report5.getItemBand().getElementCount() > 0);
  }

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

    tableModel.setValueAt("C", 4, 0);
    tableModel.setValueAt("CC", 5, 0);

    final URL image = ObjectUtilities.getResource(IMAGE_URLNAME, Pre83ReportTest.class);
    final URL in = ObjectUtilities.getResource(URLNAME, Pre83ReportTest.class);
    final MasterReport report = ReportGenerator.getInstance().parseReport(in);

    final TableDataFactory tdf = new TableDataFactory("Test Query", tableModel);
    tdf.addTable("default", tableModel);
    report.setDataFactory(tdf);
    assertTrue(FunctionalityTestLib.execGraphics2D(report));
   
  }

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

          // contains a non-serializable image
          continue;
        }
        logger.debug("Starting to read " + handler.getDemoName());

        final MasterReport report = handler.createReport();
        final DataFactory model = report.getDataFactory();

        // we don't test whether our demo models are serializable :)
        report.setDataFactory(new TableDataFactory
            ("default", new DefaultTableModel()));
        // clear all report properties, which may cause trouble ...
        final ReportProperties p = report.getProperties();
        final Iterator keys = p.keys();
        while (keys.hasNext())
        {
          String key = (String) keys.next();
          if (p.get(key) instanceof Serializable == false)
          {
            p.put(key, null);
          }
        }

        final ByteArrayOutputStream bo = new ByteArrayOutputStream();
        try
        {
          final ObjectOutputStream oout = new ObjectOutputStream(bo);
          oout.writeObject(report);
          oout.close();
        }
        catch (Exception e)
        {
          logger.debug("Failed to write " + handler.getDemoName(), e);
          fail();
        }

        try
        {
          final ByteArrayInputStream bin = new ByteArrayInputStream(bo.toByteArray());
          final ObjectInputStream oin = new ObjectInputStream(bin);
          final MasterReport report2 = (MasterReport) oin.readObject();
          report2.setDataFactory(model);

          assertTrue(FunctionalityTestLib.execGraphics2D(report2));
        }
        catch (Exception e)
        {

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

  }

  public  void testAPReport() throws Exception
  {
    ClassicEngineBoot.getInstance().start();
    MasterReport report = parseReport(getReportDefinitionSource());
    assertTrue(FunctionalityTestLib.execGraphics2D(report));
  }

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

  }

  public void testGroupItemCount() throws ReportDefinitionException
  {
    CountryReportSecurityXMLDemoHandler demoHandler = new CountryReportSecurityXMLDemoHandler();
    MasterReport report = demoHandler.createReport();
    report.addExpression(new TotalItemCountVerifyFunction());
    final RelationalGroup g = report.getGroupByName("default");
    if (g != null)
    {
      report.removeGroup(g);
    }

    TotalItemCountFunction f = new TotalItemCountFunction();
    f.setName("continent-total-gc");
    f.setGroup("Continent Group");
    f.setDependencyLevel(1);
    report.addExpression(f);

    TotalItemCountFunction f2 = new TotalItemCountFunction();
    f2.setName("total-gc");
    f2.setDependencyLevel(1);
    report.addExpression(f2);

    assertTrue(FunctionalityTestLib.execGraphics2D(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.