Package org.jfree.report

Examples of org.jfree.report.JFreeReport


     
      model = ResultSetTableModelFactory.getInstance().createTableModel(rs);

      ReportGenerator generator = ReportGenerator.getInstance();
     
      JFreeReport jfreeReport = generator.parseReport(directoryProvider
          .getReportDirectory()
          + report.getFile());
      jfreeReport.setData(model);

      ReportEngineOutput output = new ReportEngineOutput();
     
      if (input.getExportType() == ExportType.PDF)
      {
View Full Code Here


      JOptionPane.showMessageDialog(null, "ReportDefinition " + rapName + " not found on classpath");
      return;
    }
    ReportGenerator gen = ReportGenerator.getInstance();
    try {
      final JFreeReport report1 = gen.parseReport(file1);
      report1.setData(myData);
      setReportProperties(report1, rapName, imagePath, compName,compId);
      final PreviewFrame frame1 = new PreviewFrame(report1);
      frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame1.pack();
      RefineryUtilities.positionFrameRandomly(frame1);
View Full Code Here

      if (file1 == null || !file1.isFile()) {
        JOptionPane.showMessageDialog(null, "ReportDefinition DiagramSource4.xml not found on classpath");
        return;
      }
      ReportGenerator gen = ReportGenerator.getInstance();
      JFreeReport report1;

      try {
        report1 = gen.parseReport(file1);
      } catch (Exception ioe) {
        JOptionPane.showMessageDialog(null, ioe.getMessage(), "Error: " + ioe.getClass().getName(), JOptionPane.ERROR_MESSAGE);
        return;
      }

      if (report1 == null) {
        throw new NullPointerException("Damn, is null");
      }

      report1.setProperty("diagramreport", Translator.getTranslation("Print out of diagrams values"));
      report1.setProperty("catagory", Translator.getTranslation("Catagory"));
      report1.setProperty("value", Translator.getTranslation("Value"));
      report1.setProperty("series", Translator.getTranslation("Series"));
      report1.setProperty("dateToday", DateField.getTodaysDateString());
      report1.setProperty("company", (String) cc.comboBox.getSelectedItemsSecondaryKey());
      report1.setProperty("companytext", Translator.getTranslation("Company"));

      AbstractTableModel myData =
        new AbstractTableModel() {

          //{{{ +getColumnClass(int) : Class
          public Class getColumnClass(int c) {
            return new String().getClass();
          }//}}}

          // These methods always need to be implemented.

          //{{{ +getColumnCount() : int
          public int getColumnCount() {
            return 3;
          }//}}}


          // The default implementations of these methods in
          // AbstractTableModel would work, but we can refine them.
          //{{{ +getColumnName(int) : String
          public String getColumnName(int column) {
            switch (column) {
              case 0:
                return "Series";
              case 1:
                return "Catagory";
              default:
                return "Value";
            }
          }//}}}


          //{{{ +getRowCount() : int
          public int getRowCount() {
            return dataset.getColumnCount() * dataset.getRowCount();
          }//}}}


          //{{{ +getValueAt(int, int) : Object
          public Object getValueAt(int row, int col) {

            int calcCol = row % dataset.getColumnCount();
            int calcRow = row / dataset.getColumnCount();
            Log.log(Log.DEBUG, this, "getvalue " + calcRow + " ; " + calcCol + " ; " + row
                 + " ; " + col);
            switch (col) {
              case 0:
                return dataset.getRowKey(calcRow);
              case 1:
                return dataset.getColumnKey(calcCol);
              default:
                return DoubleField.ConvertDoubleToLocalizedString(
                    new Double(dataset.getValue(calcRow, calcCol).doubleValue()));
            }
          }//}}}


          //{{{ +isCellEditable(int, int) : boolean
          public boolean isCellEditable(int row, int col) {
            return false;
          }//}}}


          //{{{ +setValueAt(Object, int, int) : void
          public void setValueAt(Object aValue, int row, int col) {
          }//}}}
        };
      report1.setData(myData);
      try {
        PreviewFrame frame1 = new PreviewFrame(report1);
        frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame1.pack();
        RefineryUtilities.positionFrameRandomly(frame1);
View Full Code Here

                                final ResourceManager manager,
                                final ResourceData data,
                                final ResourceKey context)
          throws ResourceCreationException, ResourceLoadingException
  {
    final JFreeReport report = (JFreeReport) res;
    if (report == null)
    {
      throw new ResourceCreationException("Report has not been parsed.");
    }
    if (context != null)
    {
      report.setBaseResource(context);
    }
    else
    {
      report.setBaseResource(data.getKey());
    }
    report.setResourceManager(manager);

    return report;
  }
View Full Code Here

   * arbitary values and should not be confused with the ones provided by the
   * XMLparser itself.
   */
  public ReportReadHandler()
  {
    report = new JFreeReport();
    styleSheetReadHandlers = new ArrayList();
  }
View Full Code Here

    {
      throw new ParseException
              ("Required element 'query' is missing.", getLocator());
    }
    super.doneParsing();
    JFreeReport report = (JFreeReport) getElement();
    report.setQuery(queryReadHandler.getResult());
    if (propertiesReadHandler != null)
    {
      final Properties p = propertiesReadHandler.getResult();
      final Iterator entries = p.entrySet().iterator();
      while (entries.hasNext())
      {
        Map.Entry entry = (Map.Entry) entries.next();
        report.getEditableConfiguration().setConfigProperty
                ((String) entry.getKey(), (String) entry.getValue());
      }
    }
    if (datasourceFactoryReadHandler != null)
    {
      report.setDataFactory(datasourceFactoryReadHandler.getDataFactory());
    }
    for (int i = 0; i < styleSheetReadHandlers.size(); i++)
    {
      StyleSheetReadHandler handler = (StyleSheetReadHandler)
              styleSheetReadHandlers.get(i);
      report.addStyleSheet(handler.getStyleSheet());
    }
  }
View Full Code Here

  protected FlowController startData(final ReportTarget target,
                                     final FlowController fc)
      throws DataSourceException,
      ReportProcessingException, ReportDataFactoryException
  {
    final JFreeReport report = (JFreeReport) getElement();
    target.startReport(report);
    return fc.performQuery(report.getQuery());
  }
View Full Code Here

  protected FlowController finishData(final ReportTarget target,
                                      final FlowController fc)
      throws DataSourceException, ReportProcessingException
  {
    final JFreeReport report = (JFreeReport) getElement();
    target.endReport(report);
    // do something fancy ... query the data, for instance.
    // this implies that we create a new global datarow.
    return fc.performReturnFromQuery();
  }
View Full Code Here

        feed.endMetaNode();
      }

      if (report instanceof JFreeReport)
      {
        final JFreeReport realReport = (JFreeReport) report;
        final int size = realReport.getStyleSheetCount();
        for (int i = 0; i < size; i++)
        {
          final StyleSheet styleSheet = realReport.getStyleSheet(i);
          feed.startMetaNode();
          feed.setMetaNodeAttribute("type", "style");
          feed.setMetaNodeAttribute("#content", styleSheet);
          feed.endMetaNode();
        }
View Full Code Here

   * arbitary values and should not be confused with the ones provided by the
   * XMLparser itself.
   */
  public ReportReadHandler()
  {
    report = new JFreeReport();
    styleSheetReadHandlers = new ArrayList();
  }
View Full Code Here

TOP

Related Classes of org.jfree.report.JFreeReport

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.